this page is hidden, and not searchable
Person has been banned


You might have heard about "functions" like sin, cosine, or absolute value before, but, what is a function really?
A function, like most things in mathematics is an abstraction. It is a map, between elements of one set to another set. It's sort of like an instruction manual, which tells you a particular output, for any given one (or more) inputs.
The input set of a function is known as its Domain, and the output set, is known as the function's Codomain. The domain and codomain can be anything! They can be real numbers, imaginary numbers, shapes, colors, or even types of farm animal. In computer science, they are often variable types, such as integers, arrays, or objects.
Functions are often represented as tables or curves on graphs. Tables are useful when the numeric values of a function are of interest, for example, when calculating the returns on a money investment. Graphs are useful when functions describe surfaces, shapes, or, when you just want to get a feel for what a function's behavior looks like.
It is important to note what is, and is not a function. Functions have a special property where there never more than one output for any input. This means, if you have a function , you can never have two results for a value of . (you can though, have no result!)

Types of Functions

Defining a domain and co-domain for a function allows us to classify them into a few basic types. These types allow us to make some intuitions about the function's behavior, such as what kind of map the function represents.
- General functions can have the same output more than once, for different inputs.
- Injective functions don't share the same output for a given input -all outputs are unique.
- Surjective functions have no orphan outputs -every output must have a corresponding input.
- Bijective functions are both injective and surjective -every input has exactly one unique output.

Inverse Functions

Since bijective functions have a unique, one-to-one mapping from their input set to their output set, it is possible to define an inverse for a bijective function. This inverse function will return the input to the original function which created that value, which can be super handy for reconstructing information, if all we have is data, and a function.
Usually, inverse functions are written as , or .
On a graph, an inverse function is a mirror reflection over the line y=x. In the case of the natural logarithm function, , its inverse is the function .
Not all functions have inverses though! As we can see here, the function has no true inverse, as the inverse "function" would have places where two results are found for a given input. This is no surprise, as is not a bijective function.

What are functions good for?

Functions are great for describing the behavior of things in real life. A very simple function for example, is the Ohm's Law function, . It states that electricity with a pressure of 1 volt, will flow through a resistance of 1 ohm, at a rate (volume) of 1 Ampere. This simple relationship shows up all the time in electronics, construction, and physics, and can be used to build more complicated functions -such as a function that tells you how much copper you need in the wires to your house!
Functions are especially important in video games. They are used to calculate everything in the simulated world, from the angle of shadows from objects, the shape of the world's terrain, to even very complicated things, like the splashes from a vehicle crashing into water.