Talk:Combinatorics
|
With sites like this who needs classrooms? This site does a better job explaining things than most teachers do.
- The maths articles are generally very good (I can say this because I've not contributed to them). Just wait til the whole 'pedia is like this! Pcb21 10:15 1 Jun 2003 (UTC)
Closed formula for Fibonacci number
should be:
f(n) = (phi)^(n+2)/sqrt(5) - (phi - 1)^(n+2)/sqrt(5)
{ this short program try to verify closed formula for } { Fibonacci number and his recurrence expression }
uses crt;
var
fib, a, b, n : longint; x, fi : real;
begin
clrscr;
{ axioms for given Fibonacci numbers : } a := 1; { fib(0) = 1 } b := 2; { fib(1) = 2 }
{ the Golden mean : } fi := (1 + sqrt(5)) /2;
{ checking of recurrence expression and expresion in closed form : } for n := 2 to 15 do begin fib := a + b; { fib( n ) = fib( n - 1) + fib( n - 2 ) } x := ( exp( (n+2) * ln( fi)) - exp( (n+2) * ln( fi - 1)) )/ sqrt(5); { closed formula }
writeln( 'fib( ',n : 5, ' ) = ', fib : 7, ' .... ',x:8:1);
{ shift for next number : } a := b; b := fib; end;
end.
- I haven't run the program, but I have verified with pencil and paper that the formula in the article is right and this one is wrong. - Jwwalker