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,{n}]

gives the n^(th) term.

LinearRecurrence[ker,init,{nmin,nmax}]

yields terms nmin through nmax.

Details

  • 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 with initial conditions , , .
  • When coefficients ai and initial values yj are arrays, then the iterated recurrence is interpreted as 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}.

Examples

open allclose all

Basic Examples  (3)

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]=

Scope  (2)

Generalizations & Extensions  (2)

Applications  (2)

Properties & Relations  (1)

Possible Issues  (1)

Neat Examples  (1)

See Also

FindLinearRecurrence  RecurrenceTable  DifferenceRoot  Accumulate  ListConvolve  CellularAutomaton  ExponentialMovingAverage  NestList  Fibonacci  ShiftRegisterSequence

Introduced in 2008
(7.0)
| Updated in 2017
(11.2)