({{, (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot])[lde][k] 
gives the holonomic sequence h(k), specified by the linear difference equation lde[h,k].}, {, (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot])[lde]
represents a pure holonomic sequence h.}})

OpenersNotesSection(Spacer1)Details

Mathematical sequence, suitable for both symbolic and numerical manipulation; also known as holonomic sequence and P-recursive sequence.

The holonomic sequence h(k) defined by a (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) function satisfies a holonomic difference equation (Subscript[p, n])(k)h(k+n)+(Subscript[p, n-1])(k)h(k+n-1) +⋯+(Subscript[p, 0])(k)h(k) ==0 with polynomial coefficients (Subscript[p, i])(k) and initial values h(n-1)==(Subscript[h, n-1]),⋯,h'(1)==(Subscript[h, 1]),h(0)==(Subscript[h, 0]).

(RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) can be used like any other mathematical function.

(RefLink[FunctionExpand, paclet:ref/FunctionExpand]) will attempt to convert (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) functions in terms of special functions.

The sequences representable by (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) include a large number of special sequences.

(RefLink[DifferenceRootReduce, paclet:ref/DifferenceRootReduce]) can convert many special sequences to (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) sequences.

Holonomic sequences are closed under many operations, including:

(RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) is automatically generated by functions such as (RefLink[Sum, paclet:ref/Sum]), (RefLink[RSolve, paclet:ref/RSolve]), and (RefLink[SeriesCoefficient, paclet:ref/SeriesCoefficient]).

Functions such as (RefLink[Sum, paclet:ref/Sum]), (RefLink[DifferenceDelta, paclet:ref/DifferenceDelta]), and (RefLink[GeneratingFunction, paclet:ref/GeneratingFunction]) work with (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) inputs.

(RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) automatically threads over lists.

OpenersPrimaryExamplesSection(Spacer1)Examples  (20)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Reduce combinations of special sequences to their (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) form:

f=DifferenceRootReduce[Fibonacci[n]+2LucasL[n]+n^2,n]

Use f like any sequence:

Table[f,{n,0,5}]

Table[Fibonacci[n]+2LucasL[n]+n^2,{n,0,5}]

Define a new sequence using (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) directly:

PellNumber=DifferenceRoot[Function[{y,n},{-y[n]-2y[1+n]+y[2+n]==0,y[0]==0,y[1]==1}]];

Use it like any sequence:

Table[PellNumber[n],{n,0,5}]

Prove properties:

FullSimplify[PellNumber[n+1]PellNumber[n-1]-PellNumber[n]^2== (-1)^n]

Several functions can produce closed-form answers by using (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) functions:

Sum[(n+4)!2^n,n]

RSolve[y[n+3]+n y[n+2]+y[n]==n!&&y[0]==y[1]==y[2]==1,y[n],n]

SeriesCoefficient[Exp[(1/((x^2)+1))],{x,0,n}]

OpenersExampleSection1(Spacer1)Scope  (10)

Evaluate at an arbitrary point:

DifferenceRoot[Function[{y,n},{y[n+1]/(n+1)-y[n]==0,y[0]==0,y[1]==1}]][20]

(RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) threads element-wise over lists:

DifferenceRoot[Function[{y,n},{y[n+1]/(n+1)-y[n]==0,y[0]==0,y[1]==1}]][{1,2,3,4,5}]

(RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) works on rational coefficients:

DifferenceRoot[Function[{y,n},{y[n+1]/(n+1)-y[n]==0,y[0]==0,y[1]==1}]]

Homogeneous linear recurrences:

DifferenceRoot[Function[{y,n},{y[n+1]-n y[n]==0,y[0]==0,y[1]==1}]]

Inhomogeneous linear recurrences:

DifferenceRoot[Function[{y,n},{y[n+1]/(n+1)-y[n]==n^2,y[0]==0,y[1]==1}]]

Multiple initial values:

DifferenceRoot[Function[{y,n},{-n y[n]+(1+n)y[1+n]==0,y[-1]==0,y[1]==1}]]

Solutions of a difference equation:

RSolve[a[1+n]==a[n]+n a[n - 1]+n!&&a[0]==1&&a[1]==2,a,n]

A result from (RefLink[Sum, paclet:ref/Sum]):

