Ask Your Question

Alternating symbols with SageManifolds

asked 2018-05-07 22:03:28 +0200

cduston gravatar image

I would like to utilize the alternating symbol $\epsilon_{abcd}$ in SageManifolds. I've worked out that you can define the volume form like

epsilon = g.volume_form()
print(epsilon) ; epsilon.display()

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

And I can turn this into "the alternating 1-form" by dividing by the determinant of the metric. However, if I try to find the totally upper symbol $\epsilon^{abcd}$, which should just have components +1 and -1, I get


Tensor field of type (4,0) on the 4-dimensional differentiable manifold
abs(a(t))^6/a(t)^6 d/dt*d/dr*d/dth*d/dph - abs(a(t))^6/a(t)^6
d/dt*d/dr*d/dph*d/dth - abs(a(t))^6/a(t)^6 d/dt*d/dth*d/dr*d/dph +
abs(a(t))^6/a(t)^6 d/dt*d/dth*d/dph*d/dr + abs(a(t))^6/a(t)^6
d/dt*d/dph*d/dr*d/dth - abs(a(t))^6/a(t)^6 d/dt*d/dph*d/dth*d/dr -
abs(a(t))^6/a(t)^6 d/dr*d/dt*d/dth*d/dph + abs(a(t))^6/a(t)^6
d/dr*d/dt*d/dph*d/dth + abs(a(t))^6/a(t)^6 d/dr*d/dth*d/dt*d/dph -
abs(a(t))^6/a(t)^6 d/dr*d/dth*d/dph*d/dt - abs(a(t))^6/a(t)^6
d/dr*d/dph*d/dt*d/dth + abs(a(t))^6/a(t)^6 d/dr*d/dph*d/dth*d/dt +
abs(a(t))^6/a(t)^6 d/dth*d/dt*d/dr*d/dph - abs(a(t))^6/a(t)^6
d/dth*d/dt*d/dph*d/dr - abs(a(t))^6/a(t)^6 d/dth*d/dr*d/dt*d/dph +
abs(a(t))^6/a(t)^6 d/dth*d/dr*d/dph*d/dt + abs(a(t))^6/a(t)^6
d/dth*d/dph*d/dt*d/dr - abs(a(t))^6/a(t)^6 d/dth*d/dph*d/dr*d/dt -
abs(a(t))^6/a(t)^6 d/dph*d/dt*d/dr*d/dth + abs(a(t))^6/a(t)^6
d/dph*d/dt*d/dth*d/dr + abs(a(t))^6/a(t)^6 d/dph*d/dr*d/dt*d/dth -
abs(a(t))^6/a(t)^6 d/dph*d/dr*d/dth*d/dt - abs(a(t))^6/a(t)^6
d/dph*d/dth*d/dt*d/dr + abs(a(t))^6/a(t)^6 d/dph*d/dth*d/dr*d/dt

Which is just happening because at some point Sage has figured it out needs to keep track of the sign of a. Is there a direct way to define $\epsilon_{abcd}$ without accessing to the volume form at all? Essentially, I want to directly calculate things like the Euler Characteristic (and signature), which look like


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2018-05-08 20:52:55 +0200

eric_g gravatar image

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 = 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:



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()


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)})


edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-05-07 22:03:28 +0200

Seen: 421 times

Last updated: May 08 '18