diff_anticommutative - Maple Help

Physics[diff] - differentiate with respect to commutative and anticommutative variables

 Calling Sequence diff(expression, x, $\mathrm{\theta }$, ... )

Parameters

 expression - any mathematical expression or relation between expressions x, $\mathrm{\theta }$, ... - the derivation variables, commutative or anticommutative

Description

 • The diff command of the Physics package is a differentiation command that works with commutative (C) and anticommutative (AC) differentiation variables; that is, it takes into account the possible anticommutative character of the differentiation variables $x,\mathrm{\theta },\mathrm{...}$. Differentiation with respect to noncommutative (NC) variables is not implemented. Note that higher order derivatives with respect to AC variables do not commute, so their evaluation by the standard diff command (not the diff that loads when you load Physics) would lead to an incorrect result. For the conventions adopted to represent NC and AC objects, see the Physics package conventions.
 • The %diff command is the inert form of diff; that is, it represents the same mathematical operation while displaying the operation unevaluated. To evaluate the operation, use the value command.
 • All of the differentiating knowledge of the top level diff command is taken into account when evaluating derivatives with diff, and all differentiation rules defined by the user as diff/... routines are also automatically taken into account.
 • The syntax for the input of the Physics diff is equal to that of the standard diff and they both have the same display. Higher order derivatives with respect to commutative and anticommutative variables are displayed in separate groups. For example, after setting $\mathrm{\theta }$ to be the prefix identifying anticommutative variables using Setup(anticommutativeprefix = theta),

$\frac{{\partial }^{4}}{\partial x\partial y\partial {{\mathrm{\theta }}}_{1}\partial {{\mathrm{\theta }}}_{2}}f\left({{\mathrm{\theta }}}_{1},{{\mathrm{\theta }}}_{2},x,y\right)$

 • As with the standard diff command, if the result of a requested derivative cannot be expressed in terms of diff, then the D operator is used to express it. The equivalence between derivatives written in terms of diff and D is as follows:

$\frac{{\partial }^{2}}{\partial {{\mathrm{\theta }}}_{1}\partial {{\mathrm{\theta }}}_{2}}f\left({{\mathrm{\theta }}}_{1},{{\mathrm{\theta }}}_{2}\right)={\mathrm{D}}_{1,2}\left(f\right)\left({{\mathrm{\theta }}}_{1},{{\mathrm{\theta }}}_{2}\right)$

 where the derivative above should be interpreted as: first differentiate with respect to ${\mathrm{\theta }}_{1}$, then with respect to ${\mathrm{\theta }}_{2}$ (or the opposite times $-1$); and the right hand side is not interpreted as a commutative higher order derivative.
 • To convert between formats, use the convert command with diff, Diff, or D as the second argument. Although an equivalence between diff and D always exists, note that there is no equivalence between the Physics and top level versions of diff when there are anticommutative objects in the derivand.

Examples

 > $\mathrm{with}\left(\mathrm{Physics}\right):$
 > $\mathrm{Setup}\left(\mathrm{mathematicalnotation}=\mathrm{true}\right)$
 $\left[{\mathrm{mathematicalnotation}}{=}{\mathrm{true}}\right]$ (1)

First set the symbols $Q$ and $\mathrm{\theta }$ as prefixes identifying anticommutative variables (see Setup for details).

 > $\mathrm{Setup}\left(\mathrm{anticommutativeprefix}=\left\{Q,\mathrm{\theta }\right\}\right)$
 $\left[{\mathrm{anticommutativeprefix}}{=}\left\{{Q}{,}{\mathrm{\theta }}\right\}\right]$ (2)

So the following is an anticommutative function of two anticommutative variables.

 > $\mathrm{AC}≔Q\left[1\right]\left(\mathrm{\theta }\left[1\right],\mathrm{\theta }\left[2\right]\right):$

The second derivative with respect to the same anticommutative variable is equal to zero.

 > $\mathrm{diff}\left(\mathrm{AC},\mathrm{\theta }\left[1\right],\mathrm{\theta }\left[1\right]\right)$
 ${0}$ (3)

