I would like to evaluate the following (simplified) expression with Mathematica :

$\frac{\delta}{\delta J} \exp[(J(x)+K(x)) \Delta (J(x)+K(x))]$ where $\Delta$ is a differential operator independent of $J$, depending on $x$.

The thing is, I don't want to write an explicit expression for $\Delta$ since it is not necessary. Is there a way to do that ? I apologise if the question is very basic, but I'm quite new to Mathematica and I have a hard time understanding how it works. Thanks in advance.

Edit : here are a few additional details.

The operator $\Delta$ is a differential operator of the form $\Box - mˆ{2}$, typical KG but not in a flat metric (if that is helpful for the question).

I need to actually compute :

$$\exp \left(- \frac{i}{4} J_4 \left(i \frac{\delta}{\delta J} \right)ˆ4 \right) \exp[(J(x)+K(x)) \Delta (J(x)+K(x))] $$

so I thought about expanding the exponential in a sum and apply the sum on the exponential on the right to see if a pattern could be found, in order to get an analytical expression for that. Doing the differentiation by hand is quite long and tedious, so I wanted to see whether Mathematica could help me or not.

  • $\begingroup$ Looks very similar to Feynman diagram expansions. It's not solving your question directly but could be a useful way , rather than explicit differentiation. $\endgroup$ Aug 17, 2014 at 12:31
  • 1
    $\begingroup$ Please desrcibe in some more detail what you mean. Do I understand correctly that for instance δ/δU { U(x) (Δ.U(x)) } would be the Operator P = (Δ.U(x)) + (U(x) Δ) where in the last term the differential Operator Δ acts on something to the right of P? $\endgroup$ Aug 17, 2014 at 15:59
  • $\begingroup$ I took a guess at what you want, and answered based on that. Instead, you may also find my answer here useful (but I didn't manage to get general symbolic results easily with that). $\endgroup$
    – Jens
    Aug 17, 2014 at 18:52
  • $\begingroup$ @Dr.WolfgangHintze : The operator is really Δ, being applied on (J+K). $\endgroup$
    – AnSy
    Aug 20, 2014 at 12:49

1 Answer 1


One could go very low-level and try to define an operator just in terms of basic properties such as linearity, but I chose to go for a middle ground and assume that we're dealing with a linear differential operator. The coefficients in the operator are called a[i] where i is a symbolic summation index corresponding to the order of the derivative in each term (see below). Also, I introduce a test function g[x] with which the expression in the question is to be integrated. This formulation allows me to directly use the VariationalMethods package:

operator = Function[f, Sum[a[i] D[f, {x, i}], i]];    
VariationalD[Exp[(j[x] + k[x]) operator[j[x] + k[x]]] g[x], j[x], x]

$$(-1)^i \frac{\partial ^i}{\partial x^i}\left(g(x) \sum _i a(i) (j(x)+k(x)) \exp \left((j(x)+k(x)) \sum _i a(i) \left(j^{(i)}(x)+k^{(i)}(x)\right)\right)\right)\\+g(x ) \sum _i a(i) \left(j^{(i)}(x)+k^{(i)}(x)\right) \exp \left((j(x)+k(x)) \sum _i a(i) \left(j^{(i)}(x)+k^{(i)}(x)\right)\right)$$

This is as far as one can get with my purely symbolic sum for the differential operator. Any more specific information could be inserted in operator, making it possible to get concrete results. In the result, g[x] is then the placeholder for the function on which the whole expression acts in the operator sense.

  • $\begingroup$ I see. You are writing down a generic expression for a linear operator, so in my case since I know its form you would suggest to implement it too even thought it is not strictly necessary. I'll also check the VariationalMethods package, I was unaware of that, thanks. $\endgroup$
    – AnSy
    Aug 20, 2014 at 12:54
  • $\begingroup$ Your edit looks much more complicated since it starts with the fourth functional derivative, and also the component notation seems to indicate that $J$ is a four-vector. I assumed that the main question was how to write a generic differential operator, but I think you're looking for a coordinate-independent way of working with a specific operator in variational calculus. Maybe you'll find what you need in this answer. Regarding my answer, I guess I could have simply set g==1 to make it simpler, but anyway it's not going to help much... $\endgroup$
    – Jens
    Aug 20, 2014 at 16:59

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.