I'm trying to create a Table of functions where each new element is defined recursively via indefinite integration of the previous one. I've tried doing:

RecurrenceTable[{f[n + 1] == Integrate[f[n], x], f[0] == x}, f, {n,10}]

However I get the following output:

{x, x^2, x^3, x^4, x^5, x^6, x^7, x^8, x^9, x^10, x^11}

I've also tried doing several variations of this like:

RecurrenceTable[{f[n + 1, x] == Integrate[f[n, x], x], f[0, x] := x}, f, {n, 10}]

But it throws up an error message. I'm new to Mathematica, so any help would be appreciated.

  • 1
    $\begingroup$ What's wrong with the first output you get? What were you expecting instead? And what would you like to obtain? $\endgroup$
    – MarcoB
    Jun 29, 2022 at 16:00
  • $\begingroup$ @MarcoB I was expecting x, x^2/2, x^3/6, etc. $\endgroup$
    – TC159
    Jun 29, 2022 at 16:06
  • 5
    $\begingroup$ Use NestList instead: NestList[Integrate[#, x] &, x, 10]. $\endgroup$
    – Domen
    Jun 29, 2022 at 16:08
  • $\begingroup$ "each new element is defined recursively via indefinite integration of the previous one" - have you already seen this? $\endgroup$ Jun 29, 2022 at 18:17

3 Answers 3


As suggested by Domen, use NestList

seq = NestList[Integrate[#, x] &, x, 6]

(* {x, x^2/2, x^3/6, x^4/24, x^5/120, x^6/720, x^7/5040} *)

EDIT: Alternatively, using RecurrenceTable, delay the integration

seq = RecurrenceTable[{f[n + 1] == g[f[n], x], f[0] == x}, f, {n, 6}] /. 
  g -> Integrate

(* {x, x^2/2, x^3/6, x^4/24, x^5/120, x^6/720, x^7/5040} *)

Then use FindSequenceFunction to generalize the result

f[n_, x_] = FindSequenceFunction[seq, n] // FunctionExpand

(* x^n/Gamma[1 + n] *)
  • 1
    $\begingroup$ The formula in the MathWorld link I gave above quickly generates the required expression: Assuming[x > 0 && n > 0, Integrate[t (x - t)^(n - 1)/(n - 1)!, {t, 0, x}]]. $\endgroup$ Jun 30, 2022 at 15:00

If you use Trace, you can see what's happening. We evaluate the Integrate before solving the recurrence. So, the recurrence that actually gets used is this:

f[1 + n] == x f[n]

Another way:

f[n_, x_]:= f[n, x]= If[n==0, 1, Integrate[f[n-1, t], {t, 0, x}]];
Table[f[n, x], {n, 10}]

which gives the result:

{x, x^2/2, x^3/6, x^4/24, x^5/120, x^6/720, x^7/5040, x^8/40320, x^9/362880, x^10/3628800}

Your Answer

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

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