Ask Your Question

Why does sage fail to detect the symmetry here?

asked 2023-06-24 00:56:41 +0200

Loreno Heer gravatar image
M = Manifold(4, 'M')
CM.<u,r,θ,φ> = M.chart(r'u r:(0,+oo) θ:(0,pi) φ:(0,2*pi)')
e = CM.coframe()
du = e[0]
dr = e[1]
dθ = e[2]
dφ = e[3]
V = function('V')
β = function('β')
γ = function('γ')
δ = function('δ')

(dθ * dφ + dφ * dθ).symmetries()
(dθ * dφ + dφ * dθ).symmetrize() == (dθ * dφ + dφ * dθ)

I want to define a (degenerate) metric:

 g = M.metric('g')
 g.set(dθ * dφ + dφ * dθ)

this fails because Sage does not believe the tensor field to be symmetric.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2023-06-24 11:40:14 +0200

eric_g gravatar image

When one writes dθ * dφ + dφ * dθ, Sage first computes a = dθ * dφ and b = dφ * dθ; it then performs a + b and, at this stage, there is no way to detect (without any extra computation) that the output must be symmetric. The only case where the symmetry is set automatically is for expressions like dθ * dθ. So you should initialize the metric as

g = M.metric('g')
g.set((dθ * dφ + dφ * dθ).symmetrize())

An equivalent way, which avoids to introduce explicitly the 1-forms and , is

g = M.metric('g')
g[2,3] = 1
edit flag offensive delete link more


Thanks, this works of course. Just find it odd that g.set(...) does not explicitly check that the argument is symmetric. But I can understand that this may be a performance consideration.

Loreno Heer gravatar imageLoreno Heer ( 2023-06-24 16:07:25 +0200 )edit

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: 2023-06-24 00:56:41 +0200

Seen: 123 times

Last updated: Jun 24 '23