Results 1 to 6 of 6

Thread: [RESOLVED] Fibonacci

  1. #1

    Thread Starter
    Fanatic Member Loraine's Avatar
    Join Date
    Aug 2006
    Location
    8ft. underground
    Posts
    581

    Resolved [RESOLVED] Fibonacci

    excuse m how to make a fibonacci equation ? dont know how its process nor what its doing ?

  2. #2
    Frenzied Member
    Join Date
    Mar 2006
    Location
    Pennsylvania
    Posts
    1,069

  3. #3

    Thread Starter
    Fanatic Member Loraine's Avatar
    Join Date
    Aug 2006
    Location
    8ft. underground
    Posts
    581

    Re: Fibonacci

    Refused
    Attached Images Attached Images  

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    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.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Fanatic Member Loraine's Avatar
    Join Date
    Aug 2006
    Location
    8ft. underground
    Posts
    581

    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.

  6. #6
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [RESOLVED] Fibonacci

    10 lines of code for the entire function declaration, and that includes a Select Case block.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width