# Revision history [back]

The Bel decomposition does not appear in the sagemanifolds reference document, so I assume it is a default command. Nonetheless, it is fairly easy to implement. Assuming that one already has a metric g and a 1-form e0 (perhaps from the 0th element of the coordinate coframe)

theVolumeForm = g.volume_form()
theStarForTwoForms = theVolumeForm.up(g,0).up(g,1)

theRiemann = g.riemann()
theRiemannAllDown = theRiemann.down(g,0)
theStarRiemann = theStarForTwoForms['^{ef}_{ab}']*theRiemannAllDown['_{efcd}']
theStarRiemannStar = theStarForTwoForms['^{ef}_{cd}']*theStarRiemann['_{abef}']

theElectrograviticTensor = (theRiemannAllDown['_{abcd}']*(e0.up(g))['^d'])['_{abc}']*(e0.up(g))['^b']
theMagnetograviticTensor = (theStarRiemann['_{abcd}']*(e0.up(g))['^d'])['_{abc}']*(e0.up(g))['^b']
theTopograviticTensor = (theStarRiemannStar['_{abcd}']*(e0.up(g))['^d'])['_{abc}']*(e0.up(g))['^b']


I have probably mangled some signs in the choice of order of raising and contracting indices on the volume form.

(Some tricks to be aware of: When using up and down, since sagemanifolds stores all contravariant indices first, for a fully contravariant tensor, raising index 1 and then lowering index 1 gives an error since the raised index is automatically moved to index 0. The * operation on tensor only works on a pair of tensors. The latex notation for indices (e.g. ['^{ab}']) can be used to take products and contract tensors, but the latex indexing is lost once the * operation is complete. Thus for a product of three indices, one needs to open a parenthesis, apply the indices to get the correct contraction and product for the first two tensors, close the parenthesis, apply a new set of indices, and then multiply by the third tensor.)