Cadabra
a field-theory motivated approach to computer algebra

Derivatives and implicit dependence on coordinates

There is no fixed notation for derivatives; as with all other objects you have to declare derivatives by associating a property to them, in this case the Derivative property.
\nabla{#}::Derivative;
\(\displaystyle{}\text{Property Derivative attached to }\backslash\texttt{nabla}\{\#\}.\)
Derivative objects can be used in various ways. You can just write the derivative symbol, as in
ex:=\nabla{ A_{\mu} };
\(\displaystyle{}\nabla{A_{\mu}}\)
\nabla(A_{\mu})
Or you can write the coordinate with respect to which the derivative is taken,
s::Coordinate; A_{\mu}::Depends(s); ex:=\nabla_{s}{ A_{\mu} };
\(\displaystyle{}\text{Property Coordinate attached to }s.\)
\(\displaystyle{}\text{Property Depends attached to }A_{\mu}.\)
\(\displaystyle{}\nabla_{s}{A_{\mu}}\)
\nabla_{s}(A_{\mu})
Finally, you can use an index as the subscript argument, as in
{ \mu, \nu }::Indices(vector); ex:=\nabla_{\nu}{ A_{\mu} };
\(\displaystyle{}\text{Property Indices(position=free) attached to }\left[\mu, \nu\right].\)
\(\displaystyle{}\nabla_{\nu}{A_{\mu}}\)
\nabla_{\nu}(A_{\mu})
(in which case the first line is, for the purpose of using the derivative operator, actually unnecessary).
The main point of associating the Derivative property to an object is to make the object obey the Leibnitz or product rule, as illustrated by the following example,
\nabla{#}::Derivative; ex:= \nabla{ A_{\mu} * B_{\nu} }; product_rule(_);
\(\displaystyle{}\text{Property Derivative attached to }\backslash\texttt{nabla}\{\#\}.\)
\(\displaystyle{}\nabla\left(A_{\mu} B_{\nu}\right)\)
\nabla(A_{\mu} B_{\nu})
\(\displaystyle{}\nabla{A_{\mu}} B_{\nu} +A_{\mu} \nabla{B_{\nu}}\)
\nabla(A_{\mu}) B_{\nu} + A_{\mu} \nabla(B_{\nu})
This behaviour is a consequence of the fact that Derivative derives from Distributable. Note that the Derivative property does not automatically give you commuting derivatives, so that you can e.g. use it to write covariant derivatives.
More specific derivative types exist too. An example are partial derivatives, declared using the PartialDerivative property. Partial derivatives are commuting and therefore automatically symmetric in their indices,
\partial{#}::PartialDerivative; {a,b,m,n}::Indices(vector); C_{m n}::Symmetric; ex:=T^{b a} \partial_{a b}( C_{m n} D_{n m} );
\(\displaystyle{}\text{Property PartialDerivative attached to }\backslash\texttt{partial}\{\#\}.\)
\(\displaystyle{}\text{Property Indices(position=free) attached to }\left[a, b, m, n\right].\)
\(\displaystyle{}\text{Property Symmetric attached to }C_{m n}.\)
\(\displaystyle{}T^{b a} \partial_{a b}\left(C_{m n} D_{n m}\right)\)
T^{b a} \partial_{a b}(C_{m n} D_{n m})
canonicalise(_);
\(\displaystyle{}T^{a b} \partial_{a b}\left(C_{m n} D_{m n}\right)\)
T^{a b} \partial_{a b}(C_{m n} D_{m n})
Copyright © 2001-2024 Kasper Peeters
Questions? info@cadabra.science