Fibonacci
The nth Fibonacci number, with and , extended to negative n by the same recurrence.
Fibonacci sequenceFibonacci numberMathWorldFibonacciNumberWikidataQ47577Britannicatopic/Fibonacci-numberDLMF26.11.p4FungrimFibonacci✓Fungrim entryOEISA000045Wolfram LanguageFibonacci✓Rosetta CodeFibonacci sequenceFibonacci(n)the nth Fibonacci number .Fibonacci(nu)a real (non-integer) index via Binet's formula, .fibonacci(nu)✓SymPyfibonacci(nu)mpmathfib(nu)Oscarfibonacci(nu)JuliaBigInt(fibonacci(ZZ(nu)))Fibonacci(n, x)the Fibonacci polynomial , from , exact for a nonnegative integer n and numeric via the two-variable Binet formula for a real order.fibonacci(n, x)Typed signatures
| Type | Package | Applies |
|---|---|---|
(integer) -> integer | compute-engine | always |
(number, any?) -> any | number-theoryreplaces compute-engine | always |
(value) -> value | adelesreplaces number-theory | on ProfiniteNumber |
Details
- Defined by the recurrence with , .
- Closed form (Binet's formula): , where and .
- Consecutive ratios converge to the golden ratio . See LucasL.
- GCD identity: .
- Extends to negative n via .
- A list of indices is threaded over element-wise; a real (non-integer) index evaluates numerically via Binet's formula, and a symbolic second argument gives the Fibonacci polynomial.
Examples
Scope #
The Fibonacci polynomial at a real order and argument, via the two-variable Binet formula
live ↗A fully symbolic order stays exact -- the two-variable Binet formula, with , and left symbolic rather than rounded to a float (Wolfram's FunctionExpand[Fibonacci[n, x]] gives the same closed form)
live ↗at an exact half-integer order: vanishes exactly, leaving a bare radical -- not a 25-digit decimal approximation of (Wolfram's FunctionExpand[Fibonacci[1/2, x]] agrees)
live ↗Properties #
Neat examples #
About
| Examples | 46 |
|---|---|
| Checked against | Wolfram Language 46 agreeSageMath 28 agree3 errorSymPy 39 agree2 unevaluated2 errormpmath 28 agreemathlib4 11 agree2 errorOscar 11 agree3 errorJulia 27 agree2 error |
| Crosswalk | Wikipedia ×2MathWorldWikidataBritannicaDLMFFungrimFungrim entry ×40OEISWolfram LanguageSageMathSymPy ×2mpmathOscarJuliaRosetta Code |
Implementation
wolframpackages/oracle/src/mappings.tsJulia's bare fibonacci(::Int) overflows past F(92); Nemo's ZZ makes it arbitrary-precision, and the BigInt conversion keeps the result a type Julia's own big() and arithmetic still know (other templates wrap operands in big(...)), unlike the bare ZZRingElem.
sympypackages/oracle/src/mappings.tsJulia's bare fibonacci(::Int) overflows past F(92); Nemo's ZZ makes it arbitrary-precision, and the BigInt conversion keeps the result a type Julia's own big() and arithmetic still know (other templates wrap operands in big(...)), unlike the bare ZZRingElem.
sagepackages/oracle/src/mappings.tsJulia's bare fibonacci(::Int) overflows past F(92); Nemo's ZZ makes it arbitrary-precision, and the BigInt conversion keeps the result a type Julia's own big() and arithmetic still know (other templates wrap operands in big(...)), unlike the bare ZZRingElem.
oscarpackages/oracle/src/mappings.tsJulia's bare fibonacci(::Int) overflows past F(92); Nemo's ZZ makes it arbitrary-precision, and the BigInt conversion keeps the result a type Julia's own big() and arithmetic still know (other templates wrap operands in big(...)), unlike the bare ZZRingElem.
juliapackages/oracle/src/mappings.tsJulia's bare fibonacci(::Int) overflows past F(92); Nemo's ZZ makes it arbitrary-precision, and the BigInt conversion keeps the result a type Julia's own big() and arithmetic still know (other templates wrap operands in big(...)), unlike the bare ZZRingElem.
mathlib4packages/oracle/src/mappings.tsJulia's bare fibonacci(::Int) overflows past F(92); Nemo's ZZ makes it arbitrary-precision, and the BigInt conversion keeps the result a type Julia's own big() and arithmetic still know (other templates wrap operands in big(...)), unlike the bare ZZRingElem.
sympypackages/oracle/src/mappings.tsmpmathpackages/oracle/src/mappings.ts See also: LucasL