a field-theory motivated approach to computer algebra

## eliminate_metric

Eliminate metrics by raising or lowering indices.
Eliminate metric and inverse metric objects by raising or lowering indices.
{m, n, p, q, r}::Indices(vector, position=fixed). {m, n, p, q, r}::Integer(0..9). g_{m n}::Metric. g^{m n}::InverseMetric. g_{m}^{n}::KroneckerDelta. g^{m}_{n}::KroneckerDelta. ex:=g_{m p} g^{p m}; eliminate_metric(_);
$$\displaystyle{}g_{m p} g^{p m}$$
g_{m p} g^{p m}
$$\displaystyle{}g^{p}\,_{p}$$
g^{p}_{p}
eliminate_kronecker(_);
$$\displaystyle{}10$$
10
It is sometimes useful to eliminate only those metrics which have two dummy indices (so as to avoid changing indices on non-metric factors), as in the following example:
{a,b,c,d,e,f}::Indices(position=fixed); g_{a b}::Metric; g^{a b}::InverseMetric; ex:=X_{a} g^{a b} g_{b c} g^{c d} g_{d e} g^{e f}; eliminate_metric(ex, repeat=True, redundant=True);
$$\displaystyle{}\text{Property Indices(position=fixed) attached to }\left[a, b, c, d, e, f\right].$$
$$\displaystyle{}\text{Property Metric attached to }g_{a b}.$$
$$\displaystyle{}\text{Property TableauSymmetry attached to }g^{a b}.$$
$$\displaystyle{}X_{a} g^{a b} g_{b c} g^{c d} g_{d e} g^{e f}$$
X_{a} g^{a b} g_{b c} g^{c d} g_{d e} g^{e f}
$$\displaystyle{}X_{e} g^{e f}$$
X_{e} g^{e f}
Without the redundant=True option, this would have reduced the expression to $X^{f}$.