Cadabra
a field-theory motivated approach to computer algebra

complete

Complete a set of substitution rules to cover related objects.
Complete a set of substitution rules with additional rules based on the properties of the objects appearing in the rules. This can for instance be used to generate rules for the inverse components of the metric given the rules for the metric components themselves, as in the example below. Note that the argument itself gets modified (amended) with the additional rules.
{r,t}::Coordinate. {m,n,p,q}::Indices(values={r,t}). g_{m n}::Metric. g^{m n}::InverseMetric.
rl:={ g_{t t} = r, g_{t r} = r**2/a, g_{r t} = r**2/a, g_{r r} = 1 };
\(\displaystyle{}(g_{t t} = r, g_{t r} = \frac{r^{2}}{a}, g_{r t} = \frac{r^{2}}{a}, g_{r r} = 1)\)
complete(rl, $g^{m n}$);
\(\displaystyle{}(g_{t t} = r, g_{t r} = \frac{r^{2}}{a}, g_{r t} = \frac{r^{2}}{a}, g_{r r} = 1, g^{r r} = 1+\frac{r^{4}}{a^{2} \left(r - \frac{r^{4}}{a^{2}}\right)}, g^{r t} = - \frac{r^{2}}{a \left(r - \frac{r^{4}}{a^{2}}\right)}, g^{t r} = - \frac{r^{2}}{a \left(r - \frac{r^{4}}{a^{2}}\right)}, g^{t t} = \frac{1}{r - \frac{r^{4}}{a^{2}}})\)
Note that this uses SymPy behind the scenes to do the scalar algebra and matrix inversion.
Copyright © 2001-2024 Kasper Peeters
Questions? info@cadabra.science