Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit 8d2f44d

Browse files
committed
Trac #30799: collect manifolds examples in 'examples' + lazy_import for catalog
1 parent f976c52 commit 8d2f44d

File tree

14 files changed

+44
-35
lines changed

14 files changed

+44
-35
lines changed

src/doc/en/reference/euclidean_spaces/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Euclidean Spaces and Vector Calculus
66
.. toctree::
77
:maxdepth: 2
88

9-
sage/manifolds/differentiable/euclidean
9+
sage/manifolds/differentiable/examples/euclidean
1010

1111
sage/manifolds/operators

src/doc/en/reference/manifolds/diff_manifold.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Differentiable Manifolds
88

99
sage/manifolds/differentiable/chart
1010

11-
sage/manifolds/differentiable/real_line
11+
sage/manifolds/differentiable/examples/real_line
1212

1313
diff_scalarfield
1414

src/doc/en/reference/manifolds/euclidean_space.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ Euclidean Spaces and Vector Calculus
66
.. toctree::
77
:maxdepth: 2
88

9-
sage/manifolds/differentiable/euclidean
9+
sage/manifolds/differentiable/examples/euclidean
1010

1111
sage/manifolds/operators

src/sage/manifolds/all.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from sage.misc.lazy_import import lazy_import
22
lazy_import('sage.manifolds.manifold', 'Manifold')
3-
lazy_import('sage.manifolds.differentiable.real_line', 'OpenInterval')
4-
lazy_import('sage.manifolds.differentiable.real_line', 'RealLine')
5-
lazy_import('sage.manifolds.differentiable.euclidean', 'EuclideanSpace')
6-
import sage.manifolds.catalog as manifolds
3+
lazy_import('sage.manifolds.differentiable.examples.real_line', 'OpenInterval')
4+
lazy_import('sage.manifolds.differentiable.examples.real_line', 'RealLine')
5+
lazy_import('sage.manifolds.differentiable.examples.euclidean', 'EuclideanSpace')
6+
lazy_import('sage.manifolds', 'catalog', 'manifolds')

src/sage/manifolds/catalog.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
``manifolds.<tab>``, where ``<tab>`` indicates pressing the tab key.
88
They are:
99
10+
- :class:`~sage.manifolds.differentiable.examples.euclidean.EuclideanSpace`: Euclidean space
11+
- :class:`~sage.manifolds.differentiable.examples.real_line.RealLine`: real line
12+
- :class:`~sage.manifolds.differentiable.examples.real_line.OpenInterval`: open interval on the real line
1013
- :func:`Sphere`: sphere embedded in Euclidean space
1114
- :func:`Torus`: torus embedded in Euclidean space
1215
- :func:`Minkowski`: 4-dimensional Minkowski space
@@ -27,6 +30,12 @@
2730
# http://www.gnu.org/licenses/
2831
# *****************************************************************************
2932

33+
# Lazy import from examples folders:
34+
from sage.misc.lazy_import import lazy_import as _lazy_import
35+
_lazy_import('sage.manifolds.differentiable.examples.real_line', 'OpenInterval')
36+
_lazy_import('sage.manifolds.differentiable.examples.real_line', 'RealLine')
37+
_lazy_import('sage.manifolds.differentiable.examples.euclidean', 'EuclideanSpace')
38+
3039
def Minkowski(positive_spacelike=True, names=None):
3140
"""
3241
Generate a Minkowski space of dimension 4.
@@ -124,7 +133,7 @@ def Sphere(dim=None, radius=1, names=None, stereo2d=False, stereo_lim=None):
124133
from sage.symbolic.constants import pi
125134
from sage.misc.misc_c import prod
126135
from sage.manifolds.manifold import Manifold
127-
from sage.manifolds.differentiable.euclidean import EuclideanSpace
136+
from sage.manifolds.differentiable.examples.euclidean import EuclideanSpace
128137

129138
if dim is None:
130139
if names is None:
@@ -365,7 +374,7 @@ def Torus(R=2, r=1, names=None):
365374
"""
366375
from sage.functions.trig import cos, sin
367376
from sage.manifolds.manifold import Manifold
368-
from sage.manifolds.differentiable.euclidean import EuclideanSpace
377+
from sage.manifolds.differentiable.examples.euclidean import EuclideanSpace
369378
E = EuclideanSpace(3, symbols='X Y Z')
370379
M = Manifold(2, 'T', ambient=E, structure="Riemannian")
371380
if names is None:

