Cadabra
a field-theory motivated approach to computer algebra

Depends

Makes an object implicitly dependent on other objects.
Makes an object implicitly dependent on other objects, i.e. assumes that the indicated object is a function of the arguments of the property. For example
x::Coordinate; \phi::Depends(x);
\(\displaystyle{}\text{Attached property Coordinate to }x.\)
\(\displaystyle{}\text{Attached property Depends to }\phi.\)
makes $\phi$ an implicit function of $x$. Instead of indicating the coordinate on which the object depends, it is also possible to indicate which derivatives would yield a non-zero answer, as in
\nabla{#}::Derivative; \phi::Depends(\nabla{#}); ex:=\nabla_{m}{\phi c \sin{y}}; unwrap(_);
\(\displaystyle{}\text{Attached property Derivative to }\nabla{\#}.\)
\(\displaystyle{}\text{Attached property Depends to }\phi.\)
\(\displaystyle{}\nabla_{m}\left(\phi c \sin{y}\right)\)
\nabla_{m}(\phi c \sin(y))
\(\displaystyle{}c \sin{y} \nabla_{m}{\phi}\)
c \sin(y) \nabla_{m}(\phi)
(Note: if you did this in Cadabra 1.x you could write Depends(\nabla); this is no longer possible in 2.x and you need to write the full pattern Depends(\nabla{#})). Finally, it is possible to use an index name to indicate on which coordinates a field depends,
\nabla{#}::Derivative; {\mu,\nu}::Indices; \chi::Depends(\mu); ex:=\nabla_{\mu}{\chi} + \nabla_{\mu}{\rho}; unwrap(_);
\(\displaystyle{}\text{Property Derivative attached to }\nabla{\#}.\)
\(\displaystyle{}\text{Property Indices(position=free) attached to }\left[\mu, \nu\right].\)
\(\displaystyle{}\text{Property Depends attached to }\chi.\)
\(\displaystyle{}\nabla_{\mu}{\chi}+\nabla_{\mu}{\rho}\)
\nabla_{\mu}(\chi) + \nabla_{\mu}(\rho)
\(\displaystyle{}\nabla_{\mu}{\chi}\)
\nabla_{\mu}(\chi)
To make a tensor with any type and number of indices Depend on something else, use
h{#}::Depends(\nabla{#}); ex:=\nabla_{m}{ c d h^{0 t} h_{t 0} h^{0}_{0} }; unwrap(_);
\(\displaystyle{}\text{Attached property Depends to }h\left(\#\right).\)
\(\displaystyle{}\nabla_{m}\left(c d h^{0 t} h_{t 0} h^{0}\,_{0}\right)\)
\nabla_{m}(c d h^{0 t} h_{t 0} h^{0}_{0})
\(\displaystyle{}c d \nabla_{m}\left(h^{0 t} h_{t 0} h^{0}\,_{0}\right)\)
c d \nabla_{m}(h^{0 t} h_{t 0} h^{0}_{0})
{m,n,p,q}::Indices(vector); \phi::Depends(m);
\(\displaystyle{}\text{Attached property Indices(position=free) to }\left[m, n, p, q\right].\)
\(\displaystyle{}\text{Attached property Depends to }\phi.\)
If you want to make an object depend on more than one thing, you need to specify them all in one Depends property. If you specify them in two separate properties, the last property will overwrite the previous one. Therefore, you get
\hat{#}::Accent; {x,y}::Coordinate; \partial{#}::PartialDerivative; A::Depends(\hat{#}); A::Depends(x); ex:=\hat{A}; unwrap(ex);
\(\displaystyle{}\text{Attached property Accent to }\widehat{\#}.\)
\(\displaystyle{}\text{Attached property Coordinate to }\left(x, \mmlToken{mo}[linebreak="goodbreak"]{} y\right).\)
\(\displaystyle{}\text{Attached property PartialDerivative to }\partial{\#}.\)
\(\displaystyle{}\text{Attached property Depends to }A.\)
\(\displaystyle{}\text{Attached property Depends to }A.\)
\(\displaystyle{}\widehat{A}\)
\(\displaystyle{}0\)
Copyright © 2001-2024 Kasper Peeters
Questions? info@cadabra.science