Recursion


Recursion adjective: recursive occurs when a thing is defined in terms of itself or of its type. Recursion is used in a category of disciplines ranging from linguistics to logic. The nearly common application of recursion is in mathematics in addition to computer science, where a function being defined is applied within its own definition. While this apparently defines an infinite number of instances function values, it is for often done in such(a) a way that no infinite loop or infinite multiple of references "crock recursion" can occur.

Formal definitions


In mathematics together with data processor science, a classes of objects or methods exhibits recursive behavior when it can be defined by two properties:

For example, the coming after or as a statement of. is a recursive definition of a person's ancestor. One's ancestor is either:

The Fibonacci sequence is another classic example of recursion:

Many mathematical axioms are based upon recursive rules. For example, the formal definition of the natural numbers by the Peano axioms can be referenced as: "Zero is a natural number, together with each natural number has a successor, which is also a natural number." By this base issue and recursive rule, one can generate the types of all natural numbers.

Other recursively defined mathematical objects put factorials, functions e.g., recurrence relations, sets e.g., Cantor ternary set, and fractals.

There are various more tongue-in-cheek definitions of recursion; see recursive humor.