Skip to content

Commit

Permalink
Improve handling of default charts on the sphere (#32953)
Browse files Browse the repository at this point in the history
  • Loading branch information
egourgoulhon committed Feb 22, 2022
1 parent 15c8011 commit 20b9cb0
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 20b9cb0

Please sign in to comment.