| Line 1: |
Line 1: |
| | {{Math-m}} | | {{Math-m}} |
| | | | |
| − | A '''function''' f is a rule for taking one item x, as an input, and producing another item f(x) as an output. Frequently this will involve numbers, so for example the [[polynomial]] <math>f(x) = x^2</math> takes numbers as inputs, and outputs their squares. So in this case, if 1 is input, 1 is output, whilst if 2 is input, 4 is output. However, there are functions that take other objects as inputs. For example, rotation can be thought of as a function that takes a shape as an input, and outputs that shape rotated by a certain angle. | + | A '''function''' "''f''" is a fixed method for calculating a unique output "''f(x)''" for every given input 'x'. For example, the [[polynomial]] function <math>f(x) = x^2</math> takes numbers as inputs, and outputs their squares. So in this case, if 1 is input, 1 is output, whilst if 2 is input, 4 is output. |
| | | | |
| − | Usually, a function will be written with a formula for the output, in terms of the input. For example, in the case of f above, the formula is <math>f(x) = x^2</math>. When we want to input a particular value, we insert it in the place of x. So <math>f(1) = 1^2 = 1*1 = 1</math>.
| + | A function is typically written with a formula for the output, in terms of the input. For example, in the case of f above, the formula is <math>f(x) = x^2</math>. When we want to input a particular value, we insert it in the place of x. So <math>f(1) = 1^2 = 1*1 = 1</math>. |
| | | | |
| | ==Examples== | | ==Examples== |
| Line 38: |
Line 38: |
| | | | |
| | We can also apply the functions in the opposite order to get g <math>\circ</math> f, where we apply f first then g. f(x) = x + 1, and g(x+1) = 2(x+1) = 2x + 2. So (g <math>\circ</math> f)(x) = 2x + 2. So, the order in which we combine the functions makes a difference to the final result. Again, we test this formula by applying the function to 8. f(8) = 9, and g(9) 18. 18 = 2*8 + 2, as expected. | | We can also apply the functions in the opposite order to get g <math>\circ</math> f, where we apply f first then g. f(x) = x + 1, and g(x+1) = 2(x+1) = 2x + 2. So (g <math>\circ</math> f)(x) = 2x + 2. So, the order in which we combine the functions makes a difference to the final result. Again, we test this formula by applying the function to 8. f(8) = 9, and g(9) 18. 18 = 2*8 + 2, as expected. |
| | + | |
| | + | == Non-numeric functions == |
| | + | |
| | + | There are functions that take objects other than numbers as inputs. For example, rotation can be thought of as a function that takes a shape as an input, and outputs that shape rotated by a certain angle. |
| | | | |
| | ==External Link== | | ==External Link== |