I have a function $q(x,t)=u(x,t)+iv(x,t),$ some functions $p_n$ and I want to find the following functional derivative:

$$\frac{\delta}{\delta\overline{q}}\int p_ndt$$

Because Mathematica's VariationalMethods package uses syntax which makes it ask for something like


I want to know how to get it to evaluate the above variational derivative, where the integral is only over $t,$ but $\overline{q}$ is a function of $x$ and $t.$ I have tried the following:

treq[t_] := u[x, t]
timq[t_] := v[x, t]
F[n_] := VariationalD[p[n, x, t], treq[t] - I*timq[t], t]

but Mathematica simply spits out the trivial result for e.g. $n=3$:

F[3] = VariationalD[p[3], u[x, t] - I v[x, t], t]

However, Mathematica knows exactly what the functions $p_n$ are, and I know how to evaluate the first few $F_n$ by myself, which are not very complicated. Does anyone know what I'm doing wrong, and how to get Mathematica to be able to give me the proper expression for the above functional derivative?


  • $\begingroup$ In such cases one needs to represent the function p as the one depending upon q and q*: p=f(q,q*), the variables q and q* being regarded as independent. If this can be done, the calculation of the variational derivative becomes straightforward. $\endgroup$ – Alexei Boulbitch Aug 16 '17 at 6:52
  • $\begingroup$ So do you mean to say that I should add to this code a section which simplifies $p_n$ explicitly in terms of $q$ and its conjugate? Currently it is defined recursively and Mathematica may possibly not bother to recognise that, say, $p_1=q.$ $\endgroup$ – user41208 Aug 16 '17 at 7:03
  • $\begingroup$ That's how I would start in this situation, if I would want to evaluate the integral written in your question. On the other hand, if I would be interested, say, in extremum of this functional, I would express p as a function of u, v and their derivatives, and make a variation with respect to both of them. $\endgroup$ – Alexei Boulbitch Aug 16 '17 at 13:23
  • $\begingroup$ So, since the $p_n$ are defined by recursion, do you know of a simple way to get Mathematica to write each new $p_n$ in terms of $q$ at each step? For instance if I make the substitution $p_1\to q$ Mathematica will still work in terms of $p_2$ when calculating $p_3,$ and so on. $\endgroup$ – user41208 Aug 22 '17 at 5:16
  • $\begingroup$ You did not post your recursion procedure, and, therefore, I have no idea of how the expression looks like. In this situation, I can only offer some general advice. $\endgroup$ – Alexei Boulbitch Aug 22 '17 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.