All second order mixed derivatives anticommute.

 > $\mathrm{d12}≔\mathrm{diff}\left(\mathrm{AC},\mathrm{\theta }\left[1\right],\mathrm{\theta }\left[2\right]\right)$
 ${\mathrm{d12}}{≔}\frac{{{\partial }}^{{2}}}{{\partial }{{\mathrm{\theta }}}_{{1}}{\partial }{{\mathrm{\theta }}}_{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)$ (4)
 > $\mathrm{d21}≔\mathrm{diff}\left(\mathrm{AC},\mathrm{\theta }\left[2\right],\mathrm{\theta }\left[1\right]\right)$
 ${\mathrm{d21}}{≔}{-}\frac{{{\partial }}^{{2}}}{{\partial }{{\mathrm{\theta }}}_{{1}}{\partial }{{\mathrm{\theta }}}_{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)$ (5)

Convert to the D format.

 > $\mathrm{convert}\left(\mathrm{d12},\mathrm{D}\right)$
 ${{\mathrm{D}}}_{{1}{,}{2}}{}\left({{Q}}_{{1}}\right){}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)$ (6)

Derivatives of composite anticommutative functions with respect to anticommutative variables:

 > $Q\left[2\right]\left(\mathrm{\theta }\left[1\right],\mathrm{\theta }\left[2\right],Q\left[1\right]\left(\mathrm{\theta }\left[1\right],\mathrm{\theta }\left[2\right]\right)\right)$
 ${{Q}}_{{2}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right)$ (7)
 > $\mathrm{diff}\left(,\mathrm{\theta }\left[1\right]\right)$
 ${{\mathrm{D}}}_{{1}}{}\left({{Q}}_{{2}}\right){}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){+}\left(\frac{{\partial }}{{\partial }{{\mathrm{\theta }}}_{{1}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){}{{\mathrm{D}}}_{{3}}{}\left({{Q}}_{{2}}\right){}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right)$ (8)

Derivatives of anticommutative products with respect to an anticommutative variable:

 > $\mathrm{pr}≔Q\left[1\right]\left(\mathrm{\theta }\left[1\right],\mathrm{\theta }\left[2\right]\right)Q\left[2\right]\left(\mathrm{\theta }\left[1\right],\mathrm{\theta }\left[2\right],Q\left[1\right]\left(\mathrm{\theta }\left[1\right],\mathrm{\theta }\left[2\right]\right)\right)$
 ${\mathrm{pr}}{≔}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right){}{{Q}}_{{2}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right)$ (9)
 > $\mathrm{diff}\left(\mathrm{pr},\mathrm{\theta }\left[1\right]\right)$
 $\left(\frac{{\partial }}{{\partial }{{\mathrm{\theta }}}_{{1}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){}{{Q}}_{{2}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){-}\left({{\mathrm{D}}}_{{1}}{}\left({{Q}}_{{2}}\right){}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){+}\left(\frac{{\partial }}{{\partial }{{\mathrm{\theta }}}_{{1}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){}{{\mathrm{D}}}_{{3}}{}\left({{Q}}_{{2}}\right){}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right)\right){}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)$ (10)

The second derivative with respect to the same anticommutative variable is equal to zero.

 > $\mathrm{diff}\left(,\mathrm{\theta }\left[1\right]\right)$
 ${0}$ (11)

The mixed second order derivatives anticommute. These operations sometimes require normalizing and expanding the noncommutative products; for that purpose, use the expand command (if the intention is to expand only noncommutative products, use Physics/Expand).

 > $\mathrm{diff}\left(\mathrm{pr},\mathrm{\theta }\left[1\right],\mathrm{\theta }\left[2\right]\right)+\mathrm{diff}\left(\mathrm{pr},\mathrm{\theta }\left[2\right],\mathrm{\theta }\left[1\right]\right)$
 ${-}\left({{\mathrm{D}}}_{{1}{,}{2}}{}\left({{Q}}_{{2}}\right){}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){+}\left(\frac{{\partial }}{{\partial }{{\mathrm{\theta }}}_{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){}{{\mathrm{D}}}_{{1}{,}{3}}{}\left({{Q}}_{{2}}\right){}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){+}{{\mathrm{D}}}_{{3}}{}\left({{Q}}_{{2}}\right){}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){}\left(\frac{{{\partial }}^{{2}}}{{\partial }{{\mathrm{\theta }}}_{{1}}{\partial }{{\mathrm{\theta }}}_{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){-}\left(\frac{{\partial }}{{\partial }{{\mathrm{\theta }}}_{{1}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){}{{\mathrm{D}}}_{{2}{,}{3}}{}\left({{Q}}_{{2}}\right){}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right)\right){}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right){-}\left({-}{{\mathrm{D}}}_{{1}{,}{2}}{}\left({{Q}}_{{2}}\right){}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){+}\left(\frac{{\partial }}{{\partial }{{\mathrm{\theta }}}_{{1}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){}{{\mathrm{D}}}_{{2}{,}{3}}{}\left({{Q}}_{{2}}\right){}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){-}{{\mathrm{D}}}_{{3}}{}\left({{Q}}_{{2}}\right){}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){}\left(\frac{{{\partial }}^{{2}}}{{\partial }{{\mathrm{\theta }}}_{{1}}{\partial }{{\mathrm{\theta }}}_{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){-}\left(\frac{{\partial }}{{\partial }{{\mathrm{\theta }}}_{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right){}{{\mathrm{D}}}_{{1}{,}{3}}{}\left({{Q}}_{{2}}\right){}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)\right)\right){}{{Q}}_{{1}}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}\right)$ (12)
 > $\mathrm{expand}\left(\right)$
 ${0}$ (13)

You can use C and AC variables together. If the output contains derivatives with respect to both C and AC variables, then they are displayed in separate groups.

 > $\mathrm{diff}\left(f\left(\mathrm{\theta }\left[1\right],\mathrm{\theta }\left[2\right],x,y\right),\mathrm{\theta }\left[1\right],\mathrm{\theta }\left[2\right],\mathrm{}\left(x,3\right),\mathrm{}\left(y,2\right)\right)$
 $\frac{{{\partial }}^{{7}}}{{\partial }{{x}}^{{3}}{\partial }{{y}}^{{2}}{\partial }{{\mathrm{\theta }}}_{{1}}{\partial }{{\mathrm{\theta }}}_{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({{\mathrm{\theta }}}_{{1}}{,}{{\mathrm{\theta }}}_{{2}}{,}{x}{,}{y}\right)$ (14)
 > 

When the derivand contains both commutative and anticommutative variables and functions, using the top level diff command may result in incorrect calculations, even when the differentiation variable is commutative.

References

 Cheb-Terrab, E.S. "Symbolic Computing with Anti-commutative and Non-commutative Variables." MapleTech, Vol. 5, No. 1. (1998): 16-22.