TransWikia.com

Multiple nested (time ordered) integrals with NIntegrate

Mathematica Asked by Marsupilami on March 9, 2021

I want to construct and calculate multiple (time – ordered) nested integrals of two functions:


the "fo" function is applied to the odd and even "fe" to the even times.
I have many terms and different numbers of integrals.
I followed this answer to construct my integrals:

feven[n_] := Times @@ fe /@ Array[t[2 #] &, {n}]
fodd[n_] := Times @@ fg /@ Array[t[2 # - 1] &, {n}]

fint[n_, y_] := 
 Inactive@Integrate[feven[n] fodd[n], ##] & @@ 
  Prepend[Table[{t[k], 0, t[k - 1]}, {k, 2, 2 n, 1}], {t[1], 
    0,y}]

So for fint[3,t] I indeed get the correct integrals and the correct order (I copied the output as LateX):


The problem is that my fo and fe functions are complicated to be calculated analytically, so I want to use NIntegrate for each step.
So I do the following (using ?NumericQ doesn’t change anything)

fint[n_, y_] := 
 NIntegrate[feveng[n] foddg[n], ##] & @@ 
  Append[Table[{t[k], 0, t[k - 1]}, {k, 2 n, 2, -1}], {t[1], 
    0, y}]

I use a simple function to test it so I set
fe[n_]:=x, fg[n_]:=x and I get

NIntegrate[
 feveng[2] foddg[2], {t[4], 0, t[3]}, {t[3], 0, t[2]}, {t[2], 0, 
  t[1]}, {t[1], 0, 1}]

along with the error

NIntegrate::nlim: t[4] = t[3] is not a valid limit of integration.

I think the problem might be with NIntegrate, that it is not supposed to calculate these kinds of integrals like Integrate does. Because for Integrate I get a correct result for my simple test functions.

Do you have any idea on how I can make this work?

Thank you!

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP