Maxima Function
contract (expr)
Carries out the tensorial contractions in expr which may be any
combination of sums and products. This function uses the information
given to the defcon function. For best results, expr
should be fully expanded. ratexpand is the fastest way to expand
products and powers of sums if there are no variables in the denominators
of the terms. The gcd switch should be false if GCD
cancellations are unnecessary.