I wish to perform the following nested integral:
\begin{align}
I_n=\int_{-\infty}^\infty dx_n~f(x_n,x_{n+1})\int_{-\infty}^\infty dx_{n-1}~f(x_{n-1},x_n)...\int_{-\infty}^\infty dx_1~f(x_1,x_2)\int_{-\infty}^\infty dx_0~f(x_0,x_1)
\end{align}
where $f$ is a known function. While this is easily done using Do loop (or something similar), I wished to make it more elegant using Nest and the function f[x,y]. But after several failed attempts I am beginning to wonder if this can be done at all. Any help in this regard is much appreciated.
Asked
Active
Viewed 197 times
0
J. M.'s missing motivation
- 124,525
- 11
- 401
- 574
Deep
- 479
- 2
- 9
1 Answers
1
You don't really need Nest[] for this. Taking into account Mathematica's convention that the outermost integral corresponds to the first iterator in Integrate[], we have
With[{n = 5},
Integrate[Product[f[Subscript[x, k], Subscript[x, k + 1]], {k, 0, n}],
Sequence @@ Table[{Subscript[x, k], -∞, ∞}, {k, n, 0, -1}]]]
$$\scriptsize {\int _{-\infty }^{\infty }\int _{-\infty }^{\infty }\int _{-\infty }^{\infty }\int _{-\infty }^{\infty }\int _{-\infty }^{\infty }\int _{-\infty }^{\infty }f\left(x_0,x_1\right) f\left(x_1,x_2\right) f\left(x_2,x_3\right) f\left(x_3,x_4\right) f\left(x_4,x_5\right) f\left(x_5,x_6\right)dx_0dx_1dx_2dx_3dx_4dx_5}$$
J. M.'s missing motivation
- 124,525
- 11
- 401
- 574
n) and you'll see that it evaluates exactly as you wanted it. I'll think about your recursive version, tho, but if you're impatient, you might get a few ideas from here. – J. M.'s missing motivation Aug 27 '17 at 11:06