This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
 DiscreteMath`RSolve` A recurrence or difference equation specifies a relationship between different values of an unknown sequence. For example, the equation a[n]==a[n-1]+a[n-2] specifies that in the unknown sequence a[n], the sum of the two previous terms gives the next term. There may be many sequences that satisfy a given recurrence equation. If you specify the appropriate initial conditions and the equation is sufficiently well behaved, only one solution sequence will exist. Thus, if you specify the initial conditions a[0]==a[1]==1, the equation above has only one solution, namely, the sequence called Fibonacci numbers. Solving recurrence equations. RSolve computes the solution to the given equation using the method of generating functions. The form of the equations given in RSolve is similar to the form used in the built-in DSolve. You can give a single equation, equations with initial conditions or several equations. The solution is returned in the form of a list of replacement rules. When initial conditions are specified, the range of integers n for which the recurrence equations are valid is inferred from the initial conditions. When initial conditions are not specified, the equations are assumed to be valid for n>=0. This loads the package. In[1]:= < {n >= 0}] Out[22]= Options for RSolve. The second group can also be used for SeriesTerm. The option Method for RSolve gives the method to be used in solving the given recurrence equation. The default value of Automatic specifies that the method of ordinary generating functions (MethodGF) should be used first. If this fails, the method of exponential generating functions (MethodEGF) is used. MethodGF succeeds when either the solution grows subexponentially and DSolve can solve the associated differential equation, or the equation is homogeneous first order and its coefficients are rational functions of . When neither of these is true, you can often save time by specifying Method ->MethodEGF. This solution grows faster than exponentially and the equation is inhomogeneous, so MethodGF failed. In[23]:= Timing[ RSolve[{T[0] == 5, 2 T[n]==n T[n-1]+ 3 n!}, T[n], n]] Out[23]= Now RSolve uses MethodEGF only, so the solution is obtained more quickly. In[24]:= Timing[ RSolve[{T[0] == 5,2 T[n] == n T[n-1] + 3 n!}, T[n], n, Method -> MethodEGF]] Out[24]= There are two options that can be used in both RSolve and SeriesTerm. The options IntegerFunctions and SpecialFunctions control the form in which the answer is expressed. Integer functions such as Mod, Even, and Odd are used when IntegerFunctions->True. Special functions such as Legendre polynomials are used when SpecialFunctions->True. Here the Laurent series coefficient is expressed in terms of Even. In[25]:= SeriesTerm[1/(1 - x^4), {x, 0, n}, Assumptions -> {n >= 0}] Out[25]= After specifying IntegerFunctions->False, the result is given in a purely algebraic form. In[26]:= SeriesTerm[1/(1 - x^4), {x, 0, n}, IntegerFunctions -> False, Assumptions -> {n >= 0}] Out[26]= This Laurent series coefficient is expressed using Mod. In[27]:= SeriesTerm[1/(1 + x^4), {x, 0, n}, Assumptions -> {n >= 0}] Out[27]= IntegerFunctions->False causes a purely algebraic expression to be returned. In[28]:= SeriesTerm[1/(1 + x^4), {x, 0, n}, IntegerFunctions -> False, Assumptions -> {n >= 0}] Out[28]= The solution to this equation uses Legendre polynomials. In[29]:= RSolve[{P[0] == 1, P[1] == x, (n+1) P[n+1] - (2 n + 1) x P[n] + n P[n-1] == 0}, P[n], n] Out[29]= Setting SpecialFunctions->False gives a solution in terms of HypergeometricPFQ. In[30]:= RSolve[{P[0] == 1, P[1] == x, (n+1) P[n+1] - (2 n + 1) x P[n] + n P[n-1] == 0}, P[n], n, SpecialFunctions -> False] Out[30]= Options for GeneratingFunction and ExponentialGeneratingFunction.