This site is supported by donations to The OEIS Foundation.

# Functions

**stub**, please help by expanding it.

A **function** takes a value or group of values (the arguments), performs an operation on those values, and returns the result. Generally, letters of the Greek alphabet or italicized letters of the Latin alphabet are used for this purpose, with generally being a generic function.

For example, is a function that takes the integer , squares it, adds that to it and 1, and returns the result of that operation.

More formally, we can define a function "from a set to a set " as "a rule that assigns to each element of a unique element of . We write ."^{[1]} The function may give the same result for two or more different arguments, but if it gives two or more results for the same argument, then it is not considered a function. For example,

^{[2]}

is a function, even though it gives –1 as a result for infinitely many values of . It would not be considered a function if the second condition was instead, because then would be ambiguous: it could be or it could be .

Thus technically the square root is not a function, since, for example, but also . What is usually implemented as the square root function would more correctly be called the *principal* square root function, where the "principal" square root is taken to be the positive real root in the case of positive real arguments, the positive imaginary root in the case of negative real arguments, etc.

Given , the set may be finite, countably infinite or uncountably infinite; the same goes for . Furthermore, it may be the case that , with the most obvious example being the identity function , and the principal square root function being a less obvious example. Now, to give examples where , we present the real part function ^{[3]} and the floor function .^{[4]} Lastly, to give an example where is finite, we exhibit the Möbius function .

In the OEIS, is usually a function that returns the th value of the sequence under consideration.

- ↑ Steven G. Krantz,
*Calculus Demystified*, 2nd. Edition. New York: McGraw-Hill (2011): 35. - ↑ This is Example 1.32 in Krantz (2011).
- ↑ The imaginary part function makes for a somewhat less straightforward example.
- ↑ The ceiling function would work equally well for this example.