function
content="Definition of function,
possibly with links to more information and implementations.">
function
(definition)
Definition:
(1) A computation which takes some arguments or inputs and yields an output. Any particular input yields the same output every time. More formally, a mapping from each element in the domain to an element in the range. (2) A subroutine which returns a value.
See also
relation, total function, boolean function, constant function, unary function, binary function, trinary function, n-ary function, procedure.
Note:
(1) A relation may map an input to more than one output. Every function is a relation. The inverse of a function, a mapping from the function's outputs to its inputs, may be a relation rather than another function. Consider (x). The domain and the range are the nonnegative real numbers, R0+. For instance 4 is mapped to 2. The inverse is the function x2, which maps 2 to 4. Cosine is also a function, since every angle has a specific cosine, but its inverse cos-1(x) is a relation, since a cosine value maps to many (for cosine, infinitely many) angles. A function which takes no arguments is a constant function, or simply, a constant. Since a function must return the same value for each input and the input cannot change (since it has no arguments), it must always return the same value. For instance, if the function one() always returns 1, we can use it instead of the constant 1. This is theoretical convenient because we can write everything as functions, rather than functions and constants. (2) A subroutine which does not return a value is called a "procedure" in some programming languages.
Author: PEB
Go to the
Algorithms, Data Structures, and Problems
home page.
If you have suggestions, corrections, or comments, please get in touch
with
Paul E. Black
(paul.black@nist.gov).
Entry modified Wed Aug 4 10:57:18 1999.
HTML page formatted Wed Dec 22 09:35:25 1999.
This page's URL is
http://hissa.nist.gov/dads/HTML/function.html