src/sage/manifolds/differentiable/curve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class DifferentiableCurve(DiffMap):
8686
Instead of declaring the parameter `t` as a symbolic variable by means
8787
of ``var('t')``, it is equivalent to get it as the canonical coordinate
8888
of the real number line (see
89-
:class:`~sage.manifolds.differentiable.real_line.RealLine`)::
89+
:class:`~sage.manifolds.differentiable.examples.real_line.RealLine`)::
9090
9191
sage: R.<t> = RealLine()
9292
sage: c = M.curve({X: [sin(t), sin(2*t)/2]}, (t, 0, 2*pi), name='c') ; c

src/sage/manifolds/differentiable/examples/__init__.py

Whitespace-only changes.

src/sage/manifolds/differentiable/euclidean.py renamed to src/sage/manifolds/differentiable/examples/euclidean.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,11 @@ class EuclideanSpace(PseudoRiemannianManifold):
447447
448448
- ``'Cartesian'`` (canonical coordinates on `\RR^n`)
449449
- ``'polar'`` for ``n=2`` only (see
450-
:meth:`~sage.manifolds.differentiable.euclidean.EuclideanPlane.polar_coordinates`)
450+
:meth:`~sage.manifolds.differentiable.examples.euclidean.EuclideanPlane.polar_coordinates`)
451451
- ``'spherical'`` for ``n=3`` only (see
452-
:meth:`~sage.manifolds.differentiable.euclidean.Euclidean3dimSpace.spherical_coordinates`)
452+
:meth:`~sage.manifolds.differentiable.examples.euclidean.Euclidean3dimSpace.spherical_coordinates`)
453453
- ``'cylindrical'`` for ``n=3`` only (see
454-
:meth:`~sage.manifolds.differentiable.euclidean.Euclidean3dimSpace.cylindrical_coordinates`)
454+
:meth:`~sage.manifolds.differentiable.examples.euclidean.Euclidean3dimSpace.cylindrical_coordinates`)
455455
456456
- ``symbols`` -- (default: ``None``) string defining the coordinate
457457
text symbols and LaTeX symbols, with the same conventions as the
@@ -656,12 +656,12 @@ def __classcall_private__(cls, n=None, name=None, latex_name=None,
656656
sage: E2.<x,y> = EuclideanSpace(); E2
657657
Euclidean plane E^2
658658
sage: type(E2)
659-
<class 'sage.manifolds.differentiable.euclidean.EuclideanPlane_with_category'>
659+
<class 'sage.manifolds.differentiable.examples.euclidean.EuclideanPlane_with_category'>
660660
661661
sage: E3.<r,t,p> = EuclideanSpace(coordinates='spherical'); E3
662662
Euclidean space E^3
663663
sage: type(E3)
664-
<class 'sage.manifolds.differentiable.euclidean.Euclidean3dimSpace_with_category'>
664+
<class 'sage.manifolds.differentiable.examples.euclidean.Euclidean3dimSpace_with_category'>
665665
sage: E3.default_frame()._latex_indices
666666
(r, {\theta}, {\phi})
667667
"""
@@ -1589,7 +1589,7 @@ class Euclidean3dimSpace(EuclideanSpace):
15891589
a dynamically generated subclass of it via SageMath's category framework)::
15901590
15911591
sage: type(E)
1592-
<class 'sage.manifolds.differentiable.euclidean.Euclidean3dimSpace_with_category'>
1592+
<class 'sage.manifolds.differentiable.examples.euclidean.Euclidean3dimSpace_with_category'>
15931593
15941594
``E`` is both a real smooth manifold of dimension `3` and a complete metric
15951595
space::

src/sage/manifolds/differentiable/real_line.py renamed to src/sage/manifolds/differentiable/examples/real_line.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ def open_interval(self, lower, upper, name=None, latex_name=None):
636636
637637
OUTPUT:
638638
639-
- :class:`~sage.manifolds.differentiable.real_line.OpenInterval`
639+
- :class:`~sage.manifolds.differentiable.examples.real_line.OpenInterval`
640640
representing the open interval (``lower``, ``upper``)
641641
642642
EXAMPLES:
@@ -738,7 +738,7 @@ class RealLine(OpenInterval):
738738
False
739739
740740
The canonical coordinate is returned by the method
741-
:meth:`~sage.manifolds.differentiable.real_line.OpenInterval.canonical_coordinate`::
741+
:meth:`~sage.manifolds.differentiable.examples.real_line.OpenInterval.canonical_coordinate`::
742742
743743
sage: R.canonical_coordinate()
744744
t
@@ -812,15 +812,15 @@ class RealLine(OpenInterval):
812812
813813
The real line is considered as the open interval `(-\infty, +\infty)`::
814814
815-
sage: isinstance(R, sage.manifolds.differentiable.real_line.OpenInterval)
815+
sage: isinstance(R, sage.manifolds.differentiable.examples.real_line.OpenInterval)
816816
True
817817
sage: R.lower_bound()
818818
-Infinity
819819
sage: R.upper_bound()
820820
+Infinity
821821
822822
A real interval can be created from ``R`` means of the method
823-
:meth:`~sage.manifolds.differentiable.real_line.OpenInterval.open_interval`::
823+
:meth:`~sage.manifolds.differentiable.examples.real_line.OpenInterval.open_interval`::
824824
825825
sage: I = R.open_interval(0, 1); I
826826
Real interval (0, 1)

src/sage/manifolds/differentiable/manifold.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3439,7 +3439,7 @@ def curve(self, coord_expression, param, chart=None,
34393439
for more examples, including plots.
34403440
34413441
"""
3442-
from sage.manifolds.differentiable.real_line import RealLine
3442+
from sage.manifolds.differentiable.examples.real_line import RealLine
34433443
if not isinstance(param, (tuple, list)):
34443444
param = (param, minus_infinity, infinity)
34453445
elif len(param) != 3:
@@ -3560,7 +3560,7 @@ def integrated_curve(self, equations_rhs, velocities, curve_param,
35603560
35613561
"""
35623562

3563-
from sage.manifolds.differentiable.real_line import RealLine
3563+
from sage.manifolds.differentiable.examples.real_line import RealLine
35643564
from sage.manifolds.differentiable.manifold_homset import IntegratedCurveSet
35653565

35663566
if len(curve_param) != 3:
@@ -3695,7 +3695,7 @@ def integrated_autoparallel_curve(self, affine_connection,
36953695
36963696
"""
36973697

3698-
from sage.manifolds.differentiable.real_line import RealLine
3698+
from sage.manifolds.differentiable.examples.real_line import RealLine
36993699
from sage.manifolds.differentiable.manifold_homset import IntegratedAutoparallelCurveSet
37003700

37013701
if len(curve_param) != 3:
@@ -3816,7 +3816,7 @@ def integrated_geodesic(self, metric, curve_param,
38163816
[-1.0907409234671228, 0.6205670379855032]
38173817
38183818
"""
3819-
from sage.manifolds.differentiable.real_line import RealLine
3819+
from sage.manifolds.differentiable.examples.real_line import RealLine
38203820
from sage.manifolds.differentiable.manifold_homset import IntegratedGeodesicSet
38213821

38223822
if len(curve_param) != 3:

0 commit comments

Comments
 (0)