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

Commit 220726c

Browse files
committed
A few minor changes in doctests of Euclidean spaces
1 parent 654b0aa commit 220726c

File tree

6 files changed

+33
-28
lines changed

6 files changed

+33
-28
lines changed

src/sage/manifolds/differentiable/euclidean.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
- :class:`EuclideanPlane` for `n = 2`,
2929
- :class:`Euclidean3dimSpace` for `n = 3`.
3030
31-
The user interface is provided by the generic function :func:`EuclideanSpace`.
31+
The user interface is provided by :class:`EuclideanSpace`.
3232
3333
.. _EuclideanSpace_example1:
3434
@@ -245,7 +245,7 @@
245245
We start by declaring the 3-dimensional Euclidean space ``E``, with
246246
``(x,y,z)`` as Cartesian coordinates::
247247
248-
sage: E.<x,y,z> = EuclideanSpace(3)
248+
sage: E.<x,y,z> = EuclideanSpace()
249249
sage: E
250250
Euclidean space E^3
251251
@@ -460,7 +460,10 @@ class EuclideanSpace(PseudoRiemannianManifold):
460460
461461
sage: E.<x,y> = EuclideanSpace()
462462
463-
The coordinate symbols can be customized::
463+
Note that providing the dimension as an argument of ``EuclideanSpace`` is
464+
not necessary in that case, since it can be deduced from the number of
465+
coordinates within ``<,>``. Besides, the coordinate symbols can be
466+
customized::
464467
465468
sage: E.<X,Y> = EuclideanSpace()
466469
sage: E.cartesian_coordinates()
@@ -585,12 +588,12 @@ def __classcall_private__(cls, n=None, name=None, latex_name=None,
585588
sage: type(E2)
586589
<class 'sage.manifolds.differentiable.euclidean.EuclideanPlane_with_category'>
587590
588-
sage: E3.<x,t,p> = EuclideanSpace(coordinates='spherical'); E3
591+
sage: E3.<r,t,p> = EuclideanSpace(coordinates='spherical'); E3
589592
Euclidean space E^3
590593
sage: type(E3)
591594
<class 'sage.manifolds.differentiable.euclidean.Euclidean3dimSpace_with_category'>
592595
sage: E3.default_frame()._latex_indices
593-
(x, {\theta}, {\phi})
596+
(r, {\theta}, {\phi})
594597
"""
595598
if n is None:
596599
if names is None:
@@ -754,16 +757,16 @@ def _first_ngens(self, n):
754757
755758
This is useful only for the use of Sage preparser::
756759
757-
sage: preparse("E.<x,y,z> = EuclideanSpace(3)")
758-
"E = EuclideanSpace(Integer(3), names=('x', 'y', 'z',));
760+
sage: preparse("E.<x,y,z> = EuclideanSpace()")
761+
"E = EuclideanSpace(names=('x', 'y', 'z',));
759762
(x, y, z,) = E._first_ngens(3)"
760763
761764
TESTS::
762765
763766
sage: E = EuclideanSpace(2)
764767
sage: E._first_ngens(2)
765768
(x, y)
766-
sage: E.<u,v> = EuclideanSpace(2)
769+
sage: E.<u,v> = EuclideanSpace()
767770
sage: E._first_ngens(2)
768771
(u, v)
769772
@@ -919,7 +922,7 @@ def vector_field(self, *args, **kwargs):
919922
920923
A vector field in the Euclidean plane::
921924
922-
sage: E.<x,y> = EuclideanSpace(2)
925+
sage: E.<x,y> = EuclideanSpace()
923926
sage: v = E.vector_field(x*y, x+y)
924927
sage: v.display()
925928
x*y e_x + (x + y) e_y
@@ -1457,7 +1460,7 @@ def polar_coordinates(self, symbols=None, names=None):
14571460
sage: E.coord_change(E.cartesian_coordinates(),
14581461
....: E.polar_coordinates()).display()
14591462
r = sqrt(x^2 + y^2)
1460-
ph = arctan(y/x)
1463+
ph = arctan2(y, x)
14611464
14621465
The coordinate variables are returned by the square bracket operator::
14631466
@@ -2199,7 +2202,7 @@ def spherical_coordinates(self, symbols=None, names=None):
21992202
....: E.spherical_coordinates()).display()
22002203
r = sqrt(x^2 + y^2 + z^2)
22012204
th = arctan2(sqrt(x^2 + y^2), z)
2202-
ph = arctan(y/x)
2205+
ph = arctan2(y, x)
22032206
22042207
The coordinate variables are returned by the square bracket operator::
22052208
@@ -2347,7 +2350,7 @@ def cylindrical_coordinates(self, symbols=None, names=None):
23472350
sage: E.coord_change(E.cartesian_coordinates(),
23482351
....: E.cylindrical_coordinates()).display()
23492352
rh = sqrt(x^2 + y^2)
2350-
ph = arctan(y/x)
2353+
ph = arctan2(y, x)
23512354
z = z
23522355
23532356
The coordinate variables are returned by the square bracket operator::
@@ -2484,7 +2487,7 @@ def scalar_triple_product(self, name=None, latex_name=None):
24842487
24852488
EXAMPLES::
24862489
2487-
sage: E.<x,y,z> = EuclideanSpace(3)
2490+
sage: E.<x,y,z> = EuclideanSpace()
24882491
sage: triple_product = E.scalar_triple_product()
24892492
sage: triple_product
24902493
3-form epsilon on the Euclidean space E^3

src/sage/manifolds/differentiable/scalarfield.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,7 @@ def gradient(self, metric=None):
10931093
10941094
Gradient of a scalar field in the Euclidean plane::
10951095
1096-
sage: M.<x,y> = EuclideanSpace(2)
1096+
sage: M.<x,y> = EuclideanSpace()
10971097
sage: f = M.scalar_field(cos(x*y), name='f')
10981098
sage: v = f.gradient(); v
10991099
Vector field grad(f) on the Euclidean plane E^2
@@ -1104,7 +1104,7 @@ def gradient(self, metric=None):
11041104
11051105
Gradient in polar coordinates::
11061106
1107-
sage: M.<r,phi> = EuclideanSpace(2, coordinates='polar')
1107+
sage: M.<r,phi> = EuclideanSpace(coordinates='polar')
11081108
sage: f = M.scalar_field(r*cos(phi), name='f')
11091109
sage: f.gradient().display()
11101110
grad(f) = cos(phi) e_r - sin(phi) e_phi
@@ -1191,7 +1191,7 @@ def laplacian(self, metric=None):
11911191
11921192
Laplacian of a scalar field on the Euclidean plane::
11931193
1194-
sage: M.<x,y> = EuclideanSpace(2)
1194+
sage: M.<x,y> = EuclideanSpace()
11951195
sage: f = M.scalar_field(function('F')(x,y), name='f')
11961196
sage: s = f.laplacian(); s
11971197
Scalar field Delta(f) on the Euclidean plane E^2

src/sage/manifolds/differentiable/tensorfield.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3427,7 +3427,7 @@ def divergence(self, metric=None):
34273427
34283428
Divergence of a vector field in the Euclidean plane::
34293429
3430-
sage: M.<x,y> = EuclideanSpace(2)
3430+
sage: M.<x,y> = EuclideanSpace()
34313431
sage: v = M.vector_field(x, y, name='v')
34323432
sage: s = v.divergence(); s
34333433
Scalar field div(v) on the Euclidean plane E^2
@@ -3559,7 +3559,7 @@ def laplacian(self, metric=None):
35593559
35603560
Laplacian of a vector field in the Euclidean plane::
35613561
3562-
sage: M.<x,y> = EuclideanSpace(2)
3562+
sage: M.<x,y> = EuclideanSpace()
35633563
sage: v = M.vector_field(x^3 + y^2, x*y, name='v')
35643564
sage: Dv = v.laplacian(); Dv
35653565
Vector field Delta(v) on the Euclidean plane E^2

src/sage/manifolds/differentiable/vectorfield.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ def curl(self, metric=None):
10111011
10121012
Curl of a vector field in the Euclidean 3-space::
10131013
1014-
sage: M.<x,y,z> = EuclideanSpace(3)
1014+
sage: M.<x,y,z> = EuclideanSpace()
10151015
sage: v = M.vector_field(-y, x, 0, name='v')
10161016
sage: v.display()
10171017
v = -y e_x + x e_y
@@ -1102,7 +1102,7 @@ def dot_product(self, other, metric=None):
11021102
11031103
Scalar product in the Euclidean plane::
11041104
1105-
sage: M.<x,y> = EuclideanSpace(2)
1105+
sage: M.<x,y> = EuclideanSpace()
11061106
sage: u = M.vector_field(x, y, name='u')
11071107
sage: v = M.vector_field(y, x, name='v')
11081108
sage: s = u.dot_product(v); s
@@ -1188,7 +1188,7 @@ def norm(self, metric=None):
11881188
11891189
Norm in the Euclidean plane::
11901190
1191-
sage: M.<x,y> = EuclideanSpace(2)
1191+
sage: M.<x,y> = EuclideanSpace()
11921192
sage: v = M.vector_field(-y, x, name='v')
11931193
sage: s = v.norm(); s
11941194
Scalar field |v| on the Euclidean plane E^2
@@ -1276,7 +1276,7 @@ def cross_product(self, other, metric=None):
12761276
12771277
Cross product in the Euclidean 3-space::
12781278
1279-
sage: M.<x,y,z> = EuclideanSpace(3)
1279+
sage: M.<x,y,z> = EuclideanSpace()
12801280
sage: u = M.vector_field(-y, x, 0, name='u')
12811281
sage: v = M.vector_field(x, y, 0, name='v')
12821282
sage: w = u.cross_product(v); w

src/sage/manifolds/differentiable/vectorfield_module.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,8 +1362,10 @@ def __init__(self, domain, dest_map=None):
13621362
self._induced_bases = {}
13631363
if self._dest_map != self._domain.identity_map():
13641364
for frame in self._ambient_domain._top_frames:
1365-
basis = self.basis(from_frame=frame)
1366-
self._induced_bases[frame] = basis
1365+
if (frame.destination_map() ==
1366+
self._ambient_domain.identity_map()):
1367+
basis = self.basis(from_frame=frame)
1368+
self._induced_bases[frame] = basis
13671369

13681370
# Initialization of the components of the zero element:
13691371
zero = self.zero()

src/sage/manifolds/operators.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def grad(scalar):
7878
7979
Gradient of a scalar field in the Euclidean plane::
8080
81-
sage: E.<x,y> = EuclideanSpace(2)
81+
sage: E.<x,y> = EuclideanSpace()
8282
sage: f = E.scalar_field(sin(x*y), name='f')
8383
sage: from sage.manifolds.operators import grad
8484
sage: grad(f)
@@ -149,7 +149,7 @@ def div(tensor):
149149
150150
Divergence of a vector field in the Euclidean plane::
151151
152-
sage: E.<x,y> = EuclideanSpace(2)
152+
sage: E.<x,y> = EuclideanSpace()
153153
sage: v = E.vector_field(cos(x*y), sin(x*y), name='v')
154154
sage: v.display()
155155
v = cos(x*y) e_x + sin(x*y) e_y
@@ -218,7 +218,7 @@ def curl(vector):
218218
219219
Curl of a vector field in the Euclidean 3-space::
220220
221-
sage: E.<x,y,z> = EuclideanSpace(3)
221+
sage: E.<x,y,z> = EuclideanSpace()
222222
sage: v = E.vector_field(sin(y), sin(x), 0, name='v')
223223
sage: v.display()
224224
v = sin(y) e_x + sin(x) e_y
@@ -271,7 +271,7 @@ def laplacian(field):
271271
272272
Laplacian of a scalar field on the Euclidean plane::
273273
274-
sage: E.<x,y> = EuclideanSpace(2)
274+
sage: E.<x,y> = EuclideanSpace()
275275
sage: f = E.scalar_field(sin(x*y), name='f')
276276
sage: from sage.manifolds.operators import laplacian
277277
sage: Df = laplacian(f); Df

0 commit comments

Comments
 (0)