From 20b9cb0cf890c1a717605b9e043ba398203a05e0 Mon Sep 17 00:00:00 2001 From: Eric Gourgoulhon Date: Tue, 22 Feb 2022 14:59:54 +0100 Subject: [PATCH] Improve handling of default charts on the sphere (#32953) --- .../differentiable/examples/sphere.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/sage/manifolds/differentiable/examples/sphere.py b/src/sage/manifolds/differentiable/examples/sphere.py index 3b9df0f6c79..1183448251a 100644 --- a/src/sage/manifolds/differentiable/examples/sphere.py +++ b/src/sage/manifolds/differentiable/examples/sphere.py @@ -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 @@ -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()) @@ -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)