What Types of Things Do Functions Process?
- Stella Seremetaki
- Dec 5, 2017
- 2 min read
Updated: Mar 29, 2021
A set is a collection of things
Here are some examples:
Set of even numbers: {..., -4, -2, 0, 2, 4, ...} Set of prime numbers: {2, 3, 5, 7, 11, 13, 17, 19, 23, ...} Positive multiples of 2 that are less than 10: {2,4, 8}
Each individual thing in the set (such as "4") is called a member, or element.
So, a function takes elements of a set, and gives back elements of a set.
But a function has special rules:
It must work for every possible input value
And it has only one relationship for each input value
This can be said in one definition:
A function relates each element of a set with exactly one element of another set (possibly the same set).
"...each element..." means that every element in X is related to some element in Y.
We say that the function covers X (relates every element of it).
(But some elements of Y might not be related to at all, which is fine.)
"...exactly one..." means that a function is single valued. It will not give back 2 or more results for the same input.
Conclusion
a function relates inputs to outputs
a function takes elements from a set (the domain) and relates them to elements in a set (the codomain).
all the outputs (the actual values related to) are together called the range
a function is a special type of relation where:
every element in the domain is included, and
any input produces only one output (not this or that)
an input and its matching output are together called an ordered pair
so a function can also be seen as a set of ordered pairs
Comentários