Addition of fibonacci function

Like the factorial() function of the math mode module, the addition of the Fibonacci series would be of great use. Hereby, I consider the addition of the fibonacci() function of great use.
Please let me know how’s the idea?

SymPy has a fibonacci function that handles integers as well as general complex numbers:

>>> from sympy import fibonacci
>>> fibonacci(10)
55
>>> fibonacci(10.5)
69.9657059434926
>>> fibonacci(10.5+1j)
62.0353078744441 + 32.413150678686*I

https://docs.sympy.org/latest/modules/functions/combinatorial.html#sympy.functions.combinatorial.numbers.fibonacci

1 Like

Yeah but I meant 0,1,1,2,3,5,8,…

>>> from sympy import fibonacci
>>> print(','.join(str(fibonacci(i)) for i in range(7)) + ",...")
0,1,1,2,3,5,8,...
2 Likes

What is the practical use-case? I’ve only ever used fibonacci-like functions in programming exercises, whereas factorial is useful in statistics.

Though there’s nothing such but still it would be like adding an infinitely small point.

Typically, to add new features you need prove that the feature a) solves a practical problem and b) is not trivial to implement yourself. While I am not a core developer I’m pretty sure this suggested features fail both criteria.

10 Likes

Ok. Thankyou Jacob.

Yes. Also, computing terms of the Fibonacci sequence is one of the most frequently given exercises for programming newbies. It would be sad to give thousands of students an opportunity to cheat :slight_smile:

4 Likes