Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Calculus > Discrete Calculus >
Mathematica > Mathematics and Algorithms > Discrete Mathematics > Discrete Calculus >

LinearRecurrence

LinearRecurrence[ker, init, n]
gives the sequence of length n obtained by iterating the linear recurrence with kernel ker starting with initial values init.
LinearRecurrence[ker, init, {nmin, nmax}]
yields terms nmin through nmax in the linear recurrence sequence.
  • The ker and init can involve arbitrary symbolic expressions, as well as arrays.
  • The initial list init must be at least as long as the kernel list ker.
  • If init is longer than ker, only the last Length[ker] elements are used.
  • LinearRecurrence[{a1, ..., ad}, {y1, ..., yd}, n] iterates the recurrence equation y(k+d)=a_1 y(k+d-1)+...+a_d y(k) with initial conditions y(1)=y_1, ..., y(d)=y_d.
  • When coefficients ai and initial values yj are arrays then the iterated recurrence is interpreted as y(k+d)=a_1.y(k+d-1)+...+a_d. y(k) with dot products of coefficient and values.
  • If the initial values yj have dimensions {m1, ..., ms} then the coefficients ai must either be scalar or must have dimensions {m1, m1}.
Solve an initial-value problem for a first-order difference equation with kernel {-3, 1}:
Find the first few Fibonacci numbers:
In[1]:=
Click for copyable input
Out[1]=
 
Solve an initial-value problem for a first-order difference equation with kernel {-3, 1}:
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]=
LinearRecurrence works on symbolic kernels and initial values:
LinearRecurrence works on arrays:
Generate a subset of values from a given range:
Get only the last value from an iteration:
Generate recursive sequences including Padovan sequence:
Pell numbers:
Pell-Lucas numbers:
Perrin sequence:
RSolve finds a symbolic solution for difference equations:
LinearRecurrence generates a procedural solution:
Initial values are longer than the kernel:
Only the last terms are used:
New in 7
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team