This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

RecurrenceTable

RecurrenceTable
generates a list of values of expr for successive n based on solving the recurrence equations eqns.
RecurrenceTable
generates a list of values of expr over the range of n values specified by nspec.
RecurrenceTable
generates an array of values of expr for successive , , ....
  • The eqns must be recurrence equations whose solutions over the range specified can be determined completely from the initial or boundary values given.
  • The eqns can involve objects of the form where i is any fixed integer.
  • The range specification nspec can have any of the forms used in Table.
  • The following options can be given:
DependentVariablesAutomaticthe list of all dependent variables
MethodAutomaticmethod to use
WorkingPrecisionAutomaticprecision used in internal computations
  • With WorkingPrecision->Automatic, results for exact inputs are computed exactly, and for inexact inputs, the precision to use is determined adaptively at each iteration.
Solve an initial-value problem for a first-order difference equation:
Find the first few Fibonacci numbers:
Study the evolution for a nonlinear map of the plane:
Compute a table of Stirling numbers of the first kind:
Solve an initial-value problem for a first-order difference equation:
In[1]:=
Click for copyable input
Out[1]=
 
Find the first few Fibonacci numbers:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Study the evolution for a nonlinear map of the plane:
In[1]:=
Click for copyable input
Out[1]//Short=
In[2]:=
Click for copyable input
Out[2]=
 
Compute a table of Stirling numbers of the first kind:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
Linear ordinary difference equation with exact coefficients:
Nonlinear ordinary difference equation with inexact coefficients:
System of ordinary difference equation with symbolic initial conditions:
Return only the values of :
Iterate using exact arithmetic:
Iterate using adaptive arithmetic starting with precision 20:
The precision decreases with each iteration:
Iterate using fixed 20-digit-precision arithmetic:
Iterate using machine arithmetic:
Iterate several values at once by giving a vector initial condition:
Iterate a matrix recurrence:
Use the partial recurrence equations for binomial coefficients:
Procedural solution for a nonlinear partial difference equation:
Solve a linear difference-algebraic equation with constant coefficients:
Compare with the symbolic solution given by RSolve:
Generate a subset of values from a given range:
Get only the last value from an iteration:
This is faster than when all the values are saved:
Use a vector initial condition:
Use DependentVariables to specify the variables when you only want to save some of them:
Save only :
Save both in order :
Use Method->{Compiled->False} to prevent the Mathematica compiler from being used:
Results differ due to arithmetic change from optimization:
Use WorkingPrecision->MachinePrecision for the fastest iterations:
Use WorkingPrecision->p for slower, but higher-precision iterations:
Exact computations have no error, but may be very slow indeed:
Study the behavior of the logistic equation for different values of the parameter :
Implement the Cliff random number generator:
The random numbers appear to be uniformly distributed:
Compare with the parameters for the uniform distribution:
Plot the Douady rabbit fractal:
Initial condition with 250 points in each direction on the rectangle with corners -1.3-1.3 ⅈ and 1.3+1.3 ⅈ:
Iterate starting from these initial conditions:
Use ArrayPlot to show the fractal:
Find iterates from and of the map for 1000 values of :
Scale the iterates to be integers between 1 and and transpose so the rows correspond to :
Define a function that gives a rule based on the logarithm of counts of each value:
Make a sparse matrix based on applying Count to the iterates for each :
Use ArrayPlot to make the bifurcation diagram:
For , Euler's method is unconditionally unstable:
The symplectic Euler method is stable, but is very sensitive to initial conditions for large :
Compare the methods for different vector fields with Manipulate:
RSolve finds a symbolic solution for this difference equation:
RecurrenceTable generates a procedural solution for the same problem:
Visualize the smoothing of the initial data for the heat equation using the discretized version:
New in 7