I want to do some simple tensor contraction using Maple or Mathematica. The calculation is simple but extremely long. All I want is to teach Maple/Mathematica to do tensor contraction without using explicit 4x4 matrices or four-vectors. For example, I want Maple/Mathematica to recognize that [itex] \eta_{\alpha \beta} q^\beta [/itex] must be replaced by [itex] q_\alpha [/itex] . Or that [itex] \eta_{\mu \nu} \eta^{\mu \alpha} [/itex] must be replaced by [itex] \eta^\alpha_\nu [/itex] or that [itex] \eta_{\mu \nu} \eta^{\mu \nu} = 4 [/itex] and so on.

The calculation involves hundreds of terms (it is in the context of linearized GR quantized as an effective field theory).

I would highly appreciate if someone could tell me how to tell Maple/Mathematica to do certain substitutions like this.

Patrick