a field-theory motivated approach to computer algebra


Map Sympy algorithms to Cadabra expressions
Cadabra expressions are typically tensor expressions, which you cannot feed directly into Sympy. With the map_sympy function you can recursively apply Sympy algorithms to the scalar parts of Cadabra expressions. The simplest example is when you have a scalar expression in Cadabra, for instance
ex:= \int{\sin(x)}{x};
\(\displaystyle{}\int \sin{x}\,\,{\rm d}x\)
The inert Cadabra expression gets evaluated by Sympy and then stored again in the `ex` object,
In more complicated cases you may have a tensorial expression which you would like to simplify using Sympy, for instance
ex:= (\sin(x)**2 + \cos(x)**2) A_{m} - A_{m};
\(\displaystyle{}\left({\left(\sin{x}\right)}^{2}+{\left(\cos{x}\right)}^{2}\right) A_{m}-A_{m}\)
map_sympy(ex, "simplify");
Copyright © 2001-2024 Kasper Peeters