Skip to content

DifferenceRoot ​

A holonomic (P-recursive) sequence object — a linear recurrence with polynomial(n) coefficients plus enough initial values, exactly as DifferenceRootReduce emits it. Applied to a concrete non-negative integer n0n_0, it runs the recurrence forward in exact rational arithmetic; applied to a symbolic nn (or anything else it can't run), it stays inert. Provided by @enumeratio/analytic.

Wolfram LanguageDifferenceRoot
DifferenceRoot(fn)(n0)the sequence's value at n0n_0, running the recurrence stored in fn forward from whichever initial condition is closest below n0n_0.
Typed signatures
TypePackageApplies
(any) -> anyanalyticalways

Domain: Special functions

Details
  • Ordinarily built by DifferenceRootReduce rather than by hand — the examples below construct one directly to show the evaluation contract on its own.
  • Evaluation is attached to the native Apply operator (never redeclares it — see derivatives.ts's own Derivative/D hook for the same pattern), so it only intercepts a call whose head is DifferenceRoot(...); every other Apply call is untouched.
  • Declines (stays symbolic) at a step whose leading coefficient evaluates to exactly 0 with no initial condition to jump to instead, and at a negative or non-integer target.

Examples

1 more kept as data, checked against the oracles
Basic #

y(n+1)=y(n)+1y(n{+}1) = y(n) + 1, y(0)=0y(0){=}0: y(5)=5y(5) = 5

live ↗
InDifferenceRoot((y,n)↦{−y(n)+y(n+1)−1=0y(0)=0)⊲5\mathrm{DifferenceRoot}((y, n)↦\begin{cases}-y(n)+y(n+1)-1=0\\y(0)=0\end{cases})\lhd5Out55
Scope #

Runs the recurrence forward from its anchors: F30F_{30} in exact arithmetic

live ↗
InDifferenceRoot((y,n)↦{−y(n)−y(n+1)+y(n+2)=0y(0)=0y(1)=1)⊲30\mathrm{DifferenceRoot}((y, n)↦\begin{cases}-y(n)-y(n+1)+y(n+2)=0\\y(0)=0\\y(1)=1\end{cases})\lhd30Out832 040832\,040
Properties #

A symbolic index leaves the call unevaluated rather than dropping the argument

live ↗
InDifferenceRoot((y,n)↦{−y(n)+y(n+1)−1=0y(0)=0)⊲n\mathrm{DifferenceRoot}((y, n)↦\begin{cases}-y(n)+y(n+1)-1=0\\y(0)=0\end{cases})\lhd nOutDifferenceRoot((y,n)↦{−y(n)+y(n+1)−1=0y(0)=0)⊲n\mathrm{DifferenceRoot}((y, n)↦\begin{cases}-y(n)+y(n+1)-1=0\\y(0)=0\end{cases})\lhd n
About
Examples4
CrosswalkWolfram Language

See also: DifferenceRootReduce, DifferentialRoot