functions
Functions are a fundamental concept in mathematics and computer science. In mathematics, a function f from a set X (the domain) to a set Y (the codomain) assigns to every element x in X exactly one element f(x) in Y. The notation f: X → Y and the value f(x) are standard. The domain specifies where the function is defined; the codomain is the target set. The range, or image, is the set of outputs actually produced, a subset of the codomain. A function is often described as a rule or a correspondence between inputs and outputs.
Key properties include injectivity (one-to-one), where different inputs yield different outputs; surjectivity (onto), where every element
In computer science, a function is a named block of code that accepts inputs and returns a