2
$\begingroup$

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.)

$\endgroup$
4
  • 1
    $\begingroup$ 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 $\endgroup$
    – Nasser
    Commented Jul 4, 2021 at 7:54
  • $\begingroup$ "In particular, why my differentiation changed to 0?" --- Because g[n - 1] does not explicitly contain x. $\endgroup$ Commented Jul 4, 2021 at 9:23
  • $\begingroup$ Why not just NestList[D[#, x] &, x^10, 5]? $\endgroup$ Commented Jul 4, 2021 at 9:33
  • $\begingroup$ Since "However, what I want to do is quite complicated.", I strongly suggest not using RecurrenceTable because it has very limited capabilities. $\endgroup$
    – Somos
    Commented Jul 4, 2021 at 11:34

2 Answers 2

6
$\begingroup$

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]
$\endgroup$
0
2
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.