Mathematica Solve recurrence relations using Mathematica

AI Thread Summary
To solve recurrence relations in Mathematica, the command RSolve can be used effectively. For example, the relation T(n) = T(n-1) + 2T(n-2) can be solved with the command RSolve[T[n] == T[n - 1] + 2 T[n - 2], T[n], n], yielding a general solution. Providing initial conditions allows for the elimination of undetermined constants, resulting in a specific solution. Users encountering errors should ensure they are using the correct syntax and version of Mathematica, as some commands may vary. Seeking tutorials or additional resources can further aid in understanding and applying these techniques.
winterorchids
Messages
1
Reaction score
0
Hello,

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.
 
Physics news on Phys.org
What version of Mathematica are you using? In version 6.0 you can type:
Code:
RSolve[T[n] == T[n - 1] + 2 T[n - 2], T[n], n]

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

Code:
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:
{{T[n] -> 1/3 (-(-1)^n + 2^n)}}
 

Similar threads

Replies
1
Views
2K
Replies
5
Views
2K
Replies
1
Views
2K
Replies
5
Views
3K
Back
Top