1. mrrclb48z

    No comment

    mrrclb48z
Changes in body
Source | HTML | Preview

(参考)Python3モジュールブック>階差方程式の求解
http://www.k-techlabo.org/www_python/python_modules.pdf#page=72
(参考)sympy>class sympy.functions.combinatorial.numbers.fibonacci
http://docs.sympy.org/latest/_modules/sympy/functions/combinatorial/numbers.html#fibonacci
(参考)wikipedia>Fibonacci number
https://en.wikipedia.org/wiki/Fibonacci_number
(参考)Pythonからはじめる数学入門>fibonacci_goldenration.py(参考)Pythonからはじめる数学入門>フィボナッチ数列と黄金比の関係>fibonacci_goldenration.py
https://github.com/doingmathwithpython/code/blob/master/chapter2/solutions/fibonacci_goldenratio.py

from sympy import *
f = simplify('f(n)')
s = simplify('f(n+2)-f(n+1)-f(n)')
ini = simplify('{f(0):0,f(1):1}')
print(rsolve(s,f,ini))
#sqrt(5)*(1/2 + sqrt(5)/2)**n/5 - sqrt(5)*(-sqrt(5)/2 + 1/2)**n/5

wolframalpha

(参考)Fibonacci?Wolfram Language Documentation
http://reference.wolfram.com/language/ref/Fibonacci.html
(参考)オンライン mathematica
http://www.wolframalpha.com/input/?i=RSolve%5B%7Ba%5Bn%2B2%5D+%3D%3D+a%5Bn%5D%2Ba%5Bn%2B1%5D,+a%5B0%5D+%3D%3D+0,a%5B1%5D+%3D%3D+1%7D,+a%5Bn%5D,+n%5D

Input interpretation:
solve a(n + 2) = a(n) + a(n + 1)
a(0) = 0
a(1) = 1 for a(n)
Result:
a(n) = F_n
何か違います。