Function: Difference between revisions
No edit summary |
|||
Line 1: | Line 1: | ||
A '''function''' is a | A '''function''' is a ''process'' that converts units of one mathematical [[Concept#Notion|notion]] into units of another. | ||
The notation <math>f : A \rightarrow B</math> is shorthand for the following statement: <math>A</math> and <math>B</math> are some mathematical notions, <math>f</math> is a function converting an <math>A</math> into a <math>B</math>. | |||
== Examples == | == Examples == | ||
The following table | [[File:617645 orig.png|thumb|Figure (1): Redstone XOR gate in Minecraft]] | ||
=== Functions === | |||
The following table encodes a function: | |||
{| class="wikitable" | {| class="wikitable" | ||
|+f(x) | |+f(x) | ||
Line 17: | Line 22: | ||
|0 | |0 | ||
|} | |} | ||
That table describes the input and output of an XOR gate. A XOR gate (another example of a function) can | That table describes the input and output of an XOR gate. A XOR gate (another example of something that performs a function) can be seen in figure (1). | ||
The following lines of C++ code perform a function: | |||
The following lines of C++ code | [[File:Bernegger Manuale 136.jpg|thumb|Figure (2): A 1619 book of mathematical tables by Matthias Bernegger, showing some of the sine, tangent, and secant functions. ]] | ||
string reverseString(const string &s) { | string reverseString(const string &s) { | ||
string returnStr = ""; | string returnStr = ""; | ||
for (int i = s.size() - 1; i >= 0; --i) { | for (int i = s.size() - 1; i >= 0; --i) { | ||
returnStr.append(s[ | returnStr.append(s[i]); | ||
} | } | ||
return returnStr; | return returnStr; | ||
} | } | ||
A [[Sequences|sequence]] is a function. | |||
A table describing several [[trigonometric functions]] is shown in figure (2). | |||
A [[Graph (function)|graph]] can describe a function: it provides instructions for producing outputs from inputs. | |||
The method that an elementary schooler learns for carrying out long division is a function. | |||
=== Non-functions === | |||
A coffee machine is not a function. It carries out a process; it takes some inputs (energy, water, coffee grounds, paper filter) and converts them into coffee. But the inputs and outputs are not mathematical notions. | |||
== The traditional concept == | |||
In standard mathematics, a function always converts elements of a set <math>X</math> into elements of a set <math>Y</math>. The sets could be [[Sets#Infinite sets|infinite]], so the function doesn't have to describe a real process. In fact, though standard mathematicians usually think about functions ''as if'' they were processes, standard mathematics technically doesn't define functions as processes at all. Rather, it defines a function from <math>X</math> to <math>Y</math> as a subset of <math>X \times Y</math> satisfying certain conditions. | |||
A function doesn't have to describe a real process, beca |
Revision as of 04:30, 20 January 2024
A function is a process that converts units of one mathematical notion into units of another.
The notation is shorthand for the following statement: and are some mathematical notions, is a function converting an into a .
Examples

Functions
The following table encodes a function:
x | (0,0) | (1,0) | (0,1) | (1,1) |
f(x) | 0 | 1 | 1 | 0 |
That table describes the input and output of an XOR gate. A XOR gate (another example of something that performs a function) can be seen in figure (1). The following lines of C++ code perform a function:

string reverseString(const string &s) { string returnStr = ""; for (int i = s.size() - 1; i >= 0; --i) { returnStr.append(s[i]); } return returnStr; }
A sequence is a function.
A table describing several trigonometric functions is shown in figure (2).
A graph can describe a function: it provides instructions for producing outputs from inputs.
The method that an elementary schooler learns for carrying out long division is a function.
Non-functions
A coffee machine is not a function. It carries out a process; it takes some inputs (energy, water, coffee grounds, paper filter) and converts them into coffee. But the inputs and outputs are not mathematical notions.
The traditional concept
In standard mathematics, a function always converts elements of a set into elements of a set . The sets could be infinite, so the function doesn't have to describe a real process. In fact, though standard mathematicians usually think about functions as if they were processes, standard mathematics technically doesn't define functions as processes at all. Rather, it defines a function from to as a subset of satisfying certain conditions.
A function doesn't have to describe a real process, beca