Sum[(n+4)! (2^n),n]

Coefficients in the expansion of a function:

SeriesCoefficient[Exp[Sqrt[x+1]],{x,0,n}]

Formula of a sequence:

FindSequenceFunction[{2,3/2,7/3,13/4,26/5,49/6,92/7,169/8,307/9,551/10,980/11,1729/12,3030/13,5279/14,9151/15,15793/16,27150/17,46513/18,79440/19,135301/20},n]

OpenersExampleSection2(Spacer1)Generalizations & Extensions  (2)

Equations with holonomic constant terms are automatically lifted to polynomial coefficients:

DifferenceRoot[Function[{y,n},{y[n+1]-y[n]==n!,y[0]==1}]]

The following function is not defined for n>0:

f=DifferenceRoot[Function[{y,n},{n y[1+n]+(-1+n) y[n] ==0,y[-1]==-1}]];

Table[f[n],{n,-2,2}]

Add the initial value y[1]=2 so that it is defined for all n:

g=DifferenceRoot[Function[{y,n},{n y[1+n]+(-1+n) y[n] ==0,y[1]==2,y[-1]==-1}]];

Table[g[n],{n,-2,2}]

OpenersExampleSection4(Spacer1)Applications  (1)

Define Pell numbers:

PellNumber=DifferenceRoot[Function[{y,n},{-y[n]-2y[1+n]+y[2+n]==0,y[0]==0,y[1]==1}]];

Table[PellNumber[n],{n,0,10}]

Closed form formula:

DifferenceRootReduce[PellNumber[n]== (-(1-Sqrt[2])^n+(1+Sqrt[2])^n)/(2Sqrt[2]),n]

Identity analogous to Cassini's identity:

DifferenceRootReduce[PellNumber[n+1]PellNumber[n-1]-PellNumber[n]^2== (-1)^n,n]

A summation identity:

DifferenceRootReduce[Sum[PellNumber[i],{i,0,4n+1}]== (PellNumber[2n]+PellNumber[2n+1])^2,n]

OpenersExampleSection5(Spacer1)Properties & Relations  (4)

Use (RefLink[DifferenceRootReduce, paclet:ref/DifferenceRootReduce]) to generate (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) objects:

f=DifferenceRootReduce[Fibonacci[n],n]

Get the corresponding ordinary difference equation:

oΔe=First[Head[f]][y,n]

Use the equation to verify solutions:

oΔe/.y->Fibonacci//FullSimplify

Sum of a (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) object:

Sum[DifferenceRoot[Function[{y,n},{-y[n]-y[n+1]+y[n+2]==0,y[0]==0,y[1]==1}]][n],n]

Table[%,{n,1,10}]

Accumulate[Table[Fibonacci[n],{n,0,9}]]

Find the generating function of a (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) object:

GeneratingFunction[DifferenceRoot[Function[{y,n},{-y[n]-y[n+1]+y[n+2]==0,y[0]==0,y[1]==1}]][n],n,z]

Find the exponential generating function of a (RefLink[DifferenceRoot, paclet:ref/DifferenceRoot]) object:

ExponentialGeneratingFunction[DifferenceRoot[Function[{y,n},{-y[n]-y[n+1]+y[n+2]==0,y[0]==0,y[1]==1}]][n],n,z]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[DifferenceRootReduce, paclet:ref/DifferenceRootReduce])  ▪  (RefLink[DifferentialRoot, paclet:ref/DifferentialRoot])  ▪  (RefLink[RSolve, paclet:ref/RSolve])  ▪  (RefLink[RecurrenceTable, paclet:ref/RecurrenceTable])  ▪  (RefLink[LinearRecurrence, paclet:ref/LinearRecurrence])  ▪  (RefLink[FunctionExpand, paclet:ref/FunctionExpand])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Formal Symbols, paclet:tutorial/LettersAndLetterLikeForms#173509264])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Inverse Functions, paclet:guide/InverseFunctions])}, {▪(RefLinkPlain[Recurrence and Sum Functions, paclet:guide/RecurrenceAndSumFunctions])}, {▪(RefLinkPlain[Discrete Calculus, paclet:guide/DiscreteCalculus])}, {▪(RefLinkPlain[Integer Sequences, paclet:guide/IntegerSequences])}})}})