ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 09 Aug 2021 16:56:58 +0200Contraction of Levi-Civita Symbolshttps://ask.sagemath.org/question/58379/contraction-of-levi-civita-symbols/I would like to calculate various contractions of the Levi-Civita symbol using SageMath.
As far as i know, there is no direct implementation of the ordinary symbol, so I followed another post and just used the Euclidean space:
E = EuclideanSpace(2, start_index=0)
g = E.metric()
eps = g.volume_form()
eps_dual = g.volume_form(2)
I tested some generic contractions which all seemed to work fine, however, once I started to change the contraction order, things became odd. While
res = eps['_ij']*eps_dual['^ij']
res.disp()
correctly returns `E^2 --> R \n
(x, y) |--> 2`, for
res = eps['_ij']*eps_dual['^ji']
res.disp()
(2nd `ij` swapped ) I would expect to get `E^2 --> R \n
(x, y) |--> -2`, but sage tells me its `+2` again.
The same happens if I use `res = eps.contract(0, 1, eps_dual, 1, 0)` instead of the explicit index notation.
I don't know if this is some kind of convention I'm not aware of, however
res = (eps['_ij']*eps_dual['^jk']).trace()
or
res = (eps['_ij']*eps_dual['^jk'])['^n_n']
works just fine. Why does it seem like Sage does not care about the order if I contract all indices at once but does if I do it one after another?zenAmpMon, 09 Aug 2021 16:56:58 +0200https://ask.sagemath.org/question/58379/Alternating symbols with SageManifoldshttps://ask.sagemath.org/question/42289/alternating-symbols-with-sagemanifolds/ 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
epsilon_up=epsilon.up(g)*det*det
print(epsilon_up);epsilon_up.display()
Tensor field of type (4,0) on the 4-dimensional differentiable manifold
M
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
$$R_{abcd}R_{efgh}\epsilon^{abef}\epsilon^{cdgh}$$cdustonMon, 07 May 2018 22:03:28 +0200https://ask.sagemath.org/question/42289/