I hope you know what a function is. If you don’t I would care to explain. Simply put a function is a machine.
A machine that takes in input, performs some processing on it and returns an output.
Here is a function. A simple one. Guess what it does. (FYI, its read as “f of x is equal to x plus 5.” )
It simply takes an input x and adds 5 to it before spitting out an output. consider a set of five elements
The set of our outputs would be after passing each element through the machine (function)
This gives us a mapping from to
So yeah you get the idea. There are lots of these machines(uhmm functions) such as:
Take an example of the function: This machine takes an input, stores it in a container x, squares it and returns the squared value as output.
But take note, the input 2 and -2 both have the same output 4. This is completely acceptable. A machine can therefore be:
- a one to one machine where one input uniquely maps to a single output
- or a many to one machine where two unique inputs map to the same output.
However, if a single input results in multiple outputs after being passed through the machine, then the machine is considered broken and qualifies not to be called a function.
One to many mapping does not qualify as a valid function (machine)
The above machine types are categorized by how they map (that is whether they are one to one, or many to one). However, you can also categorize function by their form (that is their shape). In so doing, we come up with these 5 kinds of functions by form:
- polynomial e.g
- exponential e.g
- logarithmic e.g
- trigonometric e.g and
- rational e.g
Below are the forms of each.
Function Plots
[!tikz-row]
[!tikz-row-center]
Of all the 5 types of functions by form, the simplest to work with are the polynomials (a reason why computer scientists like working with them). Why the simplest you might ask? It’s because they are easy to manipulate. They are made up of basic operators, that is the multiplication, addition, subtraction and division. Operations even a computer can carry out.
Now lets get into the “Why begin this blog talking about functions? ”.Let me ask you one question that will probably make you see the the reason behind the why . what is the sine of 90.
You probably know that by heart after those intense A-level math classes, i doubt you can ever forget it. No need for a calculator. 90 is a standard angle and its sine is simply 1.
Good, now what is sin(67)? Not so easy anymore,huh. Now you definetly need a calculator. Using a calculator simply shifts the problem to the calculator. How does the calculator know the answer. It is not like the calculator was hard-coded with all the possible outputs of the sine of any value you pass in as . That does not scale. So how does the calculator know to return
You would say, “Joshua, give me a second, I am pretty sure i can solve without using a calculator, trust me bro”. So I chill, I wait to see what tricks you pull out the bag. So at that moment, you remember the power of the equilateral triangle. So in your clever mind you say, “Imagine an equilateral triangle with sides of length 2”. So I imagine it as you say.
You say to me, “from this triangle we can derive the values of sine, cosine and tan of three standard angles”. That is , and . I node along as I see your brilliance start to shine. So you say, “This means:”
I pause as I wait for you to show that . You too pause and wonder for a while. You ask yourself, “if I consider 90 as the angle, then what is the opposite side and what is the hypotenuse”. Then you are struck by the epiphany of limits. You smirk. So you draw out the traingle and place it in a unit circle.
So you say to me, “As the angle approaches , the length becomes smaller and smaller whilst the length approaches the same length as ”. So you draw these diagrams just to prove the point in my face.
[!tikz-row-center]
So you continue to say,“That means:”
Damn, all that to prove that . Wow, okay. I believe you. move on. So you continue on to the cosines and say:
Okay, so we have all we need to start getting the cos(67). You say that:
And according to the double angle formula, this can be written as
Then you recall the small angle formula that says that for small angle in radians,
and
So you change to radians using the equation
therefore
so the equation becomes
Then you say, there you go, that is the sin(67). But i say, could you simplify it further to a single decimal value. You say, i will need a calculator for this, i say, that is okay. You arrive to the value
Which is close to the answer we got earlier from directly pressing sin(67) in the calculator. The difference of the two values is which is small enough for us to ignore. So there you go, you were able find sin(67) without using a calculator, ok maybe up to the end where you were defeated by the root of three ( ). “I could find it on paper without using a calculator”, you say. I say, I believe you. Anyway, the point I am driving at here is that you were able to turn a sin into addition, division and multiplication operations which you can do on paper because they are simple. But is a function that crept into our final almost polynomial transformation.
The Question then becomes, How can we represent any non polynomial equation as a polynomial. This is where things become interesting.