1 | initial version |
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 dθ
and dφ
, is
g = M.metric('g')
g[2,3] = 1