|
-
Feb 3rd, 2003, 12:02 PM
#1
Thread Starter
Lively Member
Fibonacci and the golden ratio
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..
-
Feb 3rd, 2003, 02:52 PM
#2
transcendental analytic
well in fact you just need to hold the last two numbers, since fib(x)=fib(x-1)+fib(x-2)
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Feb 3rd, 2003, 03:06 PM
#3
Thread Starter
Lively Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|