Skip to content

Commit

Permalink
gh-37829: src/sage/manifolds/differentiable: Docstring/doctest edits
Browse files Browse the repository at this point in the history
    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes #12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes #12345". -->

Small markup/formatting improvements.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [ ] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - #12345: short description why this is a dependency -->
<!-- - #34567: ... -->
    
URL: #37829
Reported by: Matthias Köppe
Reviewer(s): Eric Gourgoulhon
  • Loading branch information
Release Manager committed May 1, 2024
2 parents db630cd + 214b988 commit 5ab5dc3
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 67 deletions.
8 changes: 4 additions & 4 deletions src/sage/manifolds/differentiable/affine_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ class AffineConnection(SageObject):
Unset components are initialized to zero::
sage: nab[:] # list of coefficients relative to the manifold's default vector frame
sage: nab[:] # list of coefficients relative to the manifold's default vector frame
[[[0, x^2, 0], [0, 0, 0], [0, 0, 0]],
[[0, 0, 0], [0, 0, 0], [0, 0, 0]],
[[0, 0, 0], [0, 0, y*z], [0, 0, 0]]]
[[0, 0, 0], [0, 0, 0], [0, 0, 0]],
[[0, 0, 0], [0, 0, y*z], [0, 0, 0]]]
The treatment of connection coefficients in a given vector frame is similar
to that of tensor components; see therefore the class
Expand Down Expand Up @@ -2377,7 +2377,7 @@ def curvature_form(self, i, j, frame=None):
2-form curvature (1,1) of connection nabla w.r.t. Vector frame
(M, (e_1,e_2,e_3)) on the 3-dimensional differentiable manifold M
sage: nab.curvature_form(1,1,e).display(e) # long time (if above is skipped)
curvature (1,1) of connection nabla w.r.t. Vector frame
curvature (1,1) of connection nabla w.r.t. Vector frame
(M, (e_1,e_2,e_3)) =
(y^3*z^4 + 2*x*y*z + (x*y^4 - x*y)*z^2) e^1∧e^2
+ (x^4*y*z^2 - x^2*y^2) e^1∧e^3 + (x^5*y*z^3 - x*z^2) e^2∧e^3
Expand Down
58 changes: 29 additions & 29 deletions src/sage/manifolds/differentiable/bundle_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ class BundleConnection(SageObject, Mutability):
sage: nab[e, 1, 1][:] = [x+z, y-z, x*y*z]
sage: nab.display()
connection (1,1) of bundle connection nabla w.r.t. Local frame
(E|_M, (e_1,e_2)) = (x + z) dx + (y - z) dy + x*y*z dz
connection (1,2) of bundle connection nabla w.r.t. Local frame
(E|_M, (e_1,e_2)) = x*z dx + y*z dy + z^2 dz
connection (2,1) of bundle connection nabla w.r.t. Local frame
(E|_M, (e_1,e_2)) = x dx + x^2 dy + x^3 dz
(E|_M, (e_1,e_2)) = (x + z) dx + (y - z) dy + x*y*z dz
connection (1,2) of bundle connection nabla w.r.t. Local frame
(E|_M, (e_1,e_2)) = x*z dx + y*z dy + z^2 dz
connection (2,1) of bundle connection nabla w.r.t. Local frame
(E|_M, (e_1,e_2)) = x dx + x^2 dy + x^3 dz
Notice, when we omit the frame, the default frame of the vector bundle is
assumed (in this case ``e``)::
Expand Down Expand Up @@ -189,14 +189,14 @@ class BundleConnection(SageObject, Mutability):
sage: nab.display(frame=f)
connection (1,1) of bundle connection nabla w.r.t. Local frame
(E|_M, (f_1,f_2)) = ((x^3 + x)*z + 2*x)/(x^2 + 1) dx + y*z dy + z^2 dz
connection (1,2) of bundle connection nabla w.r.t. Local frame
(E|_M, (f_1,f_2)) = -(x^3 + x)*z dx - (x^2 + 1)*y*z dy -
connection (1,2) of bundle connection nabla w.r.t. Local frame
(E|_M, (f_1,f_2)) = -(x^3 + x)*z dx - (x^2 + 1)*y*z dy -
(x^2 + 1)*z^2 dz
connection (2,1) of bundle connection nabla w.r.t. Local frame
(E|_M, (f_1,f_2)) = (x*z - x)/(x^2 + 1) dx -
connection (2,1) of bundle connection nabla w.r.t. Local frame
(E|_M, (f_1,f_2)) = (x*z - x)/(x^2 + 1) dx -
(x^2 - y*z)/(x^2 + 1) dy - (x^3 - z^2)/(x^2 + 1) dz
connection (2,2) of bundle connection nabla w.r.t. Local frame
(E|_M, (f_1,f_2)) = -x*z dx - y*z dy - z^2 dz
connection (2,2) of bundle connection nabla w.r.t. Local frame
(E|_M, (f_1,f_2)) = -x*z dx - y*z dy - z^2 dz
The new connection 1-forms obey the defining formula, too::
Expand All @@ -214,14 +214,14 @@ class BundleConnection(SageObject, Mutability):
....: print(Omega(i ,j, e).display())
curvature (1,1) of bundle connection nabla w.r.t. Local frame
(E|_M, (e_1,e_2)) = -(x^3 - x*y)*z dx∧dy + (-x^4*z + x*z^2) dx∧dz +
(-x^3*y*z + x^2*z^2) dy∧dz
curvature (1,2) of bundle connection nabla w.r.t. Local frame
(-x^3*y*z + x^2*z^2) dy∧dz
curvature (1,2) of bundle connection nabla w.r.t. Local frame
(E|_M, (e_1,e_2)) = -x dx∧dz - y dy∧dz
curvature (2,1) of bundle connection nabla w.r.t. Local frame
curvature (2,1) of bundle connection nabla w.r.t. Local frame
(E|_M, (e_1,e_2)) = 2*x dx∧dy + 3*x^2 dx∧dz
curvature (2,2) of bundle connection nabla w.r.t. Local frame
curvature (2,2) of bundle connection nabla w.r.t. Local frame
(E|_M, (e_1,e_2)) = (x^3 - x*y)*z dx∧dy + (x^4*z - x*z^2) dx∧dz +
(x^3*y*z - x^2*z^2) dy∧dz
(x^3*y*z - x^2*z^2) dy∧dz
The derived forms certainly obey the structure equations, see
:meth:`curvature_form` for details::
Expand Down Expand Up @@ -483,17 +483,17 @@ def _new_forms(self, frame):
sage: forms = nab._new_forms(e)
sage: [forms[k] for k in sorted(forms)]
[1-form connection (1,1) of bundle connection nabla w.r.t. Local
frame (E|_M, (e_1,e_2)) on the 2-dimensional differentiable
manifold M,
1-form connection (1,2) of bundle connection nabla w.r.t. Local
frame (E|_M, (e_1,e_2)) on the 2-dimensional differentiable
manifold M,
1-form connection (2,1) of bundle connection nabla w.r.t. Local
frame (E|_M, (e_1,e_2)) on the 2-dimensional differentiable
manifold M,
1-form connection (2,2) of bundle connection nabla w.r.t. Local
frame (E|_M, (e_1,e_2)) on the 2-dimensional differentiable
manifold M]
frame (E|_M, (e_1,e_2)) on the 2-dimensional differentiable
manifold M,
1-form connection (1,2) of bundle connection nabla w.r.t. Local
frame (E|_M, (e_1,e_2)) on the 2-dimensional differentiable
manifold M,
1-form connection (2,1) of bundle connection nabla w.r.t. Local
frame (E|_M, (e_1,e_2)) on the 2-dimensional differentiable
manifold M,
1-form connection (2,2) of bundle connection nabla w.r.t. Local
frame (E|_M, (e_1,e_2)) on the 2-dimensional differentiable
manifold M]
"""
dom = frame._domain
Expand Down Expand Up @@ -1307,8 +1307,8 @@ def display(self, frame=None, vector_frame=None, chart=None,
sage: nab.display()
connection (1,1) of bundle connection nabla w.r.t. Local frame
(E|_M, (e_1,e_2)) = x dx + y dy + z dz
connection (2,2) of bundle connection nabla w.r.t. Local frame
(E|_M, (e_1,e_2)) = x^2 dx + y^2 dy + z^2 dz
connection (2,2) of bundle connection nabla w.r.t. Local frame
(E|_M, (e_1,e_2)) = x^2 dx + y^2 dy + z^2 dz
sage: latex(nab.display())
\begin{array}{lcl} \omega^1_{\ \, 1} = x \mathrm{d} x +
y \mathrm{d} y + z \mathrm{d} z \\ \omega^2_{\ \, 2} = x^{2}
Expand Down
18 changes: 9 additions & 9 deletions src/sage/manifolds/differentiable/differentiable_submanifold.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ class DifferentiableSubmanifold(DifferentiableManifold, TopologicalSubmanifold):
- ``field`` -- field `K` on which the sub manifold is defined; allowed
values are
- ``'real'`` or an object of type ``RealField`` (e.g., ``RR``) for
a manifold over `\RR`
- ``'complex'`` or an object of type ``ComplexField`` (e.g., ``CC``)
for a manifold over `\CC`
- an object in the category of topological fields (see
:class:`~sage.categories.fields.Fields` and
:class:`~sage.categories.topological_spaces.TopologicalSpaces`)
for other types of manifolds
- ``'real'`` or an object of type ``RealField`` (e.g., ``RR``) for
a manifold over `\RR`
- ``'complex'`` or an object of type ``ComplexField`` (e.g., ``CC``)
for a manifold over `\CC`
- an object in the category of topological fields (see
:class:`~sage.categories.fields.Fields` and
:class:`~sage.categories.topological_spaces.TopologicalSpaces`)
for other types of manifolds
- ``structure`` -- manifold structure (see
:class:`~sage.manifolds.structure.TopologicalStructure` or
Expand Down Expand Up @@ -136,7 +136,7 @@ class DifferentiableSubmanifold(DifferentiableManifold, TopologicalSubmanifold):
sage: phi_inv_t = M.scalar_field({CM: z-x^2-y^2})
sage: phi_inv_t.display()
M → ℝ
(x, y, z) ↦ -x^2 - y^2 + z
(x, y, z) ↦ -x^2 - y^2 + z
`\phi` can then be declared as an embedding `N\to M`::
Expand Down
3 changes: 1 addition & 2 deletions src/sage/manifolds/differentiable/multivectorfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,7 @@ def wedge(self, other):
sage: b.display()
b = y^2 ∂/∂x∧∂/∂y + (x + z) ∂/∂x∧∂/∂z + z^2 ∂/∂y∧∂/∂z
sage: s = a.wedge(b); s
3-vector field a∧b on the 3-dimensional differentiable
manifold M
3-vector field a∧b on the 3-dimensional differentiable manifold M
sage: s.display()
a∧b = (-x^2 + (y^3 - x - 1)*z + 2*z^2 - x) ∂/∂x∧∂/∂y∧∂/∂z
Expand Down
35 changes: 20 additions & 15 deletions src/sage/manifolds/differentiable/tangent_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,28 +177,32 @@ class TangentSpace(FiniteRankFreeModule):
[0 1]
sage: W_Tp_xy = VectorSpace(SR, 2, inner_product_matrix=Q_Tp_xy)
sage: Tp.bases()[0]
Basis (∂/∂x,∂/∂y) on the Tangent space at Point p on the 2-dimensional differentiable manifold M
sage: phi_Tp_xy = Tp.isomorphism_with_fixed_basis(Tp.bases()[0], codomain=W_Tp_xy); phi_Tp_xy
Basis (∂/∂x,∂/∂y) on the Tangent space at Point p on the
2-dimensional differentiable manifold M
sage: phi_Tp_xy = Tp.isomorphism_with_fixed_basis(Tp.bases()[0], codomain=W_Tp_xy)
sage: phi_Tp_xy
Generic morphism:
From: Tangent space at Point p on the 2-dimensional differentiable manifold M
To: Ambient quadratic space of dimension 2 over Symbolic Ring
Inner product matrix:
[1 0]
[0 1]
From: Tangent space at Point p on the 2-dimensional differentiable manifold M
To: Ambient quadratic space of dimension 2 over Symbolic Ring
Inner product matrix:
[1 0]
[0 1]
sage: Q_Tp_uv = g[c_uv.frame(),:](*p.coordinates(c_uv)); Q_Tp_uv
[1/2 0]
[ 0 1/2]
sage: W_Tp_uv = VectorSpace(SR, 2, inner_product_matrix=Q_Tp_uv)
sage: Tp.bases()[1]
Basis (∂/∂u,∂/∂v) on the Tangent space at Point p on the 2-dimensional differentiable manifold M
sage: phi_Tp_uv = Tp.isomorphism_with_fixed_basis(Tp.bases()[1], codomain=W_Tp_uv); phi_Tp_uv
Basis (∂/∂u,∂/∂v) on the Tangent space at Point p on the
2-dimensional differentiable manifold M
sage: phi_Tp_uv = Tp.isomorphism_with_fixed_basis(Tp.bases()[1], codomain=W_Tp_uv)
sage: phi_Tp_uv
Generic morphism:
From: Tangent space at Point p on the 2-dimensional differentiable manifold M
To: Ambient quadratic space of dimension 2 over Symbolic Ring
Inner product matrix:
[1/2 0]
[ 0 1/2]
From: Tangent space at Point p on the 2-dimensional differentiable manifold M
To: Ambient quadratic space of dimension 2 over Symbolic Ring
Inner product matrix:
[1/2 0]
[ 0 1/2]
sage: t1, t2 = Tp.tensor((1,0)), Tp.tensor((1,0))
sage: t1[:] = (8, 15)
Expand All @@ -211,7 +215,8 @@ class TangentSpace(FiniteRankFreeModule):
541
sage: Tp_xy_to_uv = M.change_of_frame(c_xy.frame(), c_uv.frame()).at(p); Tp_xy_to_uv
Automorphism of the Tangent space at Point p on the 2-dimensional differentiable manifold M
Automorphism of the Tangent space at Point p on the
2-dimensional differentiable manifold M
sage: Tp.set_change_of_basis(Tp.bases()[0], Tp.bases()[1], Tp_xy_to_uv)
sage: t1[Tp.bases()[1],:]
[23, -7]
Expand Down
16 changes: 8 additions & 8 deletions src/sage/manifolds/differentiable/vector_bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ def set_change_of_frame(self, frame1, frame2, change_of_frame,
:class:`~sage.tensor.modules.free_module_automorphism.FreeModuleAutomorphism`
describing the automorphism `P` that relates the basis `(e_i)` to
the basis `(f_i)` according to `f_i = P(e_i)`
- ``compute_inverse`` (default: True) -- if set to True, the inverse
- ``compute_inverse`` (default: ``True``) -- if set to ``True``, the inverse
automorphism is computed and the change from basis `(f_i)` to `(e_i)`
is set to it in the internal dictionary ``self._frame_changes``
Expand Down Expand Up @@ -1476,7 +1476,7 @@ def ambient_domain(self):
sage: Phi.display()
Phi: R → M
t ↦ (x, y) = (cos(t), sin(t))
sage: PhiT11 = R.tensor_bundle(1, 1, dest_map=Phi)
sage: PhiT11 = R.tensor_bundle(1, 1, dest_map=Phi)
sage: PhiT11.ambient_domain()
2-dimensional differentiable manifold M
Expand Down Expand Up @@ -1724,24 +1724,24 @@ def orientation(self):
[]
sage: T11.set_orientation([c_xy.frame(), c_uv.frame()])
sage: T11.orientation()
[Coordinate frame (U, (∂/∂x,∂/∂y)), Coordinate frame
(V, (∂/∂u,∂/∂v))]
[Coordinate frame (U, (∂/∂x,∂/∂y)),
Coordinate frame (V, (∂/∂u,∂/∂v))]
If the destination map is the identity, the orientation is
automatically set for the manifold, too::
sage: M.orientation()
[Coordinate frame (U, (∂/∂x,∂/∂y)), Coordinate frame
(V, (∂/∂u,∂/∂v))]
[Coordinate frame (U, (∂/∂x,∂/∂y)),
Coordinate frame (V, (∂/∂u,∂/∂v))]
Conversely, if one sets an orientation on the manifold,
the orientation on its tensor bundles is set accordingly::
sage: c_tz.<t,z> = U.chart()
sage: M.set_orientation([c_tz, c_uv])
sage: T11.orientation()
[Coordinate frame (U, (∂/∂t,∂/∂z)), Coordinate frame
(V, (∂/∂u,∂/∂v))]
[Coordinate frame (U, (∂/∂t,∂/∂z)),
Coordinate frame (V, (∂/∂u,∂/∂v))]
"""
if self._dest_map.is_identity():
Expand Down

0 comments on commit 5ab5dc3

Please sign in to comment.