Cadabra
a field-theory motivated approach to computer algebra

Determinant

Declares an object to be the determinant of a matrix or metric.
In order to declare the name associated to the determinant of a matrix or metric, give it the Determinant property, indicating the matrix or metric as an argument. This is mainly used to compute determinants in components, but the property can also be used by algorithms which only deal with purely abstract properties, e.g. covariant derivatives. The following example shows how to declare a metric and its components, and then compute the determinant from there.
{t,r,\phi}::Coordinate; {m,n,p,q}::Indices(position=fixed, values={t,r,\phi}); g_{m n}::Metric; rl:= g_{t t} = -1, g_{r r} = 1, g_{\phi \phi} = r**2;
\(\displaystyle{}\text{Attached property Coordinate to }\left[t, r, \phi\right].\)
\(\displaystyle{}\text{Attached property Indices(position=fixed) to }\left[m, n, p, q\right].\)
\(\displaystyle{}\text{Attached property Metric to }g_{m n}.\)
\(\displaystyle{}\left[g_{t t} = -1, g_{r r} = 1, g_{\phi \phi} = {r}^{2}\right]\)
{g_{t t} = -1, g_{r r} = 1, g_{\phi \phi} = (r)**2}
Now we declare that $g$ denotes the determinant of the metric $g_{m n}$, and use complete to compute it given the metric components.
g::Determinant(g_{m n});
\(\displaystyle{}\text{Attached property Determinant to }g.\)
complete(rl, $g$);
\(\displaystyle{}\left[g_{t t} = -1, g_{r r} = 1, g_{\phi \phi} = {r}^{2}, g = -{r}^{2}\right]\)
{g_{t t} = -1, g_{r r} = 1, g_{\phi \phi} = (r)**2, g = -(r)**2}
Copyright © 2001-2024 Kasper Peeters
Questions? info@cadabra.science