F(n) = F(n-1) + F(n-2):
Can someone explain to me how to use this formula, and maybe show an example. I'm uncertain of what I'm supposed to be plugging in for 'n'.
Pick a first number - say, 3 - and call it F(1), meaning the first number in the sequence. Then pick a second number - perhaps 5 - and assign this to F(2). To find the third number F(3) you use F(3)= F(2) + F(1) = 5 + 3 = 8. Then to find the 4th you use F(4) = F(3) + F(2) = 8 + 5 = 13. In general, to find the nth number in the sequence you add F(n-1) and F(n-2) together. Typically people start the Fibonacci series off with F(1) =1 and F(2)=1, but you don't have to. This leads to:
F(1) = 1
F(2) = 1
F(3) = 2
F(4) = 3
F(5) = 5
F(6) = 8
F(7) = 13
F(8) = 21
etc.
Hope this helps!
Well, it was part of a problem I had to do for school. When I was given a number I was supposed to correspond with a Fibonacci number. I guess like:
1. 1
2. 2
3. 3
4. 5
5. 8
6.13
So, if I wanted to find the Fibonacci number for 2 (which is two), I thought I'd let n be 2 and plug it in...
F(2)=F(2-1)+F(2-2)
F(2)=F(1)+F(0)
but F(1)+F(0)=F(1)?
but the fibonacci number for 2 isn't 1 is it?
I'm a little confused here
A more suggestive and general approach is to consider the Fibonacci sequence as solution of the difference equation...
$\displaystyle x_{n+2} - x_{n-1} - x_{n}=0$ (1)
... with 'initial consitions' $\displaystyle x_{0}=0$ and $\displaystyle x_{1}=1$. If u and v are solution of the second order equation...
$\displaystyle z^{2} - z -1 =0$ (2)
... then the solution of (1) is of the form...
$\displaystyle x_{n}= c_{1} u^{n} + c_{2} v^{n}$ (3)
In this case is...
$\displaystyle u= \frac{1 - \sqrt{5}}{2}$
$\displaystyle v= \frac{1 + \sqrt{5}}{2}$ (4)
... and the constants $\displaystyle c_{1}$ and $\displaystyle c_{2}$ are found imposing the initial conditions and solving the system...
$\displaystyle c_{1} + c_{2} =0$
$\displaystyle c_{1} \frac{1 - \sqrt{5}}{2} + c_{2} \frac{1 + \sqrt{5}}{2}= 1$ (5)
Kind regards
$\displaystyle \chi$ $\displaystyle \sigma$