Physics[Fundiff] - functional differentiation
Fundiff(expression, f1, f2, ...)
any mathematical expression or relation between expressions
f1, f2, ...
The Fundiff command computes functional derivatives of algebraic expressions. If the expression being differentiated contains an integral (maybe a multiple or nested one), Fundiff first attempts to functionally differentiate the integrand, then tries to evaluate the resulting integral, now containing the Dirac delta function or its derivatives. This evaluation, in turn, is carried out by using the integration routines for this problem, which return a result only when the integrand is a polynomial of Dirac functions. Otherwise, the integral is returned unevaluated, after replacing all occurrences of int by Int.
The %Fundiff command is the inert form of Fundiff; that is, it represents the same mathematical operation while displaying the operation unevaluated. To evaluate the operation, use the value command.
Since Fundiff is implemented to use Physics/diff, which in turn uses the top level diff command, any special rule for the functional derivative of a user-defined (U.D.) function can be stated by indicating the rule (for the NAME of the U.D. function) to diff in the usual way. In addition, since Physics[diff] recognizes derivatives expressed using the global :-diff or :-Diff syntaxes as mathematically equivalent to those built with the D syntax, the same holds for Fundiff. For the same reason, functional derivatives with respect to indexed fields (functions) where the index represents tensorial properties (spacetime, spinor, or gauge) are computed by Fundiff by using the sum rule for repeated indices, as Physics[diff] does. To define an indexed object as a tensor function, see Define.
When calculating functional derivatives, it sometimes happens that some variables are (constant) Parameters of the theory, and it would be an error to attach functionality to them. To meet this requirement, use the Parameters command of the Physics package, which allows for the declaration of a parameter as a constant parameter in such a way that no functionality can be attached to it.
First, set two systems of Coordinates, X and Y. Each one has four coordinates.
⁢Default differentiation variables for d_, D_ and dAlembertian are:⁢X=x1,x2,x3,x4
⁢Systems of spacetime coordinates are:⁢X=x1,x2,x3,x4,Y=y1,y2,y3,y4
Define the symbol A as an object having tensorial properties.
Defined objects with tensor properties
Consider now the tensor field, here represented by the indexed function of X=X.
ee ≔ Aμ,ν⁡X
The functional derivative of this function with respect to Aρ,τ⁡Y is given by:
The result above is expressed in terms of a four-Dimensional Dirac delta function with the metric g_. If instead of the above you "functionally differentiate" with respect to Aρ,ν⁡Y, the index nu is repeated, and so summed from 1 to the spacetime dimension. By default, and in this help page, the Dimension is [4,−], meaning that you are working in 3 + 1 Minkowski (pseudo-Euclidean) spacetime with signature -,-,-,+ (to change this default, see Setup), so you obtain the following:
It is sometimes convenient to represent the functional derivative instead of actually computing it. For that purpose, you can either use 'delay evaluation quotes,' or use the inert form of Fundiff, %Fundiff. Note that the delay evaluation quotes can be evaluated by simply reexecuting the output, but you must use the value command to evaluate the inert form.
Fundiff knows about the spacetime differentiation operator d_[mu] and the d'Alembertian operation dAlembertian(A[mu,nu](X)). To use either of these differentiation operators, you must either specify the differentiation variables, or set a coordinate system to be the default differentiation variables (this is the usual method when computing with paper and pencil) by using the Setup command.
In the following example, the output of Fundiff is expressed as the derivative of a four-dimensional Dirac delta function.
For example, integrate (in four dimensions) the above from -infinity to infinity (see Intc).
This integral can be computed by using the value command.
The derivand passed to Fundiff can be any algebraic expression, including integrals, specifically functionals. Consider, for example, the Action (functional of the physical system) for a one-dimensional oscillator.
The equations of motion for this problem can be derived from this functional by using a variational principle; that is, obtained by computing the functional derivative of this Action with respect to q⁡u.
As an example of the use of Fundiff in a field model, consider the Lagrangian function for the lambda*Phi^4 model in 3+1 spacetime dimensions. For best readability, use the facility for compact display of the differential equation packages.
Φ⁡x1,x2,x3,x4⁢will now be displayed as⁢Φ
L ≔ 1⁢d_μ⁡Φ⁡X⁢d_μ⁡Φ⁡X2−m2⁢Φ⁡X22+λ⁢Φ⁡X44
The Action for this model is given by:
S ≔ Intc⁡L,X
The field equations satisfied by Phi are given by:
Note that the display above is expressed in terms of Y=y1,y2,y3,y4, which are not the default differentiation variables, and so the symbol Y appears explicitly in the display. If you replace Y by the default differentiation variables (see Setup), then the display is free of redundancies.
ans ≔ subs⁡Y=X,
To express the dAlembertian in diff notation, use convert.
Note also that the actual Maple mathematical expression behind this default compact display is the one expected, depending on X=x1,x2,x3,x4 (see lprint).
Maxwell equations can also be derived from a variational principle, by taking the functional derivative of the corresponding Action. For that purpose, define the Action for the problem in terms of the 4-vector Aμ⁡X. Use the redo option of the Define command to erase and write over the previous definition for A.
The functional derivative of Aμ⁡X with respect to Aν⁡Y gives:
Introduce now the electromagnetic field tensor Fμ,ν.
A⁡x1,x2,x3,x4⁢will now be displayed as⁢A
Fμ,ν ≔ d_μ⁡Aν⁡X−d_ν⁡Aμ⁡X
So the action in empty space is given by:
S ≔ Intc⁡Fμ,ν2,X
The "equations of motion" (Maxwell equations) are output below: use delay evaluation quotes to display the operation before evaluating it.
In order to obtain Maxwell equations, a simplification of the contracted indices is necessary.
d_, dAlembertian, declare, Define, diff, Dirac, Intc, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Physics/diff, Setup, value
Cheb-Terrab, E.S. "Maple procedures for partial and functional derivatives." Computer Physics Communications, Vol. 79. (1994): 409-424.
Download Help Document
What kind of issue would you like to report? (Optional)