1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Recursie Algorithms. Is my solution ok?

  1. Apr 28, 2004 #1
    Code (Text):

    This is the question I must solve;
    Solve the given recurrence relation for the given inital conditions.
    (This means give a formula in terms of n, not in terms of previous entries)
    a[sub]n[/sub] = 7a[sub]n-1[/sub] - 12a[sub]n-2[/sub]
    a[sub]0[/sub] = 3 a[sub]1[/sub] = 10
    Now I am not sure what that means but I think this will solve the question

    let me know if I am not even close;
    Input = n
    Output = X(n)

    procdure find(n)
     if n = 3 or n = 10 then
      return (n)
     return(find(n-1)+find(n-2))
    end find(n)
     
     
  2. jcsd
  3. Apr 28, 2004 #2

    jamesrc

    User Avatar
    Science Advisor
    Gold Member

    I'm fairly certain that what they are looking for is a single equation for a as a function of n. Simple example:

    Given: an = an-1 + 1
    and a0 = 11

    Then:

    an = 11+n
     
  4. Apr 29, 2004 #3
    Code (Text):

    Solve the given recurrence relation for the given inital conditions.
    (This means give a formula in terms of n, not in terms of previous entries)
    a[sub]n[/sub] = 7a[sub]n-1[/sub] - 12a[sub]n-2[/sub]
    a[sub]0[/sub] = 3 a[sub]1[/sub] = 10

    So;
    a[sub]2[/sub] = 7a[sub]2-1[/sub] - 12a[sub]2-2[/sub]
    a[sub]2[/sub] = 7a[sub]1[/sub] - 12a[sub]0[/sub]
    a[sub]2[/sub] = 7(10) - 12(3)
    a[sub]2[/sub] = 70 - 36
    a[sub]2[/sub] = 34?
     
     
  5. Apr 29, 2004 #4
  6. Apr 29, 2004 #5
    Oh not that again I thought I was done with that. Ok I know what to do thanks again.
     
  7. Apr 29, 2004 #6
    I come up with all mixed fractions when I get a using the same method as I did on that problem? So that does not work.
     
  8. Apr 29, 2004 #7
    It works. You need to work on your algebra.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Recursie Algorithms. Is my solution ok?
Loading...