Cadabra
a field theory motivated approach to computer algebra

unwrap

Move objects out of derivatives or accents.
Move objects out of Derivatives or Accents when they do not depend on these operators. Accents will get removed from objects which do not depend on them, as in the following example:
\hat{#}::Accent; \hat{#}::Distributable; B::Depends(\hat); ex:=\hat{A+B+C};
\(\displaystyle{}\text{Attached property Accent to }\widehat{\#}.\)
\(\displaystyle{}\text{Attached property Distributable to }\widehat{\#}.\)
\(\displaystyle{}\text{Attached property Depends to }B.\)
\(\displaystyle{}\widehat{A+B+C}\)
distribute(_);
\(\displaystyle{}\widehat{A}+\widehat{B}+\widehat{C}\)
unwrap(_);
\(\displaystyle{}\widehat{B}\)
Derivatives will be set to zero if an object inside does not depend on it. All objects which are annihilated by the derivative operator are moved to the front (taking into account anti-commutativity if necessary),
\partial{#}::PartialDerivative; {A,B,C,D}::AntiCommuting; x::Coordinate; {B,D}::Depends(\partial);
\(\displaystyle{}\text{Attached property PartialDerivative to }\partial{\#}.\)
\(\displaystyle{}\text{Attached property AntiCommuting to }\left(A, \mmlToken{mo}[linebreak="goodbreak"]{} B, \mmlToken{mo}[linebreak="goodbreak"]{} C, \mmlToken{mo}[linebreak="goodbreak"]{} D\right).\)
\(\displaystyle{}\text{Attached property Coordinate to }x.\)
\(\displaystyle{}\text{Attached property Depends to }\left(B, \mmlToken{mo}[linebreak="goodbreak"]{} D\right).\)
ex:=\partial_{x}{A B C D};
\(\displaystyle{}\partial_{x}\left(A B C D\right)\)
unwrap(_);
\(\displaystyle{}-A C \partial_{x}\left(B D\right)\)
Note that a product remains inside the derivative; to expand that use prodrule. Here is another example:
\del{#}::LaTeXForm("\partial"). \del{#}::Derivative; X::Depends(\del); ex:=\del{X*Y*Z};
\(\displaystyle{}\text{Attached property Derivative to }\partial{\#}.\)
\(\displaystyle{}\text{Attached property Depends to }X.\)
\(\displaystyle{}\partial\left(X Y Z\right)\)
product_rule(_);
\(\displaystyle{}\partial{X} Y Z+X \partial{Y} Z+X Y \partial{Z}\)
unwrap(_);
\(\displaystyle{}\partial{X} Y Z\)
Note that all objects are by default constants for the action of Derivative operators. If you want objects to stay inside derivative operators you have to explicitly declare that they depend on the derivative operator or on the coordinate with respect to which you take a derivative.
Copyright © 2001-2017 Kasper Peeters
Questions? info@cadabra.science