Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Solve recurrence relations using Mathematica

  1. Apr 29, 2008 #1

    I was hoping someone could help point me in the right direction. I am trying to figure out how to solve recurrence relations using Mathematica (6). I have tried to search the web for information on how to use the recurrence relation solving package but I must be doing something wrong. I did a Google search for recurrence relations Mathematica and the only thing I found that seemed accessible to me was a link to The Mathematica Book by Wolfram which told me to enter the command below... which gave me an error. It said with some versions you don't need to load it so I tried the equation given and it didn't return a proper result.

    << DiscreteMath' RSolve'

    Get::noopen: Cannot open DiscreteMath. RSolve::argmu: RSolve called with 1 argument; 3 or more arguments are expected.

    An example problem that I would like to be able to solve is:
    T(n) = T(n-1) + 2T(n-2)

    Any links or tutorials would be helpful! Otherwise, if Mathematica isn't the way I should be going about this I am all for other suggestions!

    Thank you for your time and patience!

    *It should be noted that I am fairly bad at Math and unskilled at Mathematica. I am definitely a "newbie" so :) I apologize if the answer is right in front of my face.* I am attempting to ask "intelligent" questions after I've tried for quite a while to figure it out on my own/do my own research.
  2. jcsd
  3. Apr 29, 2008 #2
    What version of Mathematica are you using? In version 6.0 you can type:
    Code (Text):

    RSolve[T[n] == T[n - 1] + 2 T[n - 2], T[n], n]
    and the output is:
    Code (Text):
    {{T[n] -> (-1)^n C[1] + 2^n C[2]}}
    You could eliminate the undetermined constants by giving initial conditions:

    Code (Text):
    RSolve[{T[n] == T[n - 1] + 2 T[n - 2].T[0]==0,T[1]==1}, T[n], n]
    for which the output is:

    Code (Text):
    {{T[n] -> 1/3 (-(-1)^n + 2^n)}}
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?