# VariationalD of Nested Integral

I am trying to calculate the variational derivative with respect to f of the the nested integral below

$$\mathcal{J}\left[f(x) \right] = \int\limits_a^b \text{d} x \,e^{-f(x)} \int\limits_a^x \text{d}y\, e^{f(y)}$$

However, $\text{VariationalD}[\mathcal{J}, f[x], x]]$ does not seem to notice $f(y)$, but - I think - only differentiates $f(x)$. The result it spits out is $$-e^{-f(x)} \int\limits_a^x \text{d} y\, e^{f(y)}$$

How can I tell $\text{VariationalD}$ to differentiate for all f's occurring in the expression? Thanks a lot.

EDIT: The code I used was

VariationalD[Exp[-f[x]]*Integrate[Exp[f[y]], {y, 0, x}], f[x], x]

• Really, we need the code that you used in order to tell what went wrong... Commented Apr 22, 2018 at 14:11

The reply is based on this link and some experience I have from my own projects. Variational Methods

You practically want to perform the third example they give. You have to keep in mind that all functions should be functions of the same coordinates. Let me demonstrate with a correct and a wrong example.

The thing I would do, is to say $f(x)=f(x,y)$ and $f(y)=g(x,y)$ and then you can use this.

Needs["VariationalMethods"];
VariationalD[Exp[f[x, y]] Exp[g[x, y]], {f[x, y], g[x, y]}, {x, y}]


The result is

{e^(f[x, y] + g[x, y]), e^(f[x, y] + g[x, y])}


As you can see, you get a list of variational derivatives.

Of course in the end, you keep in mind that you will eliminate the redundant coordinate.

If you try to perform for instance,

Needs["VariationalMethods"];
VariationalD[Exp[f[x]] Exp[g[y]], {f[x], g[y]}, {x, y}]


Then you will only get an error message.

Hope this helps.

Cheers!!!