Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Recursion
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Formal definitions== [[File:Serpiente alquimica.jpg|thumb|[[Ouroboros]], an ancient symbol depicting a serpent or dragon eating its own tail]] In mathematics and computer science, a class of objects or methods exhibits recursive behavior when it can be defined by two properties: * {{anchor|base case}}A simple ''base case'' (or cases) β a terminating scenario that does not use recursion to produce an answer * {{anchor|recursive step}}A ''recursive step'' β a set of rules that reduces all successive cases toward the base case. For example, the following is a recursive definition of a person's ''ancestor''. One's ancestor is either: *One's parent (''base case''), ''or'' *One's parent's ancestor (''recursive step''). The [[Fibonacci sequence]] is another classic example of recursion: :{{math|1=Fib(0) = 0}} as base case 1, :{{math|1=Fib(1) = 1}} as base case 2, :For all [[integer]]s {{math|''n'' > 1}}, {{math|1=Fib(''n'') = Fib(''n'' β 1) + Fib(''n'' β 2)}}. Many mathematical axioms are based upon recursive rules. For example, the formal definition of the [[natural number]]s by the [[Peano axioms]] can be described as: "Zero is a natural number, and each natural number has a successor, which is also a natural number."<ref>{{Cite web|url=https://www.britannica.com/science/Peano-axioms|title=Peano axioms {{!}} mathematics|website=Encyclopedia Britannica|language=en|access-date=2019-10-24}}</ref> By this base case and recursive rule, one can generate the set of all natural numbers. Other recursively defined mathematical objects include [[factorial]]s, [[function (mathematics)|function]]s (e.g., [[recurrence relation]]s), [[set (mathematics)|sets]] (e.g., [[Cantor ternary set]]), and [[fractal]]s. There are various more tongue-in-cheek definitions of recursion; see [[#Recursive humor|recursive humor]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)