Cadabra
a field-theory motivated approach to computer algebra

PartialDerivative

Makes an object a partial derivative.
Makes an object a partial derivative, i.e. a derivative which commutes. The object on which it acts has to be a non-sub/superscript child, while all the sub- or superscript child nodes are interpreted to be the variables with respect to which the derivative is taken.
\partial{#}::PartialDerivative. A_{\mu}::Depends(\partial{#}). ex:= \partial_{\nu}{A_{\mu} B_{\rho}};
product_rule(_);
\(\displaystyle{}\partial_{\nu}{A_{\mu}} B_{\rho}+A_{\mu} \partial_{\nu}{B_{\rho}}\)
unwrap(_);
\(\displaystyle{}\partial_{\nu}{A_{\mu}} B_{\rho}\)
\partial_{\nu}(A_{\mu}) B_{\rho}
Note that derivative objects do not necessarily need to have a sub- or superscript child, they can be abstract derivatives as in
D{#}::PartialDerivative. ex:= D(c d e);
\(\displaystyle{}D\left(c d e\right)\)
D(c d e)
\partial(f g)
product_rule(_);
\(\displaystyle{}D{c} d e+c D{d} e+c d D{e}\)
D(c) d e + c D(d) e + c d D(e)
g \partial(f)
If you want to write a derivative with respect to a coordinate (instead of with respect to an index, as in the first example above), refer to the Coordinate property.
It can be useful to specify what is the implicit coordinate with respect to which a derivative acts. For instance, for a derivative in the $\tau$ direction, we could write
\tau::Coordinate; \partial{#}::Derivative(\tau); f::Depends(\tau); ex:= \partial{f g}; unwrap(ex);
\(\displaystyle{}\text{Attached property Coordinate to }\tau.\)
\(\displaystyle{}\text{Attached property Derivative to }\partial{\#}.\)
\(\displaystyle{}\text{Attached property Depends to }f.\)
\(\displaystyle{}\partial\left(f g\right)\)
\(\displaystyle{}g \partial{f}\)
Copyright © 2001-2024 Kasper Peeters
Questions? info@cadabra.science