|
-
Apr 13th, 2007, 10:08 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Fibonacci
excuse m how to make a fibonacci equation ? dont know how its process nor what its doing ?
-
Apr 13th, 2007, 10:18 PM
#2
Frenzied Member
-
Apr 13th, 2007, 10:36 PM
#3
Thread Starter
Fanatic Member
-
Apr 13th, 2007, 10:49 PM
#4
Re: Fibonacci
The Fibonacci sequence is a recursive sequence of numbers. Just like the factorial value of a number is that number multiplied by the factorial value of the number before it, so the Fibonacci value of a number is the sum of the Fibonacci values of the two numbers before it.
That definition you posted is saying this:
1. The Fibonacci value of zero is defined as zero.
2. The Fibonacci value of 1 is defined as 1.
3. The Fibonacci value of any number n, where n is greater than 1, is n added to the Fibonacci value of (n - 1) added to the Fibonacci value of (n - 2).
Thus the Fibbonacci value of 2 is the sum of the Fibonacci value of 1 plus the Fibonacci value of zero. You know what they are from the definition. The Fibonacci value of 3 is the Fibonacci value of 2 plus the Fibonacci value of 1. Etc.
The only reason that I can think of that you'd be doing this is that you've been set an assignment to teach you how to implement recursion. In that case it is inappropriate for us to provide a code solution.
Do you know what recursion is for a start? It means that you implement a method that calls itself. You need to implement a method that takes a number and returns its Fibonacci value. You know from the above definition that if that number is zero you return zero, and if it's 1 you return 1. If it's any other number greater than 1 you return the sum of the Fibonacci values of the two numbers before it. That means that you'll have to call a method to get the Fibonacci values of those two numbers. You already have a method to do that because you're writing it yourself. That's the recursive part: Your method calls itself.
-
Apr 13th, 2007, 11:38 PM
#5
Thread Starter
Fanatic Member
Re: Fibonacci
(~o~) .... looks hard ... but let me try it T_T .... (and oh this is not an assignment ... just practicing myself )
Last edited by Loraine; Apr 13th, 2007 at 11:41 PM.
-
Apr 14th, 2007, 03:39 AM
#6
Re: [RESOLVED] Fibonacci
10 lines of code for the entire function declaration, and that includes a Select Case block.
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
|