2

Consider the following code that repeatedly differentiates a function:

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

This code repeatedly takes differentiation. However, the output is

RecurrenceTable[{g[n] == 0, g[0] == 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.)

Laplacian
  • 1,053
  • 3
  • 8

2 Answers2

6

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[0] == 10!/s^11}, G, n][[1]];
Gs = G[n] /. solG;
gt = InverseLaplaceTransform[Gs, s, t]
Cesareo
  • 3,963
  • 7
  • 11
2

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[0] = 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[1] == 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.

Roman
  • 47,322
  • 2
  • 55
  • 121