PDA

Click to See Complete Forum and Search --> : Fibonacci and the golden ratio


paneb
Feb 3rd, 2003, 11:02 AM
i ahve to write a program for uni in which i compute the fib numbers..i have to make a table..
The table of data should stop if two consecutive rows give the same value for the golden ratio, or if the golden ratio becomes a negative value...
i have to use FORTRAN 90 to write this..
now the question is this: i obviously have to use arrays..now how do i know how big i should make the array? i dont know when the end pt will be reached..do i just use a big number? like 500?
thanks in advance..

kedaman
Feb 3rd, 2003, 01:52 PM
well in fact you just need to hold the last two numbers, since fib(x)=fib(x-1)+fib(x-2)

paneb
Feb 3rd, 2003, 02:06 PM
so i would output all the info i have about the 2 current numbers, and then replace them? alright..thats a lot more ingenious than my "keep everything, waster memory" way.. :) thanks kedaman