Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Make the following modification:

%display latex
M = Manifold(4, 'M', latex_name=r'\mathcal{M}', structure='Lorentzian')
X.<t,x,y,z> = M.chart()
F = M.scalar_field(1/(-t^2 + x^2 + y^2 + z^2))
dF = diff(F)
dF.apply_map(factor)
xm = var('xm', latex_name=r"x_\mu")
dF.apply_map(lambda u: u.substitute({t^2-x^2-y^2-z^2:xm}))
dF.disp()