Physics[Fundiff] - functional differentiation
Calling Sequence
Fundiff(expression, f1, f2, ...)
Parameters
expression
-
any mathematical expression or relation between expressions
f1, f2, ...
functions
Description
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.
Examples
with⁡Physics:
Setup⁡mathematicalnotation=true
mathematicalnotation=true
First, set two systems of Coordinates, X and Y. Each one has four coordinates.
Coordinates⁡X,Y
⁢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
X,Y
nops⁡X
4
X3
x3
Define the symbol A as an object having tensorial properties.
Define⁡A
Defined objects with tensor properties
A,γμ,σμ,∂μ,gμ,ν,εα,β,μ,ν,Xμ,Yμ
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:
Fundiff⁡ee,Aρ,τ⁡Y
δ4⁡x1−y1,x2−y2,x3−y3,x4−y4⁢δμρμρ⁢δντντ
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:
Fundiff⁡ee,Aρ,ν⁡Y
4⁢δ4⁡x1−y1,x2−y2,x3−y3,x4−y4⁢δμρμρ
Fundiff⁡ee,Aμ,ν⁡Y
16⁢δ4⁡x1−y1,x2−y2,x3−y3,x4−y4
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.
f⁡X
Fundiff⁡,f⁡Y
δδ⁢f⁡Y⁡f⁡X
δ4⁡x1−y1,x2−y2,x3−y3,x4−y4
%Fundiff⁡f⁡X,f⁡Y
value⁡
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.
Setup⁡differentiationvariables=X
differentiationvariables=X
dAlembertian⁡Aμ,ν⁡X
□⁡Aμ,ν⁡X
Fundiff⁡,Aρ,σ⁡Y
□⁡δ4⁡x1−y1,x2−y2,x3−y3,x4−y4⁢δμρμρ⁢δνσνσ
d_μ⁡A⁡X
∂μ⁡A⁡X
Fundiff⁡,A⁡Y
∂μ⁡δ4⁡x1−y1,x2−y2,x3−y3,x4−y4
In the following example, the output of Fundiff is expressed as the derivative of a four-dimensional Dirac delta function.
diff⁡Aμ,ν⁡X,x0
∂∂x4Aμ,ν⁡X
Fundiff⁡,Aτ,ρ⁡Y
δ4⁡0,0,0,1,x1−y1,x2−y2,x3−y3,x4−y4⁢δμτμτ⁢δνρνρ
For example, integrate (in four dimensions) the above from -infinity to infinity (see Intc).
Intc⁡P⁡X⁢,X
∫−∞∞∫−∞∞∫−∞∞∫−∞∞P⁡X⁢δ4⁡0,0,0,1,x1−y1,x2−y2,x3−y3,x4−y4⁢δμτμτ⁢δνρνρⅆx1ⅆx2ⅆx3ⅆx4
This integral can be computed by using the value command.
−δμτμτ⁢δνρνρ⁢∂∂y4P⁡Y
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.
Intc⁡12⁢diff⁡q⁡τ,τ2−12⁢k⁢q⁡τ2,τ
∫−∞∞ⅆⅆτq⁡τ22−k⁢q⁡τ22ⅆτ
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.
Fundiff⁡,q⁡t
−k⁢q⁡t−q..⁡t
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.
CompactDisplay⁡Φ⁡X
Φ⁡x1,x2,x3,x4⁢will now be displayed as⁢Φ
L≔12⁢d_μ⁡Φ⁡X⁢d_μ⁡Φ⁡X−m22⁢Φ⁡X2+λ4⁢Φ⁡X4
L≔∂μ⁡Φ⁢∂⁢μ⁢μ⁡Φ2−m2⁢Φ22+λ⁢Φ44
The Action for this model is given by:
S≔Intc⁡L,X
S≔∫−∞∞∫−∞∞∫−∞∞∫−∞∞∂μ⁡Φ⁢∂⁢μ⁢μ⁡Φ2−m2⁢Φ22+λ⁢Φ44ⅆx1ⅆx2ⅆx3ⅆx4
The field equations satisfied by Phi are given by:
Fundiff⁡S,Φ⁡Y
Φ⁡Y3⁢λ−Φ⁡Y⁢m2−□⁡Φ⁡Y,Y
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,
ans≔Φ3⁢λ−Φ⁢m2−□⁡Φ
To express the dAlembertian in diff notation, use convert.
convert⁡ans,diff
Φ3⁢λ−Φ⁢m2+Φx1,x1+Φx2,x2+Φx3,x3−Φx4,x4
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).
lprint⁡ans
Phi(X)^3*lambda-Phi(X)*m^2-Physics:-dAlembertian(Phi(X),[X])
X1
x1
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.
Define⁡A,redo
The functional derivative of Aμ⁡X with respect to Aν⁡Y gives:
%Fundiff⁡Aμ⁡X,Aν⁡Y
δδ⁢Aν⁡Y⁡Aμ⁡X
δ4⁡x1−y1,x2−y2,x3−y3,x4−y4⁢δμνμν
Introduce now the electromagnetic field tensor Fμ,ν.
CompactDisplay⁡Aμ⁡X
A⁡x1,x2,x3,x4⁢will now be displayed as⁢A
Fμ,ν≔d_μ⁡Aν⁡X−d_ν⁡Aμ⁡X
Fμ,ν≔∂μ⁡Aν−∂ν⁡Aμ
So the action in empty space is given by:
S≔Intc⁡Fμ,ν2,X
S≔∫−∞∞∫−∞∞∫−∞∞∫−∞∞∂μ⁡Aν−∂ν⁡Aμ2ⅆx1ⅆx2ⅆx3ⅆx4
The "equations of motion" (Maxwell equations) are output below: use delay evaluation quotes to display the operation before evaluating it.
Fundiff⁡S,Aρ⁡Y
δδ⁢Aρ⁡Y⁡∫−∞∞∫−∞∞∫−∞∞∫−∞∞∂μ⁡Aν−∂ν⁡Aμ2ⅆx1ⅆx2ⅆx3ⅆx4
subs⁡Y=X,
−2⁢−∂μ⁡∂ν⁡A⁢ν⁢ν+□⁡Aμ⁢g⁢μ,ρ⁢μ,ρ+2⁢−□⁡Aν+∂μ⁡∂ν⁡A⁢μ⁢μ⁢g⁢ν,ρ⁢ν,ρ
In order to obtain Maxwell equations, a simplification of the contracted indices is necessary.
Simplify⁡
4⁢∂μ⁡∂⁢ρ⁢ρ⁡A⁢μ⁢μ−4⁢□⁡A⁢ρ⁢ρ
See Also
CompactDisplay, d_, dAlembertian, 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
References
Cheb-Terrab, E.S. "Maple procedures for partial and functional derivatives." Computer Physics Communications, Vol. 79. (1994): 409-424.
Download Help Document