Ask Your Question

Revision history [back]

First of all, I would recommend using volume_form(contra=4) to get the volume form with all the indices raised up (see the documentation of volume_form). Guessing the form of your metric from the determinant you have given, the code could be

M = Manifold(4, 'M')
X.<t,r,th,ph> = M.chart(r't r:(0,+oo) th:(0,pi):\theta ph:\phi')
g = M.lorentzian_metric('g')
ff = function('f')(t)
aa = function('a')(t)
g[0,0] = ff
g[1,1] = aa^2
g[2,2] = aa^2*r^2
g[3,3] = aa^2*r^2*sin(th)^2
g.display()

output:

g = f(t) dt*dt + a(t)^2 dr*dr + r^2*a(t)^2 dth*dth + r^2*a(t)^2*sin(th)^2 dph*dph

g.volume_form(4) returns a 4-vector, i.e. a fully antisymmetric type-(4,0) tensor, with the advantage of a compact display, using wedge products instead of tensor products:

print(g.volume_form(contra=4))
g.volume_form(contra=4).display()

output:

4-vector field on the 4-dimensional differentiable manifold M
sqrt(-f(t))*abs(a(t))^3/(r^2*a(t)^6*f(t)*sin(th)) d/dt/\d/dr/\d/dth/\d/dph

The totally upper symbol is then

epsilon_up = - g.volume_form(contra=4)*g.sqrt_abs_det()
print(epsilon_up)
epsilon_up.display()

output:

4-vector field on the 4-dimensional differentiable manifold M
abs(a(t))^6/a(t)^6 d/dt/\d/dr/\d/dth/\d/dph

As you pointed out, $|a(t)|$ is not simplified to $a(t)$. Unfortunately, assume(a(t)>0) is of no help here (this is a known weakness of Sage: assumptions involving symbolic functions do not work). If you know that $a(t)>0$, the solution is to ask Sage to substitute $a(t)$ for $|a(t)|$:

epsilon_up[0,1,2,3] = epsilon_up[0,1,2,3].expr().substitute({abs(a(t)): a(t)})
epsilon_up.display()

output:

d/dt/\d/dr/\d/dth/\d/dph