Solve recurrence relations using Mathematica

Click For Summary
SUMMARY

This discussion focuses on solving recurrence relations using Mathematica version 6.0. The user encountered errors while attempting to utilize the RSolve function, specifically with the DiscreteMath` package. A correct command to solve the recurrence relation T(n) = T(n-1) + 2T(n-2) is provided: RSolve[T[n] == T[n - 1] + 2 T[n - 2], T[n], n], which yields the solution {{T[n] -> (-1)^n C[1] + 2^n C[2]}}. Additionally, the user can specify initial conditions to eliminate undetermined constants.

PREREQUISITES
  • Familiarity with Mathematica 6.0 syntax
  • Understanding of recurrence relations
  • Basic knowledge of initial conditions in mathematical functions
  • Experience with the RSolve function in Mathematica
NEXT STEPS
  • Research the DiscreteMath` package in Mathematica for advanced recurrence relation solving
  • Explore tutorials on using RSolve with initial conditions in Mathematica
  • Learn about the implications of recurrence relations in algorithm analysis
  • Investigate alternative methods for solving recurrence relations outside of Mathematica
USEFUL FOR

Mathematics students, software developers, and researchers who need to solve recurrence relations using Mathematica, particularly those using version 6.0.

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 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 11 ·
Replies
11
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K