On Fri, 17 Jan 2003 12:12 pm, John Richard Smith wrote:
> _nasturtium wrote:
<snip>
> >double FibnForm::Calcul(double todo)
> >{
> >    return( (sqrt(5) + 3) / (5 - sqrt(5)) * pow ((2 / (sqrt(5) - 1)), todo
> >)+(3 - sqrt(5)) / (5 + sqrt(5)) * pow ( (2 / (-1 - sqrt(5))) , todo) );
> > }
>
> Leonardo de Pisa (of leaning tower fame) known to his friends as
> "fibonacci",
> worked on sequntial mumbers,
> eg.  1 + 2 = 3
>       2+3  = 5
>       3+4  = 7
>       4+5  = 9
>       5+6  = 11
>       7+8  =  15   etc etc , therefore 3,5,7,9,11,15 is a fibonacci
> sequence of numbers.
Hello,
        I don't quite get why you posted. However, I would like to make it clear that 
my function does return a sequence of fibonacci numbers (hehe I was going to 
say "run the fine program" but that's only for expert lists ;-)). What I 
derived was an "explicit equation" that is equivalent to the recurrence 
relation.
        ² = squared. just in case you have different fonts
        a ^ b = a raised to the power of b 
        sqrt(n) = square root of n

Fibonacci is P(n) = P(n-1) + P(n-2) the nth term is derived by calculating the 
sum of the previous 2 terms. This can be expressed as P(n+2) = P(n+1) + P(n)
        Let there be a function K, such that K^n (K to the power of n) = P(n). So k^2 
(k squared) = k+1. This is a simple quadratic equation, k²-k-1=0. Solve it 
and you get k=( 1 plus or minus sqrt (5)  ) / 2. Of course this would be for 
-n, so the 2 values of k are (2 / (sqrt(5) - 1) and (2 / (-1 - sqrt(5) ).
        The theory for explicit recurrence relations is that there is an equation of 
the form P(n) = A*(k)^n + B*(k)^n. So P(n) = A*(2 / (sqrt(5) - 1)^n + B*(2 / 
(-1 - sqrt(5) )^n. A and B are dictated by the starting conditions, namely 
the fibonacci values used to kick-start the equation.
        Now lets try 1 and 2 as the initial values. So
(A*(2 / (sqrt(5) - 1) + B*(2 / (-1 - sqrt(5) )) = 1 and
(A*(2 / (sqrt(5) - 1)^2 + B*(2 / (-1 - sqrt(5) )^2 )= 2.
        Two simultaneous equations which are easily solved, giving the equation
(sqrt(5) + 3) / (5 - sqrt(5)) * (2 / (sqrt(5) - 1)) ^ value +(3 - sqrt(5)) / 
(5 + sqrt(5)) * (2 / (-1 - sqrt(5))) ^ value which conveniently is the 
equation used in my function. Mathematically proven.

        If you prefer, I'll *try* to scan in my handwritten notes. I write try 
because I haven't actually tried the Artec antique scanner yet. But I'm sure 
you understand the proof above! :-)

Regards,
        _nasturtium



Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to