Skip to content

Commit

Permalink
Trac #32953: Sphere: improve handling of default charts
Browse files Browse the repository at this point in the history
If one uses the method `stereographic_coordinates` to initialize
steographic coordinates (instead of as via the constructor argument),
then there are some inconsistencies.

For example,
{{{
sage: M = manifolds.Sphere(2)
sage: XN = M.stereographic_coordinates(pole='north')
sage: g = M.metric()
sage: U = XN.domain(); U
Open subset S^2-{NP} of the 2-sphere S^2 of radius 1 smoothly embedded
in the
 Euclidean space E^3
sage: g.restrict(U).display()
g = (cos(theta)^2 - 2*cos(theta) + 1) dy1⊗dy1
  + (cos(theta)^2 - 2*cos(theta) + 1) dy2⊗dy2
}}}
One would certainly expect the components of g to be expressed in terms
of (y1,y2), i.e. the chart XN, which is the only chart that covers
entirely U = S^2-{NP}.

URL: https://trac.sagemath.org/32953
Reported by: gh-tobiasdiez
Ticket author(s): Eric Gourgoulhon
Reviewer(s): Travis Scrimshaw
  • Loading branch information
Release Manager committed Feb 27, 2022
2 parents ef15b55 + 20b9cb0 commit cd78e1b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/sage/manifolds/differentiable/examples/sphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,10 @@ def _init_spherical(self, names=None):
spher = A.chart(names=names)
coord = spher[:]

# make spherical chart and frame the default ones on their domain:
A.set_default_chart(spher)
A.set_default_frame(spher.frame())

# manage embedding...
from sage.misc.misc_c import prod
from sage.functions.trig import cos, sin
Expand Down Expand Up @@ -888,6 +892,22 @@ def _init_stereographic(self, names, default_pole='north'):
Chart (A, (xp,)),
Chart (A, (x,))]
The stereographic chart is the default one on its domain::
sage: V = stereoS.domain()
sage: V.default_chart()
Chart (S^1-{SP}, (x,))
Accordingly, we have::
sage: S1.metric().restrict(V).display()
g = 4/(x^4 + 2*x^2 + 1) dx⊗dx
while the spherical chart is still the default one on ``S1``::
sage: S1.metric().display()
g = dphi⊗dphi
"""
# speed-up via simplification method...
self.set_simplify_function(lambda expr: expr.simplify_rational())
Expand Down Expand Up @@ -919,6 +939,13 @@ def _init_stereographic(self, names, default_pole='north'):
coordN = stereoN[:]
coordS = stereoS[:]

# make stereographic charts and frames the default ones on their
# respective domains:
U.set_default_chart(stereoN)
V.set_default_chart(stereoS)
U.set_default_frame(stereoN.frame())
V.set_default_frame(stereoS.frame())

# predefine variables...
r2_N = sum(y ** 2 for y in coordN)
r2_S = sum(yp ** 2 for yp in coordS)
Expand Down

0 comments on commit cd78e1b

Please sign in to comment.