# RecurrenceTable does not work for sequence of function

Consider the following code that repeatedly differentiates a function:

test = RecurrenceTable[ {g[n] == D[g[n - 1], x], g == x^10},
g, {n, 0, 5}]


This code repeatedly takes differentiation. However, the output is

RecurrenceTable[{g[n] == 0, g == x^10}, g, {n, 0, 5}]


Why my code does not work? In particular, why my differentiation changed to 0? (For this simplified example, I can use FoldList, etc. However, what I want to do is quite complicated.)

• I do not think R.T. works with derivatives, I think equations has to be algebraic. There was a similar question here recurrence-table-differentiation Jul 4, 2021 at 7:54
• "In particular, why my differentiation changed to 0?" --- Because g[n - 1] does not explicitly contain x. Jul 4, 2021 at 9:23
• Why not just NestList[D[#, x] &, x^10, 5]? Jul 4, 2021 at 9:33
• Since "However, what I want to do is quite complicated.", I strongly suggest not using RecurrenceTable because it has very limited capabilities. Jul 4, 2021 at 11:34

Given the recurrence

$$g_n(t) = g'_{n-1}(t),\ \ \ g_0(t) = t^{10}$$

After applying the Laplace transform we have the transformed sequence

$$G_n(s) = s G_{n-1}(s),\ \ \ G_0(s) = \frac{10!}{s^{11}}$$

so

solG = RSolve[{G[n]== s G[n-1], G == 10!/s^11}, G, n][];
Gs = G[n] /. solG;
gt = InverseLaplaceTransform[Gs, s, t]


Here's a rather general recipe that works for a surprisingly large class of problems.

First, define $$g_n$$ as a recursion (directly, without using RecurrenceTable):

g = x^10;
g[n_] := D[g[n - 1], x]


Compute a few terms:

terms = Table[{n, g[n]}, {n, 0, 10}]
(*    {{0, x^10}, {1, 10 x^9}, {2, 90 x^8}, {3, 720 x^7},
{4, 5040 x^6}, {5, 30240 x^5}, {6, 151200 x^4},
{7, 604800 x^3}, {8, 1814400 x^2}, {9, 3628800 x},
{10, 3628800}}                                        *)


Try to find a general formula for these terms:

F = FindSequenceFunction[terms];
InputForm[F]
(*    DifferenceRoot[Function[{y, n}, {(n-11)*y[n] + x*y[n+1] == 0,
y == x^10}]][#1+1] &         *)


You can use the resulting DifferenceRoot expression in further calculations (in a similar way as we can work with Root objects), including for example the powerful DifferenceRootReduce function that can simplify many expressions.