passagemath-symbolics 10.8.1a1__cp311-cp311-macosx_13_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. passagemath_symbolics/.dylibs/libgmp.10.dylib +0 -0
  2. passagemath_symbolics/__init__.py +3 -0
  3. passagemath_symbolics-10.8.1a1.dist-info/METADATA +186 -0
  4. passagemath_symbolics-10.8.1a1.dist-info/RECORD +182 -0
  5. passagemath_symbolics-10.8.1a1.dist-info/WHEEL +6 -0
  6. passagemath_symbolics-10.8.1a1.dist-info/top_level.txt +3 -0
  7. sage/all__sagemath_symbolics.py +17 -0
  8. sage/calculus/all.py +14 -0
  9. sage/calculus/calculus.py +2838 -0
  10. sage/calculus/desolvers.py +1864 -0
  11. sage/calculus/predefined.py +51 -0
  12. sage/calculus/tests.py +225 -0
  13. sage/calculus/var.cpython-311-darwin.so +0 -0
  14. sage/calculus/var.pyx +401 -0
  15. sage/dynamics/all__sagemath_symbolics.py +6 -0
  16. sage/dynamics/complex_dynamics/all.py +5 -0
  17. sage/dynamics/complex_dynamics/mandel_julia.py +765 -0
  18. sage/dynamics/complex_dynamics/mandel_julia_helper.cpython-311-darwin.so +0 -0
  19. sage/dynamics/complex_dynamics/mandel_julia_helper.pyx +1034 -0
  20. sage/ext/all__sagemath_symbolics.py +1 -0
  21. sage/ext_data/kenzo/CP2.txt +45 -0
  22. sage/ext_data/kenzo/CP3.txt +349 -0
  23. sage/ext_data/kenzo/CP4.txt +4774 -0
  24. sage/ext_data/kenzo/README.txt +49 -0
  25. sage/ext_data/kenzo/S4.txt +20 -0
  26. sage/ext_data/magma/latex/latex.m +1021 -0
  27. sage/ext_data/magma/latex/latex.spec +1 -0
  28. sage/ext_data/magma/sage/basic.m +356 -0
  29. sage/ext_data/magma/sage/sage.spec +1 -0
  30. sage/ext_data/magma/spec +9 -0
  31. sage/geometry/all__sagemath_symbolics.py +8 -0
  32. sage/geometry/hyperbolic_space/all.py +5 -0
  33. sage/geometry/hyperbolic_space/hyperbolic_coercion.py +755 -0
  34. sage/geometry/hyperbolic_space/hyperbolic_constants.py +5 -0
  35. sage/geometry/hyperbolic_space/hyperbolic_geodesic.py +2419 -0
  36. sage/geometry/hyperbolic_space/hyperbolic_interface.py +206 -0
  37. sage/geometry/hyperbolic_space/hyperbolic_isometry.py +1083 -0
  38. sage/geometry/hyperbolic_space/hyperbolic_model.py +1502 -0
  39. sage/geometry/hyperbolic_space/hyperbolic_point.py +621 -0
  40. sage/geometry/riemannian_manifolds/all.py +7 -0
  41. sage/geometry/riemannian_manifolds/parametrized_surface3d.py +1632 -0
  42. sage/geometry/riemannian_manifolds/surface3d_generators.py +461 -0
  43. sage/interfaces/all__sagemath_symbolics.py +1 -0
  44. sage/interfaces/magma.py +2991 -0
  45. sage/interfaces/magma_free.py +90 -0
  46. sage/interfaces/maple.py +1402 -0
  47. sage/interfaces/mathematica.py +1345 -0
  48. sage/interfaces/mathics.py +1312 -0
  49. sage/interfaces/sympy.py +1398 -0
  50. sage/interfaces/sympy_wrapper.py +197 -0
  51. sage/interfaces/tides.py +938 -0
  52. sage/libs/all__sagemath_symbolics.py +6 -0
  53. sage/manifolds/all.py +7 -0
  54. sage/manifolds/calculus_method.py +553 -0
  55. sage/manifolds/catalog.py +437 -0
  56. sage/manifolds/chart.py +4010 -0
  57. sage/manifolds/chart_func.py +3416 -0
  58. sage/manifolds/continuous_map.py +2183 -0
  59. sage/manifolds/continuous_map_image.py +155 -0
  60. sage/manifolds/differentiable/affine_connection.py +2475 -0
  61. sage/manifolds/differentiable/all.py +1 -0
  62. sage/manifolds/differentiable/automorphismfield.py +1383 -0
  63. sage/manifolds/differentiable/automorphismfield_group.py +604 -0
  64. sage/manifolds/differentiable/bundle_connection.py +1445 -0
  65. sage/manifolds/differentiable/characteristic_cohomology_class.py +1840 -0
  66. sage/manifolds/differentiable/chart.py +1241 -0
  67. sage/manifolds/differentiable/curve.py +1028 -0
  68. sage/manifolds/differentiable/de_rham_cohomology.py +541 -0
  69. sage/manifolds/differentiable/degenerate.py +559 -0
  70. sage/manifolds/differentiable/degenerate_submanifold.py +1668 -0
  71. sage/manifolds/differentiable/diff_form.py +1660 -0
  72. sage/manifolds/differentiable/diff_form_module.py +1062 -0
  73. sage/manifolds/differentiable/diff_map.py +1315 -0
  74. sage/manifolds/differentiable/differentiable_submanifold.py +291 -0
  75. sage/manifolds/differentiable/examples/all.py +1 -0
  76. sage/manifolds/differentiable/examples/euclidean.py +2517 -0
  77. sage/manifolds/differentiable/examples/real_line.py +897 -0
  78. sage/manifolds/differentiable/examples/sphere.py +1186 -0
  79. sage/manifolds/differentiable/examples/symplectic_space.py +187 -0
  80. sage/manifolds/differentiable/examples/symplectic_space_test.py +40 -0
  81. sage/manifolds/differentiable/integrated_curve.py +4035 -0
  82. sage/manifolds/differentiable/levi_civita_connection.py +841 -0
  83. sage/manifolds/differentiable/manifold.py +4254 -0
  84. sage/manifolds/differentiable/manifold_homset.py +1826 -0
  85. sage/manifolds/differentiable/metric.py +3032 -0
  86. sage/manifolds/differentiable/mixed_form.py +1507 -0
  87. sage/manifolds/differentiable/mixed_form_algebra.py +559 -0
  88. sage/manifolds/differentiable/multivector_module.py +800 -0
  89. sage/manifolds/differentiable/multivectorfield.py +1522 -0
  90. sage/manifolds/differentiable/poisson_tensor.py +268 -0
  91. sage/manifolds/differentiable/pseudo_riemannian.py +755 -0
  92. sage/manifolds/differentiable/pseudo_riemannian_submanifold.py +1839 -0
  93. sage/manifolds/differentiable/scalarfield.py +1343 -0
  94. sage/manifolds/differentiable/scalarfield_algebra.py +472 -0
  95. sage/manifolds/differentiable/symplectic_form.py +912 -0
  96. sage/manifolds/differentiable/symplectic_form_test.py +220 -0
  97. sage/manifolds/differentiable/tangent_space.py +412 -0
  98. sage/manifolds/differentiable/tangent_vector.py +616 -0
  99. sage/manifolds/differentiable/tensorfield.py +4665 -0
  100. sage/manifolds/differentiable/tensorfield_module.py +963 -0
  101. sage/manifolds/differentiable/tensorfield_paral.py +2450 -0
  102. sage/manifolds/differentiable/tensorfield_paral_test.py +16 -0
  103. sage/manifolds/differentiable/vector_bundle.py +1725 -0
  104. sage/manifolds/differentiable/vectorfield.py +1717 -0
  105. sage/manifolds/differentiable/vectorfield_module.py +2445 -0
  106. sage/manifolds/differentiable/vectorframe.py +1832 -0
  107. sage/manifolds/family.py +270 -0
  108. sage/manifolds/local_frame.py +1490 -0
  109. sage/manifolds/manifold.py +3090 -0
  110. sage/manifolds/manifold_homset.py +452 -0
  111. sage/manifolds/operators.py +359 -0
  112. sage/manifolds/point.py +994 -0
  113. sage/manifolds/scalarfield.py +3718 -0
  114. sage/manifolds/scalarfield_algebra.py +629 -0
  115. sage/manifolds/section.py +3111 -0
  116. sage/manifolds/section_module.py +831 -0
  117. sage/manifolds/structure.py +229 -0
  118. sage/manifolds/subset.py +2721 -0
  119. sage/manifolds/subsets/all.py +1 -0
  120. sage/manifolds/subsets/closure.py +131 -0
  121. sage/manifolds/subsets/pullback.py +883 -0
  122. sage/manifolds/topological_submanifold.py +891 -0
  123. sage/manifolds/trivialization.py +733 -0
  124. sage/manifolds/utilities.py +1348 -0
  125. sage/manifolds/vector_bundle.py +1347 -0
  126. sage/manifolds/vector_bundle_fiber.py +332 -0
  127. sage/manifolds/vector_bundle_fiber_element.py +111 -0
  128. sage/matrix/all__sagemath_symbolics.py +1 -0
  129. sage/matrix/matrix_symbolic_dense.cpython-311-darwin.so +0 -0
  130. sage/matrix/matrix_symbolic_dense.pxd +6 -0
  131. sage/matrix/matrix_symbolic_dense.pyx +1030 -0
  132. sage/matrix/matrix_symbolic_sparse.cpython-311-darwin.so +0 -0
  133. sage/matrix/matrix_symbolic_sparse.pxd +6 -0
  134. sage/matrix/matrix_symbolic_sparse.pyx +1038 -0
  135. sage/modules/all__sagemath_symbolics.py +1 -0
  136. sage/modules/vector_callable_symbolic_dense.py +105 -0
  137. sage/modules/vector_symbolic_dense.py +116 -0
  138. sage/modules/vector_symbolic_sparse.py +118 -0
  139. sage/rings/all__sagemath_symbolics.py +4 -0
  140. sage/rings/asymptotic/all.py +6 -0
  141. sage/rings/asymptotic/asymptotic_expansion_generators.py +1485 -0
  142. sage/rings/asymptotic/asymptotic_ring.py +4858 -0
  143. sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py +4106 -0
  144. sage/rings/asymptotic/growth_group.py +5373 -0
  145. sage/rings/asymptotic/growth_group_cartesian.py +1400 -0
  146. sage/rings/asymptotic/term_monoid.py +5205 -0
  147. sage/rings/function_field/all__sagemath_symbolics.py +2 -0
  148. sage/rings/polynomial/all__sagemath_symbolics.py +1 -0
  149. sage/symbolic/all.py +15 -0
  150. sage/symbolic/assumptions.py +987 -0
  151. sage/symbolic/benchmark.py +93 -0
  152. sage/symbolic/callable.py +456 -0
  153. sage/symbolic/callable.pyi +66 -0
  154. sage/symbolic/comparison_impl.pyi +38 -0
  155. sage/symbolic/complexity_measures.py +35 -0
  156. sage/symbolic/constants.py +1286 -0
  157. sage/symbolic/constants_c_impl.pyi +10 -0
  158. sage/symbolic/expression_conversion_algebraic.py +310 -0
  159. sage/symbolic/expression_conversion_sympy.py +317 -0
  160. sage/symbolic/expression_conversions.py +1727 -0
  161. sage/symbolic/function_factory.py +355 -0
  162. sage/symbolic/function_factory.pyi +41 -0
  163. sage/symbolic/getitem_impl.pyi +24 -0
  164. sage/symbolic/integration/all.py +1 -0
  165. sage/symbolic/integration/external.py +271 -0
  166. sage/symbolic/integration/integral.py +1075 -0
  167. sage/symbolic/maxima_wrapper.py +162 -0
  168. sage/symbolic/operators.py +267 -0
  169. sage/symbolic/operators.pyi +61 -0
  170. sage/symbolic/pynac_constant_impl.pyi +13 -0
  171. sage/symbolic/pynac_function_impl.pyi +8 -0
  172. sage/symbolic/random_tests.py +461 -0
  173. sage/symbolic/relation.py +2062 -0
  174. sage/symbolic/ring.cpython-311-darwin.so +0 -0
  175. sage/symbolic/ring.pxd +5 -0
  176. sage/symbolic/ring.pyi +110 -0
  177. sage/symbolic/ring.pyx +1393 -0
  178. sage/symbolic/series_impl.pyi +10 -0
  179. sage/symbolic/subring.py +1025 -0
  180. sage/symbolic/symengine.py +19 -0
  181. sage/symbolic/tests.py +40 -0
  182. sage/symbolic/units.py +1468 -0
@@ -0,0 +1,2445 @@
1
+ # sage_setup: distribution = sagemath-symbolics
2
+ r"""
3
+ Vector Field Modules
4
+
5
+ The set of vector fields along a differentiable manifold `U` with values on
6
+ a differentiable manifold `M` via a differentiable map `\Phi: U \to M`
7
+ (possibly `U = M` and `\Phi=\mathrm{Id}_M`) is a module over the algebra
8
+ `C^k(U)` of differentiable scalar fields on `U`. If `\Phi` is the identity
9
+ map, this module is considered a Lie algebroid under the Lie bracket `[\ ,\ ]`
10
+ (cf. :wikipedia:`Lie_algebroid`). It is a free module if and only if `M` is
11
+ parallelizable. Accordingly, there are two classes for vector field modules:
12
+
13
+ - :class:`VectorFieldModule` for vector fields with values on a
14
+ generic (in practice, not parallelizable) differentiable manifold `M`.
15
+ - :class:`VectorFieldFreeModule` for vector fields with values on a
16
+ parallelizable manifold `M`.
17
+
18
+ AUTHORS:
19
+
20
+ - Eric Gourgoulhon, Michal Bejger (2014-2015): initial version
21
+ - Travis Scrimshaw (2016): structure of Lie algebroid (:issue:`20771`)
22
+
23
+ REFERENCES:
24
+
25
+ - [KN1963]_
26
+ - [Lee2013]_
27
+ - [ONe1983]_
28
+ """
29
+
30
+ # ******************************************************************************
31
+ # Copyright (C) 2015-2021 Eric Gourgoulhon <eric.gourgoulhon@obspm.fr>
32
+ # 2015 Michal Bejger <bejger@camk.edu.pl>
33
+ # 2016 Travis Scrimshaw <tscrimsh@umn.edu>
34
+ # 2018 Florentin Jaffredo
35
+ # 2019 Hans Fotsing Tetsing
36
+ # 2020 Michael Jung
37
+ # 2020-2022 Matthias Koeppe
38
+ # 2021-2022 Tobias Diez
39
+ #
40
+ # Distributed under the terms of the GNU General Public License (GPL)
41
+ # as published by the Free Software Foundation; either version 2 of
42
+ # the License, or (at your option) any later version.
43
+ # http://www.gnu.org/licenses/
44
+ # ******************************************************************************
45
+
46
+ from __future__ import annotations
47
+
48
+ from typing import TYPE_CHECKING, Literal, Optional, overload
49
+
50
+ from sage.categories.modules import Modules
51
+ from sage.manifolds.differentiable.vectorfield import VectorField, VectorFieldParal
52
+ from sage.misc.cachefunc import cached_method
53
+ from sage.rings.integer import Integer
54
+ from sage.structure.parent import Parent
55
+ from sage.structure.unique_representation import UniqueRepresentation
56
+ from sage.tensor.modules.finite_rank_free_module import FiniteRankFreeModule
57
+ from sage.tensor.modules.reflexive_module import ReflexiveModule_base
58
+
59
+ if TYPE_CHECKING:
60
+ from sage.manifolds.differentiable.diff_form import DiffForm
61
+ from sage.manifolds.differentiable.diff_map import DiffMap
62
+ from sage.manifolds.differentiable.manifold import DifferentiableManifold
63
+ from sage.manifolds.scalarfield import ScalarField
64
+
65
+
66
+ class VectorFieldModule(UniqueRepresentation, ReflexiveModule_base):
67
+ r"""
68
+ Module of vector fields along a differentiable manifold `U`
69
+ with values on a differentiable manifold `M`, via a differentiable
70
+ map `U \rightarrow M`.
71
+
72
+ Given a differentiable map
73
+
74
+ .. MATH::
75
+
76
+ \Phi:\ U \longrightarrow M,
77
+
78
+ the *vector field module* `\mathfrak{X}(U,\Phi)` is the set of
79
+ all vector fields of the type
80
+
81
+ .. MATH::
82
+
83
+ v:\ U \longrightarrow TM
84
+
85
+ (where `TM` is the tangent bundle of `M`) such that
86
+
87
+ .. MATH::
88
+
89
+ \forall p \in U,\ v(p) \in T_{\Phi(p)}M,
90
+
91
+ where `T_{\Phi(p)}M` is the tangent space to `M` at the point `\Phi(p)`.
92
+
93
+ The set `\mathfrak{X}(U,\Phi)` is a module over `C^k(U)`, the ring
94
+ (algebra) of differentiable scalar fields on `U` (see
95
+ :class:`~sage.manifolds.differentiable.scalarfield_algebra.DiffScalarFieldAlgebra`).
96
+ Furthermore, it is a Lie algebroid under the Lie bracket (cf.
97
+ :wikipedia:`Lie_algebroid`)
98
+
99
+ .. MATH::
100
+
101
+ [X, Y] = X \circ Y - Y \circ X
102
+
103
+ over the scalarfields if `\Phi` is the identity map. That is to say
104
+ the Lie bracket is antisymmetric, bilinear over the base field,
105
+ satisfies the Jacobi identity, and `[X, fY] = X(f) Y + f[X, Y]`.
106
+
107
+ The standard case of vector fields *on* a differentiable manifold
108
+ corresponds to `U = M` and `\Phi = \mathrm{Id}_M`; we then denote
109
+ `\mathfrak{X}(M,\mathrm{Id}_M)` by merely `\mathfrak{X}(M)`. Other common
110
+ cases are `\Phi` being an immersion and `\Phi` being a curve in `M`
111
+ (`U` is then an open interval of `\RR`).
112
+
113
+ .. NOTE::
114
+
115
+ If `M` is parallelizable, the class :class:`VectorFieldFreeModule`
116
+ should be used instead.
117
+
118
+ INPUT:
119
+
120
+ - ``domain`` -- differentiable manifold `U` along which the
121
+ vector fields are defined
122
+ - ``dest_map`` -- (default: ``None``) destination map
123
+ `\Phi:\ U \rightarrow M`
124
+ (type: :class:`~sage.manifolds.differentiable.diff_map.DiffMap`);
125
+ if ``None``, it is assumed that `U = M` and `\Phi` is the identity
126
+ map of `M` (case of vector fields *on* `M`)
127
+
128
+ EXAMPLES:
129
+
130
+ Module of vector fields on the 2-sphere::
131
+
132
+ sage: M = Manifold(2, 'M') # the 2-dimensional sphere S^2
133
+ sage: U = M.open_subset('U') # complement of the North pole
134
+ sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole
135
+ sage: V = M.open_subset('V') # complement of the South pole
136
+ sage: c_uv.<u,v> = V.chart() # stereographic coordinates from the South pole
137
+ sage: M.declare_union(U,V) # S^2 is the union of U and V
138
+ sage: xy_to_uv = c_xy.transition_map(c_uv, (x/(x^2+y^2), y/(x^2+y^2)),
139
+ ....: intersection_name='W', restrictions1= x^2+y^2!=0,
140
+ ....: restrictions2= u^2+v^2!=0)
141
+ sage: uv_to_xy = xy_to_uv.inverse()
142
+ sage: XM = M.vector_field_module() ; XM
143
+ Module X(M) of vector fields on the 2-dimensional differentiable
144
+ manifold M
145
+
146
+ `\mathfrak{X}(M)` is a module over the algebra `C^k(M)`::
147
+
148
+ sage: XM.category()
149
+ Category of modules over Algebra of differentiable scalar fields on the
150
+ 2-dimensional differentiable manifold M
151
+ sage: XM.base_ring() is M.scalar_field_algebra()
152
+ True
153
+
154
+ `\mathfrak{X}(M)` is not a free module::
155
+
156
+ sage: isinstance(XM, FiniteRankFreeModule)
157
+ False
158
+
159
+ because `M = S^2` is not parallelizable::
160
+
161
+ sage: M.is_manifestly_parallelizable()
162
+ False
163
+
164
+ On the contrary, the module of vector fields on `U` is a free module,
165
+ since `U` is parallelizable (being a coordinate domain)::
166
+
167
+ sage: XU = U.vector_field_module()
168
+ sage: isinstance(XU, FiniteRankFreeModule)
169
+ True
170
+ sage: U.is_manifestly_parallelizable()
171
+ True
172
+
173
+ The zero element of the module::
174
+
175
+ sage: z = XM.zero() ; z
176
+ Vector field zero on the 2-dimensional differentiable manifold M
177
+ sage: z.display(c_xy.frame())
178
+ zero = 0
179
+ sage: z.display(c_uv.frame())
180
+ zero = 0
181
+
182
+ The module `\mathfrak{X}(M)` coerces to any module of vector fields defined
183
+ on a subdomain of `M`, for instance `\mathfrak{X}(U)`::
184
+
185
+ sage: XU.has_coerce_map_from(XM)
186
+ True
187
+ sage: XU.coerce_map_from(XM)
188
+ Coercion map:
189
+ From: Module X(M) of vector fields on the 2-dimensional
190
+ differentiable manifold M
191
+ To: Free module X(U) of vector fields on the Open subset U of the
192
+ 2-dimensional differentiable manifold M
193
+
194
+ The conversion map is actually the restriction of vector fields defined
195
+ on `M` to `U`.
196
+ """
197
+ Element = VectorField
198
+
199
+ def __init__(self, domain: DifferentiableManifold, dest_map: Optional[DiffMap] = None):
200
+ r"""
201
+ Construct the module of vector fields taking values on a (a priori)
202
+ non-parallelizable differentiable manifold.
203
+
204
+ TESTS::
205
+
206
+ sage: M = Manifold(2, 'M') # the 2-dimensional sphere S^2
207
+ sage: U = M.open_subset('U') # complement of the North pole
208
+ sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole
209
+ sage: V = M.open_subset('V') # complement of the South pole
210
+ sage: c_uv.<u,v> = V.chart() # stereographic coordinates from the South pole
211
+ sage: M.declare_union(U,V) # S^2 is the union of U and V
212
+ sage: xy_to_uv = c_xy.transition_map(c_uv, (x/(x^2+y^2), y/(x^2+y^2)),
213
+ ....: intersection_name='W', restrictions1= x^2+y^2!=0,
214
+ ....: restrictions2= u^2+v^2!=0)
215
+ sage: from sage.manifolds.differentiable.vectorfield_module import VectorFieldModule
216
+ sage: XM = VectorFieldModule(M, dest_map=M.identity_map()); XM
217
+ Module X(M) of vector fields on the 2-dimensional differentiable
218
+ manifold M
219
+ sage: XM is M.vector_field_module()
220
+ True
221
+ sage: TestSuite(XM).run(skip='_test_elements')
222
+
223
+ In the above test suite, _test_elements is skipped because of the
224
+ _test_pickling error of the elements (to be fixed in class
225
+ TensorField)
226
+ """
227
+ self._domain = domain
228
+ name = "X(" + domain._name
229
+ latex_name = r"\mathfrak{X}\left(" + domain._latex_name
230
+ if dest_map is None:
231
+ dest_map = domain.identity_map()
232
+ self._dest_map = dest_map
233
+ if dest_map is not domain.identity_map():
234
+ dm_name = dest_map._name
235
+ dm_latex_name = dest_map._latex_name
236
+ if dm_name is None:
237
+ dm_name = "unnamed map"
238
+ if dm_latex_name is None:
239
+ dm_latex_name = r"\mathrm{unnamed\; map}"
240
+ name += "," + dm_name
241
+ latex_name += "," + dm_latex_name
242
+ self._name = name + ")"
243
+ self._latex_name = latex_name + r"\right)"
244
+ self._ambient_domain = self._dest_map._codomain
245
+ # The member self._ring is created for efficiency (to avoid
246
+ # calls to self.base_ring()):
247
+ self._ring = domain.scalar_field_algebra()
248
+ Parent.__init__(self, base=self._ring,
249
+ category=Modules(self._ring))
250
+ # Dictionary of the tensor modules built on self
251
+ # (keys = (k,l) --the tensor type)
252
+ # This dictionary is to be extended on need by the method tensor_module
253
+ self._tensor_modules = {(1,0): self} # self is considered as the set
254
+ # of tensors of type (1,0)
255
+ # Dictionaries of exterior powers of self and of its dual
256
+ # (keys = p --the power degree)
257
+ # These dictionaries are to be extended on need by the methods
258
+ # exterior_power and dual_exterior_power
259
+ self._exterior_powers = {1: self}
260
+ self._dual_exterior_powers = {}
261
+ self._general_linear_group = None
262
+
263
+ #### Parent methods
264
+
265
+ def _element_constructor_(self, comp=[], frame=None, name=None,
266
+ latex_name=None):
267
+ r"""
268
+ Construct an element of the module.
269
+
270
+ TESTS::
271
+
272
+ sage: M = Manifold(2, 'M')
273
+ sage: U = M.open_subset('U'); V = M.open_subset('V')
274
+ sage: c_xy.<x,y> = U.chart(); c_uv.<u,v> = V.chart()
275
+ sage: M.declare_union(U,V)
276
+ sage: XM = M.vector_field_module()
277
+ sage: v = XM([-x,y], frame=c_xy.frame(), name='v'); v
278
+ Vector field v on the 2-dimensional differentiable manifold M
279
+ sage: v.display()
280
+ v = -x ∂/∂x + y ∂/∂y
281
+ sage: XM(0) is XM.zero()
282
+ True
283
+ """
284
+ try:
285
+ if comp.is_trivial_zero():
286
+ return self.zero()
287
+ except AttributeError:
288
+ if comp == 0:
289
+ return self.zero()
290
+ if isinstance(comp, VectorField):
291
+ if (self._domain.is_subset(comp._domain)
292
+ and self._ambient_domain.is_subset(comp._ambient_domain)):
293
+ return comp.restrict(self._domain)
294
+ else:
295
+ raise ValueError("cannot convert the {} ".format(comp) +
296
+ "to a vector field in {}".format(self))
297
+ if not isinstance(comp, (list, tuple)):
298
+ raise TypeError("cannot convert the {} ".format(comp) +
299
+ "to an element of {}".format(self))
300
+ # standard construction
301
+ resu = self.element_class(self, name=name, latex_name=latex_name)
302
+ if comp:
303
+ resu.set_comp(frame)[:] = comp
304
+ return resu
305
+
306
+ def _an_element_(self):
307
+ r"""
308
+ Construct some (unnamed) element of the module.
309
+
310
+ TESTS::
311
+
312
+ sage: M = Manifold(2, 'M')
313
+ sage: U = M.open_subset('U'); V = M.open_subset('V')
314
+ sage: c_xy.<x,y> = U.chart(); c_uv.<u,v> = V.chart()
315
+ sage: M.declare_union(U,V)
316
+ sage: XM = M.vector_field_module()
317
+ sage: XM._an_element_()
318
+ Vector field on the 2-dimensional differentiable manifold M
319
+ """
320
+ resu = self.element_class(self)
321
+ for oc in self._domain.open_covers(trivial=False):
322
+ # the first non-trivial open cover is selected
323
+ for dom in oc:
324
+ vmodule_dom = dom.vector_field_module(
325
+ dest_map=self._dest_map.restrict(dom))
326
+ resu.set_restriction(vmodule_dom._an_element_())
327
+ return resu
328
+ return resu
329
+
330
+ def _coerce_map_from_(self, other):
331
+ r"""
332
+ Determine whether coercion to ``self`` exists from other parent.
333
+
334
+ TESTS::
335
+
336
+ sage: M = Manifold(2, 'M')
337
+ sage: U = M.open_subset('U')
338
+ sage: XM = M.vector_field_module()
339
+ sage: XU = U.vector_field_module()
340
+ sage: XM._coerce_map_from_(XU)
341
+ False
342
+ sage: XU._coerce_map_from_(XM)
343
+ True
344
+ """
345
+ if isinstance(other, (VectorFieldModule, VectorFieldFreeModule)):
346
+ return self._domain.is_subset(other._domain) and \
347
+ self._ambient_domain.is_subset(other._ambient_domain)
348
+ else:
349
+ return False
350
+
351
+ #### End of parent methods
352
+
353
+ def _repr_(self):
354
+ r"""
355
+ String representation of the object.
356
+
357
+ TESTS::
358
+
359
+ sage: M = Manifold(2, 'M')
360
+ sage: XM = M.vector_field_module()
361
+ sage: XM._repr_()
362
+ 'Module X(M) of vector fields on the 2-dimensional differentiable manifold M'
363
+ sage: repr(XM) # indirect doctest
364
+ 'Module X(M) of vector fields on the 2-dimensional differentiable manifold M'
365
+ sage: XM # indirect doctest
366
+ Module X(M) of vector fields on the 2-dimensional differentiable
367
+ manifold M
368
+ """
369
+ description = "Module "
370
+ if self._name is not None:
371
+ description += self._name + " "
372
+ description += "of vector fields "
373
+ if self._dest_map is self._domain.identity_map():
374
+ description += "on the {}".format(self._domain)
375
+ else:
376
+ description += ("along the {}".format(self._domain)
377
+ + " mapped into the {}".format(self._ambient_domain))
378
+ return description
379
+
380
+ def _latex_(self):
381
+ r"""
382
+ LaTeX representation of the object.
383
+
384
+ TESTS::
385
+
386
+ sage: M = Manifold(2, 'M')
387
+ sage: XM = M.vector_field_module()
388
+ sage: XM._latex_()
389
+ '\\mathfrak{X}\\left(M\\right)'
390
+ sage: latex(XM) # indirect doctest
391
+ \mathfrak{X}\left(M\right)
392
+ """
393
+ if self._latex_name is None:
394
+ return r"\text{" + str(self) + r"}"
395
+ else:
396
+ return self._latex_name
397
+
398
+ def domain(self) -> DifferentiableManifold:
399
+ r"""
400
+ Return the domain of the vector fields in this module.
401
+
402
+ If the module is `\mathfrak{X}(U,\Phi)`, returns the domain `U` of
403
+ `\Phi`.
404
+
405
+ OUTPUT:
406
+
407
+ - instance of
408
+ :class:`~sage.manifolds.differentiable.manifold.DifferentiableManifold`
409
+ representing the domain of the vector fields that belong to this
410
+ module
411
+
412
+ EXAMPLES::
413
+
414
+ sage: M = Manifold(5, 'M')
415
+ sage: XM = M.vector_field_module()
416
+ sage: XM.domain()
417
+ 5-dimensional differentiable manifold M
418
+ sage: U = Manifold(2, 'U')
419
+ sage: Phi = U.diff_map(M, name='Phi')
420
+ sage: XU = U.vector_field_module(dest_map=Phi)
421
+ sage: XU.domain()
422
+ 2-dimensional differentiable manifold U
423
+ """
424
+ return self._domain
425
+
426
+ def ambient_domain(self) -> DifferentiableManifold:
427
+ r"""
428
+ Return the manifold in which the vector fields of this module take
429
+ their values.
430
+
431
+ If the module is `\mathfrak{X}(U,\Phi)`, returns the codomain `M` of
432
+ `\Phi`.
433
+
434
+ OUTPUT:
435
+
436
+ - instance of
437
+ :class:`~sage.manifolds.differentiable.manifold.DifferentiableManifold`
438
+ representing the manifold in which the vector fields of this
439
+ module take their values
440
+
441
+ EXAMPLES::
442
+
443
+ sage: M = Manifold(5, 'M')
444
+ sage: XM = M.vector_field_module()
445
+ sage: XM.ambient_domain()
446
+ 5-dimensional differentiable manifold M
447
+ sage: U = Manifold(2, 'U')
448
+ sage: Phi = U.diff_map(M, name='Phi')
449
+ sage: XU = U.vector_field_module(dest_map=Phi)
450
+ sage: XU.ambient_domain()
451
+ 5-dimensional differentiable manifold M
452
+ """
453
+ return self._ambient_domain
454
+
455
+ def destination_map(self):
456
+ r"""
457
+ Return the differential map associated to this module.
458
+
459
+ The differential map associated to this module is the map
460
+
461
+ .. MATH::
462
+
463
+ \Phi:\ U \longrightarrow M
464
+
465
+ such that this module is the set `\mathfrak{X}(U,\Phi)` of all
466
+ vector fields of the type
467
+
468
+ .. MATH::
469
+
470
+ v:\ U \longrightarrow TM
471
+
472
+ (where `TM` is the tangent bundle of `M`) such that
473
+
474
+ .. MATH::
475
+
476
+ \forall p \in U,\ v(p) \in T_{\Phi(p)}M,
477
+
478
+ where `T_{\Phi(p)}M` is the tangent space to `M` at the
479
+ point `\Phi(p)`.
480
+
481
+ OUTPUT:
482
+
483
+ - instance of
484
+ :class:`~sage.manifolds.differentiable.diff_map.DiffMap`
485
+ representing the differential map `\Phi`
486
+
487
+ EXAMPLES::
488
+
489
+ sage: M = Manifold(5, 'M')
490
+ sage: XM = M.vector_field_module()
491
+ sage: XM.destination_map()
492
+ Identity map Id_M of the 5-dimensional differentiable manifold M
493
+ sage: U = Manifold(2, 'U')
494
+ sage: Phi = U.diff_map(M, name='Phi')
495
+ sage: XU = U.vector_field_module(dest_map=Phi)
496
+ sage: XU.destination_map()
497
+ Differentiable map Phi from the 2-dimensional differentiable
498
+ manifold U to the 5-dimensional differentiable manifold M
499
+ """
500
+ return self._dest_map
501
+
502
+ def tensor_module(self, k, l, *, sym=None, antisym=None):
503
+ r"""
504
+ Return the module of type-`(k,l)` tensors on ``self``.
505
+
506
+ INPUT:
507
+
508
+ - ``k`` -- nonnegative integer; the contravariant rank,
509
+ the tensor type being `(k,l)`
510
+ - ``l`` -- nonnegative integer; the covariant rank,
511
+ the tensor type being `(k,l)`
512
+
513
+ OUTPUT:
514
+
515
+ - instance of
516
+ :class:`~sage.manifolds.differentiable.tensorfield_module.TensorFieldModule`
517
+ representing the module `T^{(k,l)}(U,\Phi)` of type-`(k,l)`
518
+ tensors on the vector field module
519
+
520
+ EXAMPLES:
521
+
522
+ A tensor field module on a 2-dimensional differentiable manifold::
523
+
524
+ sage: M = Manifold(2, 'M')
525
+ sage: XM = M.vector_field_module()
526
+ sage: XM.tensor_module(1,2)
527
+ Module T^(1,2)(M) of type-(1,2) tensors fields on the 2-dimensional
528
+ differentiable manifold M
529
+
530
+ The special case of tensor fields of type (1,0)::
531
+
532
+ sage: XM.tensor_module(1,0)
533
+ Module X(M) of vector fields on the 2-dimensional differentiable
534
+ manifold M
535
+
536
+ The result is cached::
537
+
538
+ sage: XM.tensor_module(1,2) is XM.tensor_module(1,2)
539
+ True
540
+ sage: XM.tensor_module(1,0) is XM
541
+ True
542
+
543
+ See
544
+ :class:`~sage.manifolds.differentiable.tensorfield_module.TensorFieldModule`
545
+ for more examples and documentation.
546
+ """
547
+ if sym or antisym:
548
+ raise NotImplementedError
549
+ try:
550
+ return self._tensor_modules[(k,l)]
551
+ except KeyError:
552
+ from sage.manifolds.differentiable.tensorfield_module import (
553
+ TensorFieldModule,
554
+ )
555
+ T = TensorFieldModule(self, (k,l))
556
+ self._tensor_modules[(k,l)] = T
557
+ return T
558
+
559
+ def exterior_power(self, p):
560
+ r"""
561
+ Return the `p`-th exterior power of ``self``.
562
+
563
+ If the vector field module ``self`` is `\mathfrak{X}(U,\Phi)`,
564
+ its `p`-th exterior power is the set `A^p(U, \Phi)` of
565
+ `p`-vector fields along `U` with values on `\Phi(U)`. It is a
566
+ module over `C^k(U)`, the ring (algebra) of differentiable
567
+ scalar fields on `U`.
568
+
569
+ INPUT:
570
+
571
+ - ``p`` -- nonnegative integer
572
+
573
+ OUTPUT:
574
+
575
+ - for `p=0`, the base ring, i.e. `C^k(U)`
576
+ - for `p=1`, the vector field module ``self``, since
577
+ `A^1(U, \Phi) = \mathfrak{X}(U,\Phi)`
578
+ - for `p \geq 2`, instance of
579
+ :class:`~sage.manifolds.differentiable.multivector_module.MultivectorModule`
580
+ representing the module `A^p(U,\Phi)`
581
+
582
+ EXAMPLES::
583
+
584
+ sage: M = Manifold(2, 'M')
585
+ sage: XM = M.vector_field_module()
586
+ sage: XM.exterior_power(2)
587
+ Module A^2(M) of 2-vector fields on the 2-dimensional
588
+ differentiable manifold M
589
+ sage: XM.exterior_power(1)
590
+ Module X(M) of vector fields on the 2-dimensional
591
+ differentiable manifold M
592
+ sage: XM.exterior_power(1) is XM
593
+ True
594
+ sage: XM.exterior_power(0)
595
+ Algebra of differentiable scalar fields on the 2-dimensional
596
+ differentiable manifold M
597
+ sage: XM.exterior_power(0) is M.scalar_field_algebra()
598
+ True
599
+
600
+ .. SEEALSO::
601
+
602
+ :class:`~sage.manifolds.differentiable.multivector_module.MultivectorModule`
603
+ for more examples and documentation.
604
+ """
605
+ try:
606
+ return self._exterior_powers[p]
607
+ except KeyError:
608
+ if p == 0:
609
+ L = self._ring
610
+ else:
611
+ from sage.manifolds.differentiable.multivector_module import (
612
+ MultivectorModule,
613
+ )
614
+ L = MultivectorModule(self, p)
615
+ self._exterior_powers[p] = L
616
+ return L
617
+
618
+ def dual_exterior_power(self, p):
619
+ r"""
620
+ Return the `p`-th exterior power of the dual of the vector field
621
+ module.
622
+
623
+ If the vector field module is `\mathfrak{X}(U,\Phi)`, the
624
+ `p`-th exterior power of its dual is the set `\Omega^p(U, \Phi)`
625
+ of `p`-forms along `U` with values on `\Phi(U)`. It is a module
626
+ over `C^k(U)`, the ring (algebra) of differentiable scalar
627
+ fields on `U`.
628
+
629
+ INPUT:
630
+
631
+ - ``p`` -- nonnegative integer
632
+
633
+ OUTPUT:
634
+
635
+ - for `p=0`, the base ring, i.e. `C^k(U)`
636
+ - for `p \geq 1`, instance of
637
+ :class:`~sage.manifolds.differentiable.diff_form_module.DiffFormModule`
638
+ representing the module `\Omega^p(U,\Phi)`
639
+
640
+ EXAMPLES::
641
+
642
+ sage: M = Manifold(2, 'M')
643
+ sage: XM = M.vector_field_module()
644
+ sage: XM.dual_exterior_power(2)
645
+ Module Omega^2(M) of 2-forms on the 2-dimensional differentiable
646
+ manifold M
647
+ sage: XM.dual_exterior_power(1)
648
+ Module Omega^1(M) of 1-forms on the 2-dimensional differentiable
649
+ manifold M
650
+ sage: XM.dual_exterior_power(1) is XM.dual()
651
+ True
652
+ sage: XM.dual_exterior_power(0)
653
+ Algebra of differentiable scalar fields on the 2-dimensional
654
+ differentiable manifold M
655
+ sage: XM.dual_exterior_power(0) is M.scalar_field_algebra()
656
+ True
657
+
658
+ .. SEEALSO::
659
+
660
+ :class:`~sage.manifolds.differentiable.diff_form_module.DiffFormModule`
661
+ for more examples and documentation.
662
+ """
663
+ try:
664
+ return self._dual_exterior_powers[p]
665
+ except KeyError:
666
+ if p == 0:
667
+ L = self._ring
668
+ else:
669
+ from sage.manifolds.differentiable.diff_form_module import (
670
+ DiffFormModule,
671
+ )
672
+ L = DiffFormModule(self, p)
673
+ self._dual_exterior_powers[p] = L
674
+ return L
675
+
676
+ def dual(self):
677
+ r"""
678
+ Return the dual module.
679
+
680
+ EXAMPLES::
681
+
682
+ sage: M = Manifold(2, 'M')
683
+ sage: XM = M.vector_field_module()
684
+ sage: XM.dual()
685
+ Module Omega^1(M) of 1-forms on the 2-dimensional differentiable
686
+ manifold M
687
+ """
688
+ return self.dual_exterior_power(1)
689
+
690
+ def general_linear_group(self):
691
+ r"""
692
+ Return the general linear group of ``self``.
693
+
694
+ If the vector field module is `\mathfrak{X}(U,\Phi)`, the *general
695
+ linear group* is the group `\mathrm{GL}(\mathfrak{X}(U,\Phi))` of
696
+ automorphisms of `\mathfrak{X}(U, \Phi)`. Note that an automorphism
697
+ of `\mathfrak{X}(U,\Phi)` can also be viewed as a *field* along `U`
698
+ of automorphisms of the tangent spaces of `M \supset \Phi(U)`.
699
+
700
+ OUTPUT:
701
+
702
+ - instance of class
703
+ :class:`~sage.manifolds.differentiable.automorphismfield_group.AutomorphismFieldGroup`
704
+ representing `\mathrm{GL}(\mathfrak{X}(U,\Phi))`
705
+
706
+ EXAMPLES::
707
+
708
+ sage: M = Manifold(2, 'M')
709
+ sage: XM = M.vector_field_module()
710
+ sage: XM.general_linear_group()
711
+ General linear group of the Module X(M) of vector fields on the
712
+ 2-dimensional differentiable manifold M
713
+
714
+ .. SEEALSO::
715
+
716
+ :class:`~sage.manifolds.differentiable.automorphismfield_group.AutomorphismFieldGroup`
717
+ for more examples and documentation.
718
+ """
719
+ if self._general_linear_group is None:
720
+ from sage.manifolds.differentiable.automorphismfield_group import (
721
+ AutomorphismFieldGroup,
722
+ )
723
+ self._general_linear_group = AutomorphismFieldGroup(self)
724
+ return self._general_linear_group
725
+
726
+ def _tensor(self, tensor_type, name=None, latex_name=None, sym=None,
727
+ antisym=None, specific_type=None):
728
+ r"""
729
+ Construct a tensor on ``self``.
730
+
731
+ The tensor is actually a tensor field on the domain of
732
+ the vector field module.
733
+
734
+ INPUT:
735
+
736
+ - ``tensor_type`` -- pair (k,l) with k being the contravariant rank
737
+ and l the covariant rank
738
+ - ``name`` -- (string; default: ``None``) name given to the tensor
739
+ - ``latex_name`` -- (string; default: ``None``) LaTeX symbol to denote
740
+ the tensor; if none is provided, the LaTeX symbol is set to ``name``
741
+ - ``sym`` -- (default: ``None``) a symmetry or a list of symmetries
742
+ among the tensor arguments: each symmetry is described by a tuple
743
+ containing the positions of the involved arguments, with the
744
+ convention position=0 for the first argument; for instance:
745
+
746
+ * ``sym=(0,1)`` for a symmetry between the 1st and 2nd arguments
747
+ * ``sym=[(0,2),(1,3,4)]`` for a symmetry between the 1st and 3rd
748
+ arguments and a symmetry between the 2nd, 4th and 5th arguments
749
+
750
+ - ``antisym`` -- (default: ``None``) antisymmetry or list of
751
+ antisymmetries among the arguments, with the same convention
752
+ as for ``sym``
753
+ - ``specific_type`` -- (default: ``None``) specific subclass of
754
+ :class:`~sage.manifolds.differentiable.tensorfield.TensorField` for
755
+ the output
756
+
757
+ OUTPUT:
758
+
759
+ - instance of
760
+ :class:`~sage.manifolds.differentiable.tensorfield.TensorField`
761
+ representing the tensor defined on the vector field module with the
762
+ provided characteristics
763
+
764
+ EXAMPLES::
765
+
766
+ sage: M = Manifold(2, 'M')
767
+ sage: XM = M.vector_field_module()
768
+ sage: XM.tensor((1,2), name='t')
769
+ Tensor field t of type (1,2) on the 2-dimensional differentiable
770
+ manifold M
771
+
772
+ .. SEEALSO::
773
+
774
+ :class:`~sage.manifolds.differentiable.tensorfield.TensorField`
775
+ for more examples and documentation.
776
+ """
777
+ from sage.manifolds.differentiable.automorphismfield import AutomorphismField
778
+ from sage.manifolds.differentiable.metric import (
779
+ DegenerateMetric,
780
+ PseudoRiemannianMetric,
781
+ )
782
+ from sage.tensor.modules.comp import CompWithSym
783
+ sym, antisym = CompWithSym._canonicalize_sym_antisym(
784
+ tensor_type[0] + tensor_type[1], sym, antisym)
785
+ if tensor_type == (1,0):
786
+ return self.element_class(self, name=name,
787
+ latex_name=latex_name)
788
+ elif tensor_type == (0,1):
789
+ return self.linear_form(name=name, latex_name=latex_name)
790
+ elif tensor_type == (1,1) and specific_type is not None:
791
+ if issubclass(specific_type, AutomorphismField):
792
+ return self.automorphism(name=name,
793
+ latex_name=latex_name)
794
+ elif tensor_type[0] == 0 and tensor_type[1] > 1 and antisym:
795
+ if len(antisym[0]) == tensor_type[1]:
796
+ return self.alternating_form(tensor_type[1], name=name,
797
+ latex_name=latex_name)
798
+ elif tensor_type[0] > 1 and tensor_type[1] == 0 and antisym:
799
+ if len(antisym[0]) == tensor_type[0]:
800
+ return self.alternating_contravariant_tensor(
801
+ tensor_type[0], name=name, latex_name=latex_name)
802
+ elif tensor_type == (0,2) and specific_type is not None:
803
+ if issubclass(specific_type, PseudoRiemannianMetric):
804
+ return self.metric(name, latex_name=latex_name)
805
+ # NB: the signature is not treated
806
+ if issubclass(specific_type, DegenerateMetric):
807
+ sign = self._domain._dim
808
+ return self.metric(name, latex_name=latex_name,
809
+ signature=(0, sign-1, 1))
810
+ # Generic case
811
+ return self.tensor_module(*tensor_type).element_class(
812
+ self, tensor_type, name=name, latex_name=latex_name,
813
+ sym=sym, antisym=antisym)
814
+
815
+ def tensor(self, *args, **kwds):
816
+ r"""
817
+ Construct a tensor field on the domain of ``self`` or a tensor product
818
+ of ``self`` with other modules.
819
+
820
+ If ``args`` consist of other parents, just delegate to :meth:`tensor_product`.
821
+
822
+ Otherwise, construct a tensor (i.e., a tensor field on the domain of
823
+ the vector field module) from the following input.
824
+
825
+ INPUT:
826
+
827
+ - ``tensor_type`` -- pair (k,l) with k being the contravariant rank
828
+ and l the covariant rank
829
+ - ``name`` -- (string; default: ``None``) name given to the tensor
830
+ - ``latex_name`` -- (string; default: ``None``) LaTeX symbol to denote
831
+ the tensor; if none is provided, the LaTeX symbol is set to ``name``
832
+ - ``sym`` -- (default: ``None``) a symmetry or a list of symmetries
833
+ among the tensor arguments: each symmetry is described by a tuple
834
+ containing the positions of the involved arguments, with the
835
+ convention position=0 for the first argument; for instance:
836
+
837
+ * ``sym=(0,1)`` for a symmetry between the 1st and 2nd arguments
838
+ * ``sym=[(0,2),(1,3,4)]`` for a symmetry between the 1st and 3rd
839
+ arguments and a symmetry between the 2nd, 4th and 5th arguments
840
+
841
+ - ``antisym`` -- (default: ``None``) antisymmetry or list of
842
+ antisymmetries among the arguments, with the same convention
843
+ as for ``sym``
844
+ - ``specific_type`` -- (default: ``None``) specific subclass of
845
+ :class:`~sage.manifolds.differentiable.tensorfield.TensorField` for
846
+ the output
847
+
848
+ OUTPUT:
849
+
850
+ - instance of
851
+ :class:`~sage.manifolds.differentiable.tensorfield.TensorField`
852
+ representing the tensor defined on the vector field module with the
853
+ provided characteristics
854
+
855
+ EXAMPLES::
856
+
857
+ sage: M = Manifold(2, 'M')
858
+ sage: XM = M.vector_field_module()
859
+ sage: XM.tensor((1,2), name='t')
860
+ Tensor field t of type (1,2) on the 2-dimensional differentiable
861
+ manifold M
862
+ sage: XM.tensor((1,0), name='a')
863
+ Vector field a on the 2-dimensional differentiable manifold M
864
+ sage: XM.tensor((0,2), name='a', antisym=(0,1))
865
+ 2-form a on the 2-dimensional differentiable manifold M
866
+
867
+ Delegation to :meth:`tensor_product`::
868
+
869
+ sage: M = Manifold(2, 'M')
870
+ sage: XM = M.vector_field_module()
871
+ sage: XM.tensor(XM)
872
+ Module T^(2,0)(M) of type-(2,0) tensors fields on the 2-dimensional differentiable manifold M
873
+ sage: XM.tensor(XM, XM.dual(), XM)
874
+ Module T^(3,1)(M) of type-(3,1) tensors fields on the 2-dimensional differentiable manifold M
875
+ sage: XM.tensor(XM).tensor(XM.dual().tensor(XM.dual()))
876
+ Traceback (most recent call last):
877
+ ...
878
+ AttributeError: 'TensorFieldModule_with_category' object has no attribute '_basis_sym'...
879
+
880
+ .. SEEALSO::
881
+
882
+ :class:`~sage.manifolds.differentiable.tensorfield.TensorField`
883
+ for more examples and documentation.
884
+ """
885
+ # Until https://github.com/sagemath/sage/issues/30373 is done,
886
+ # TensorProductFunctor._functor_name is "tensor", so this method
887
+ # also needs to double as the tensor product construction
888
+ if isinstance(args[0], Parent):
889
+ return self.tensor_product(*args, **kwds)
890
+ return self._tensor(*args, **kwds)
891
+
892
+ def alternating_contravariant_tensor(self, degree, name=None,
893
+ latex_name=None):
894
+ r"""
895
+ Construct an alternating contravariant tensor on the vector
896
+ field module ``self``.
897
+
898
+ An alternating contravariant tensor on ``self`` is actually a
899
+ multivector field along the differentiable manifold `U` over
900
+ which ``self`` is defined.
901
+
902
+ INPUT:
903
+
904
+ - ``degree`` -- degree of the alternating contravariant tensor
905
+ (i.e. its tensor rank)
906
+ - ``name`` -- (default: ``None``) string; name given to the
907
+ alternating contravariant tensor
908
+ - ``latex_name`` -- (default: ``None``) string; LaTeX symbol to
909
+ denote the alternating contravariant tensor; if none is
910
+ provided, the LaTeX symbol is set to ``name``
911
+
912
+ OUTPUT:
913
+
914
+ - instance of
915
+ :class:`~sage.manifolds.differentiable.multivectorfield.MultivectorField`
916
+
917
+ EXAMPLES::
918
+
919
+ sage: M = Manifold(2, 'M')
920
+ sage: XM = M.vector_field_module()
921
+ sage: XM.alternating_contravariant_tensor(2, name='a')
922
+ 2-vector field a on the 2-dimensional differentiable
923
+ manifold M
924
+
925
+ An alternating contravariant tensor of degree 1 is simply
926
+ a vector field::
927
+
928
+ sage: XM.alternating_contravariant_tensor(1, name='a')
929
+ Vector field a on the 2-dimensional differentiable
930
+ manifold M
931
+
932
+ .. SEEALSO::
933
+
934
+ :class:`~sage.manifolds.differentiable.multivectorfield.MultivectorField`
935
+ for more examples and documentation.
936
+ """
937
+ if degree == 0:
938
+ return self._domain.scalar_field(name=name, latex_name=latex_name)
939
+ if degree == 1:
940
+ return self.element_class(self, name=name,
941
+ latex_name=latex_name)
942
+ return self.exterior_power(degree).element_class(self, degree,
943
+ name=name,
944
+ latex_name=latex_name)
945
+
946
+ @overload
947
+ def alternating_form(
948
+ self, degree: Literal[0], name=None, latex_name=None
949
+ ) -> ScalarField:
950
+ pass
951
+
952
+ def alternating_form(self, degree: int, name=None, latex_name=None) -> DiffForm:
953
+ r"""
954
+ Construct an alternating form on the vector field module
955
+ ``self``.
956
+
957
+ An alternating form on ``self`` is actually a differential form
958
+ along the differentiable manifold `U` over which ``self`` is
959
+ defined.
960
+
961
+ INPUT:
962
+
963
+ - ``degree`` -- the degree of the alternating form
964
+ (i.e. its tensor rank)
965
+ - ``name`` -- (string; optional) name given to the alternating
966
+ form
967
+ - ``latex_name`` -- (string; optional) LaTeX symbol to denote
968
+ the alternating form; if none is provided, the LaTeX symbol is
969
+ set to ``name``
970
+
971
+ OUTPUT:
972
+
973
+ - instance of
974
+ :class:`~sage.manifolds.differentiable.diff_form.DiffForm`
975
+
976
+ EXAMPLES::
977
+
978
+ sage: M = Manifold(2, 'M')
979
+ sage: XM = M.vector_field_module()
980
+ sage: XM.alternating_form(2, name='a')
981
+ 2-form a on the 2-dimensional differentiable manifold M
982
+ sage: XM.alternating_form(1, name='a')
983
+ 1-form a on the 2-dimensional differentiable manifold M
984
+
985
+ .. SEEALSO::
986
+
987
+ :class:`~sage.manifolds.differentiable.diff_form.DiffForm`
988
+ for more examples and documentation.
989
+ """
990
+ if degree == 0:
991
+ return self._domain.scalar_field(name=name, latex_name=latex_name)
992
+ return self.dual_exterior_power(degree).element_class(self,
993
+ degree, name=name, latex_name=latex_name)
994
+
995
+ def linear_form(self, name=None, latex_name=None):
996
+ r"""
997
+ Construct a linear form on the vector field module.
998
+
999
+ A linear form on the vector field module is actually a field
1000
+ of linear forms (i.e. a 1-form) along the differentiable
1001
+ manifold `U` over which the vector field module is defined.
1002
+
1003
+ INPUT:
1004
+
1005
+ - ``name`` -- (string; optional) name given to the linear form
1006
+ - ``latex_name`` -- (string; optional) LaTeX symbol to denote
1007
+ the linear form; if none is provided, the LaTeX symbol is
1008
+ set to ``name``
1009
+
1010
+ OUTPUT:
1011
+
1012
+ - instance of
1013
+ :class:`~sage.manifolds.differentiable.diff_form.DiffForm`
1014
+
1015
+ EXAMPLES::
1016
+
1017
+ sage: M = Manifold(2, 'M')
1018
+ sage: XM = M.vector_field_module()
1019
+ sage: XM.linear_form()
1020
+ 1-form on the 2-dimensional differentiable manifold M
1021
+ sage: XM.linear_form(name='a')
1022
+ 1-form a on the 2-dimensional differentiable manifold M
1023
+
1024
+ .. SEEALSO::
1025
+
1026
+ :class:`~sage.manifolds.differentiable.diff_form.DiffForm`
1027
+ for more examples and documentation.
1028
+ """
1029
+ return self.dual_exterior_power(1).element_class(self, 1,
1030
+ name=name, latex_name=latex_name)
1031
+
1032
+ def automorphism(self, name=None, latex_name=None):
1033
+ r"""
1034
+ Construct an automorphism of the vector field module.
1035
+
1036
+ An automorphism of the vector field module is actually a field
1037
+ of tangent-space automorphisms along the differentiable manifold
1038
+ `U` over which the vector field module is defined.
1039
+
1040
+ INPUT:
1041
+
1042
+ - ``name`` -- (string; optional) name given to the automorphism
1043
+ - ``latex_name`` -- (string; optional) LaTeX symbol to denote
1044
+ the automorphism; if none is provided, the LaTeX symbol is
1045
+ set to ``name``
1046
+
1047
+ OUTPUT:
1048
+
1049
+ - instance of
1050
+ :class:`~sage.manifolds.differentiable.automorphismfield.AutomorphismField`
1051
+
1052
+ EXAMPLES::
1053
+
1054
+ sage: M = Manifold(2, 'M')
1055
+ sage: XM = M.vector_field_module()
1056
+ sage: XM.automorphism()
1057
+ Field of tangent-space automorphisms on the 2-dimensional
1058
+ differentiable manifold M
1059
+ sage: XM.automorphism(name='a')
1060
+ Field of tangent-space automorphisms a on the 2-dimensional
1061
+ differentiable manifold M
1062
+
1063
+ .. SEEALSO::
1064
+
1065
+ :class:`~sage.manifolds.differentiable.automorphismfield.AutomorphismField`
1066
+ for more examples and documentation.
1067
+ """
1068
+ return self.general_linear_group().element_class(self,
1069
+ name=name, latex_name=latex_name)
1070
+
1071
+ @cached_method
1072
+ def identity_map(self):
1073
+ r"""
1074
+ Construct the identity map on the vector field module.
1075
+
1076
+ The identity map on the vector field module is actually a field
1077
+ of tangent-space identity maps along the differentiable manifold
1078
+ `U` over which the vector field module is defined.
1079
+
1080
+ OUTPUT:
1081
+
1082
+ - instance of
1083
+ :class:`~sage.manifolds.differentiable.automorphismfield.AutomorphismField`
1084
+
1085
+ EXAMPLES:
1086
+
1087
+ Get the identity map on a vector field module::
1088
+
1089
+ sage: M = Manifold(2, 'M')
1090
+ sage: XM = M.vector_field_module()
1091
+ sage: Id = XM.identity_map(); Id
1092
+ Field of tangent-space identity maps on the 2-dimensional
1093
+ differentiable manifold M
1094
+
1095
+ If the identity should be renamed, one has to create a copy::
1096
+
1097
+ sage: Id.set_name('1')
1098
+ Traceback (most recent call last):
1099
+ ...
1100
+ ValueError: the name of an immutable element cannot be changed
1101
+ sage: one = Id.copy('1'); one
1102
+ Field of tangent-space automorphisms 1 on the 2-dimensional
1103
+ differentiable manifold M
1104
+ """
1105
+ return self.general_linear_group().one()
1106
+
1107
+ @cached_method
1108
+ def zero(self):
1109
+ """
1110
+ Return the zero of ``self``.
1111
+
1112
+ EXAMPLES::
1113
+
1114
+ sage: M = Manifold(2, 'M')
1115
+ sage: X.<x,y> = M.chart() # makes M parallelizable
1116
+ sage: XM = M.vector_field_module()
1117
+ sage: XM.zero()
1118
+ Vector field zero on the 2-dimensional differentiable
1119
+ manifold M
1120
+ """
1121
+ zero = self.element_class(self, name='zero', latex_name='0')
1122
+ for frame in self._domain._frames:
1123
+ if self._dest_map.restrict(frame._domain) == frame._dest_map:
1124
+ zero.add_comp(frame)
1125
+ # (since new components are initialized to zero)
1126
+ zero._is_zero = True # This element is certainly zero
1127
+ zero.set_immutable()
1128
+ return zero
1129
+
1130
+ def metric(self, name: str, signature: Optional[int] = None, latex_name: Optional[str] = None):
1131
+ r"""
1132
+ Construct a metric (symmetric bilinear
1133
+ form) on the current vector field module.
1134
+
1135
+ A metric of the vector field module is actually a
1136
+ field of tangent-space non-degenerate symmetric bilinear forms along
1137
+ the manifold `U` on which the vector field module is defined.
1138
+
1139
+ INPUT:
1140
+
1141
+ - ``name`` -- string; name given to the metric
1142
+ - ``signature`` -- integer (default: ``None``); signature `S` of the
1143
+ metric: `S = n_+ - n_-`, where `n_+` (resp. `n_-`) is the number of
1144
+ positive terms (resp. number of negative terms) in any diagonal
1145
+ writing of the metric components; if ``signature`` is not provided,
1146
+ `S` is set to the manifold's dimension (Riemannian signature)
1147
+ - ``latex_name`` -- (string; default: ``None``) LaTeX symbol to denote
1148
+ the metric; if ``None``, it is formed from ``name``
1149
+
1150
+ OUTPUT:
1151
+
1152
+ - instance of
1153
+ :class:`~sage.manifolds.differentiable.metric.PseudoRiemannianMetric`
1154
+ representing the defined pseudo-Riemannian metric.
1155
+
1156
+ EXAMPLES::
1157
+
1158
+ sage: M = Manifold(2, 'M')
1159
+ sage: XM = M.vector_field_module()
1160
+ sage: XM.metric('g')
1161
+ Riemannian metric g on the 2-dimensional differentiable manifold M
1162
+ sage: XM.metric('g', signature=0)
1163
+ Lorentzian metric g on the 2-dimensional differentiable manifold M
1164
+
1165
+ .. SEEALSO::
1166
+
1167
+ :class:`~sage.manifolds.differentiable.metric.PseudoRiemannianMetric`
1168
+ for more documentation.
1169
+ """
1170
+ # signature:
1171
+ ndim = self._ambient_domain.dimension()
1172
+ try:
1173
+ for elt in signature:
1174
+ if (elt < 0) or (not isinstance(elt, (int, Integer))):
1175
+ raise ValueError("{} must be a positive integer".format(elt))
1176
+ if elt > ndim:
1177
+ raise ValueError("{} must be less than {}".format(elt,ndim))
1178
+ sign = signature[0]+signature[1]+signature[2]
1179
+ if sign != ndim:
1180
+ raise ValueError("{} is different from the dimension".format(sign) +
1181
+ " of the manifold, who is {}".format(ndim))
1182
+ if signature[2] != 0:
1183
+ from sage.manifolds.differentiable.metric import DegenerateMetric
1184
+ return DegenerateMetric(self, name, signature=signature,
1185
+ latex_name=latex_name)
1186
+ except TypeError:
1187
+ pass
1188
+ if signature is None:
1189
+ signature = (ndim,0)
1190
+ if isinstance(signature, (Integer, int)):
1191
+ if (signature+ndim) % 2 == 1:
1192
+ if ndim % 2 == 0:
1193
+ raise ValueError("the metric signature must be even")
1194
+ else:
1195
+ raise ValueError("the metric signature must be odd")
1196
+ signature = (int((ndim+signature)/2), int((ndim-signature)/2))
1197
+ from sage.manifolds.differentiable.metric import PseudoRiemannianMetric
1198
+ return PseudoRiemannianMetric(self, name, signature=signature[0]-signature[1],
1199
+ latex_name=latex_name)
1200
+
1201
+ def symplectic_form(
1202
+ self, name: Optional[str] = None, latex_name: Optional[str] = None
1203
+ ):
1204
+ r"""
1205
+ Construct a symplectic form on the current vector field module.
1206
+
1207
+ OUTPUT:
1208
+
1209
+ - instance of
1210
+ :class:`~sage.manifolds.differentiable.symplectic_form.SymplecticForm`
1211
+
1212
+ EXAMPLES:
1213
+
1214
+ Symplectic form on the 2-sphere::
1215
+
1216
+ sage: M = manifolds.Sphere(2, coordinates='stereographic')
1217
+ sage: XM = M.vector_field_module()
1218
+ sage: omega = XM.symplectic_form(name='omega', latex_name=r'\omega')
1219
+ sage: omega
1220
+ Symplectic form omega on the 2-sphere S^2 of radius 1 smoothly
1221
+ embedded in the Euclidean space E^3
1222
+ """
1223
+ from sage.manifolds.differentiable.symplectic_form import SymplecticForm
1224
+
1225
+ return SymplecticForm(self, name, latex_name)
1226
+
1227
+ def poisson_tensor(
1228
+ self, name: Optional[str] = None, latex_name: Optional[str] = None
1229
+ ):
1230
+ r"""
1231
+ Construct a Poisson tensor on the current vector field module.
1232
+
1233
+ OUTPUT:
1234
+
1235
+ - instance of
1236
+ :class:`~sage.manifolds.differentiable.poisson_tensor.PoissonTensorField`
1237
+
1238
+ EXAMPLES:
1239
+
1240
+ Poisson tensor on the 2-sphere::
1241
+
1242
+ sage: M = manifolds.Sphere(2, coordinates='stereographic')
1243
+ sage: XM = M.vector_field_module()
1244
+ sage: varpi = XM.poisson_tensor(name='varpi', latex_name=r'\varpi')
1245
+ sage: varpi
1246
+ 2-vector field varpi on the 2-sphere S^2 of radius 1 smoothly embedded in the Euclidean space E^3
1247
+ """
1248
+ from sage.manifolds.differentiable.poisson_tensor import PoissonTensorField
1249
+
1250
+ return PoissonTensorField(self, name, latex_name)
1251
+
1252
+
1253
+ #******************************************************************************
1254
+
1255
+ class VectorFieldFreeModule(FiniteRankFreeModule):
1256
+ r"""
1257
+ Free module of vector fields along a differentiable manifold `U` with
1258
+ values on a parallelizable manifold `M`, via a differentiable map
1259
+ `U \rightarrow M`.
1260
+
1261
+ Given a differentiable map
1262
+
1263
+ .. MATH::
1264
+
1265
+ \Phi:\ U \longrightarrow M
1266
+
1267
+ the *vector field module* `\mathfrak{X}(U,\Phi)` is the set of all vector
1268
+ fields of the type
1269
+
1270
+ .. MATH::
1271
+
1272
+ v:\ U \longrightarrow TM
1273
+
1274
+ (where `TM` is the tangent bundle of `M`) such that
1275
+
1276
+ .. MATH::
1277
+
1278
+ \forall p \in U,\ v(p) \in T_{\Phi(p)} M,
1279
+
1280
+ where `T_{\Phi(p)} M` is the tangent space to `M` at the point `\Phi(p)`.
1281
+
1282
+ Since `M` is parallelizable, the set `\mathfrak{X}(U,\Phi)` is a
1283
+ free module over `C^k(U)`, the ring (algebra) of differentiable
1284
+ scalar fields on `U` (see
1285
+ :class:`~sage.manifolds.differentiable.scalarfield_algebra.DiffScalarFieldAlgebra`).
1286
+ In fact, it carries the structure of a finite-dimensional Lie algebroid
1287
+ (cf. :wikipedia:`Lie_algebroid`).
1288
+
1289
+ The standard case of vector fields *on* a differentiable manifold
1290
+ corresponds to `U=M` and `\Phi = \mathrm{Id}_M`; we then denote
1291
+ `\mathfrak{X}(M,\mathrm{Id}_M)` by merely `\mathfrak{X}(M)`. Other common
1292
+ cases are `\Phi` being an immersion and `\Phi` being a curve in `M` (`U` is
1293
+ then an open interval of `\RR`).
1294
+
1295
+ .. NOTE::
1296
+
1297
+ If `M` is not parallelizable, the class :class:`VectorFieldModule`
1298
+ should be used instead, for `\mathfrak{X}(U,\Phi)` is no longer a
1299
+ free module.
1300
+
1301
+ INPUT:
1302
+
1303
+ - ``domain`` -- differentiable manifold `U` along which the vector fields
1304
+ are defined
1305
+ - ``dest_map`` -- (default: ``None``) destination map
1306
+ `\Phi:\ U \rightarrow M`
1307
+ (type: :class:`~sage.manifolds.differentiable.diff_map.DiffMap`); if
1308
+ ``None``, it is assumed that `U=M` and `\Phi` is the identity map of
1309
+ `M` (case of vector fields *on* `M`)
1310
+
1311
+ EXAMPLES:
1312
+
1313
+ Module of vector fields on `\RR^2`::
1314
+
1315
+ sage: M = Manifold(2, 'R^2')
1316
+ sage: cart.<x,y> = M.chart() # Cartesian coordinates on R^2
1317
+ sage: XM = M.vector_field_module() ; XM
1318
+ Free module X(R^2) of vector fields on the 2-dimensional differentiable
1319
+ manifold R^2
1320
+ sage: XM.category()
1321
+ Category of finite dimensional modules
1322
+ over Algebra of differentiable scalar fields
1323
+ on the 2-dimensional differentiable manifold R^2
1324
+ sage: XM.base_ring() is M.scalar_field_algebra()
1325
+ True
1326
+
1327
+ Since `\RR^2` is obviously parallelizable, ``XM`` is a free module::
1328
+
1329
+ sage: isinstance(XM, FiniteRankFreeModule)
1330
+ True
1331
+
1332
+ Some elements::
1333
+
1334
+ sage: XM.an_element().display()
1335
+ 2 ∂/∂x + 2 ∂/∂y
1336
+ sage: XM.zero().display()
1337
+ zero = 0
1338
+ sage: v = XM([-y,x]) ; v
1339
+ Vector field on the 2-dimensional differentiable manifold R^2
1340
+ sage: v.display()
1341
+ -y ∂/∂x + x ∂/∂y
1342
+
1343
+ An example of module of vector fields with a destination map `\Phi`
1344
+ different from the identity map, namely a mapping
1345
+ `\Phi: I \rightarrow \RR^2`, where `I` is an open interval of `\RR`::
1346
+
1347
+ sage: I = Manifold(1, 'I')
1348
+ sage: canon.<t> = I.chart('t:(0,2*pi)')
1349
+ sage: Phi = I.diff_map(M, coord_functions=[cos(t), sin(t)], name='Phi',
1350
+ ....: latex_name=r'\Phi') ; Phi
1351
+ Differentiable map Phi from the 1-dimensional differentiable manifold
1352
+ I to the 2-dimensional differentiable manifold R^2
1353
+ sage: Phi.display()
1354
+ Phi: I → R^2
1355
+ t ↦ (x, y) = (cos(t), sin(t))
1356
+ sage: XIM = I.vector_field_module(dest_map=Phi) ; XIM
1357
+ Free module X(I,Phi) of vector fields along the 1-dimensional
1358
+ differentiable manifold I mapped into the 2-dimensional differentiable
1359
+ manifold R^2
1360
+ sage: XIM.category()
1361
+ Category of finite dimensional modules
1362
+ over Algebra of differentiable scalar fields
1363
+ on the 1-dimensional differentiable manifold I
1364
+
1365
+ The rank of the free module `\mathfrak{X}(I,\Phi)` is the dimension
1366
+ of the manifold `\RR^2`, namely two::
1367
+
1368
+ sage: XIM.rank()
1369
+ 2
1370
+
1371
+ A basis of it is induced by the coordinate vector frame of `\RR^2`::
1372
+
1373
+ sage: XIM.bases()
1374
+ [Vector frame (I, (∂/∂x,∂/∂y)) with values on the 2-dimensional
1375
+ differentiable manifold R^2]
1376
+
1377
+ Some elements of this module::
1378
+
1379
+ sage: XIM.an_element().display()
1380
+ 2 ∂/∂x + 2 ∂/∂y
1381
+ sage: v = XIM([t, t^2]) ; v
1382
+ Vector field along the 1-dimensional differentiable manifold I with
1383
+ values on the 2-dimensional differentiable manifold R^2
1384
+ sage: v.display()
1385
+ t ∂/∂x + t^2 ∂/∂y
1386
+
1387
+ The test suite is passed::
1388
+
1389
+ sage: TestSuite(XIM).run()
1390
+
1391
+ Let us introduce an open subset of `J\subset I` and the vector field module
1392
+ corresponding to the restriction of `\Phi` to it::
1393
+
1394
+ sage: J = I.open_subset('J', coord_def={canon: t<pi})
1395
+ sage: XJM = J.vector_field_module(dest_map=Phi.restrict(J)); XJM
1396
+ Free module X(J,Phi) of vector fields along the Open subset J of the
1397
+ 1-dimensional differentiable manifold I mapped into the 2-dimensional
1398
+ differentiable manifold R^2
1399
+
1400
+ We have then::
1401
+
1402
+ sage: XJM.default_basis()
1403
+ Vector frame (J, (∂/∂x,∂/∂y)) with values on the 2-dimensional
1404
+ differentiable manifold R^2
1405
+ sage: XJM.default_basis() is XIM.default_basis().restrict(J)
1406
+ True
1407
+ sage: v.restrict(J)
1408
+ Vector field along the Open subset J of the 1-dimensional
1409
+ differentiable manifold I with values on the 2-dimensional
1410
+ differentiable manifold R^2
1411
+ sage: v.restrict(J).display()
1412
+ t ∂/∂x + t^2 ∂/∂y
1413
+
1414
+ Let us now consider the module of vector fields on the circle `S^1`; we
1415
+ start by constructing the `S^1` manifold::
1416
+
1417
+ sage: M = Manifold(1, 'S^1')
1418
+ sage: U = M.open_subset('U') # the complement of one point
1419
+ sage: c_t.<t> = U.chart('t:(0,2*pi)') # the standard angle coordinate
1420
+ sage: V = M.open_subset('V') # the complement of the point t=pi
1421
+ sage: M.declare_union(U,V) # S^1 is the union of U and V
1422
+ sage: c_u.<u> = V.chart('u:(0,2*pi)') # the angle t-pi
1423
+ sage: t_to_u = c_t.transition_map(c_u, (t-pi,), intersection_name='W',
1424
+ ....: restrictions1 = t!=pi, restrictions2 = u!=pi)
1425
+ sage: u_to_t = t_to_u.inverse()
1426
+ sage: W = U.intersection(V)
1427
+
1428
+ `S^1` cannot be covered by a single chart, so it cannot be covered by
1429
+ a coordinate frame. It is however parallelizable and we introduce a global
1430
+ vector frame as follows. We notice that on their common subdomain, `W`,
1431
+ the coordinate vectors `\partial/\partial t` and `\partial/\partial u`
1432
+ coincide, as we can check explicitly::
1433
+
1434
+ sage: c_t.frame()[0].display(c_u.frame().restrict(W))
1435
+ ∂/∂t = ∂/∂u
1436
+
1437
+ Therefore, we can extend `\partial/\partial t` to all `V` and hence to all
1438
+ `S^1`, to form a vector field on `S^1` whose components w.r.t. both
1439
+ `\partial/\partial t` and `\partial/\partial u` are 1::
1440
+
1441
+ sage: e = M.vector_frame('e')
1442
+ sage: U.set_change_of_frame(e.restrict(U), c_t.frame(),
1443
+ ....: U.tangent_identity_field())
1444
+ sage: V.set_change_of_frame(e.restrict(V), c_u.frame(),
1445
+ ....: V.tangent_identity_field())
1446
+ sage: e[0].display(c_t.frame())
1447
+ e_0 = ∂/∂t
1448
+ sage: e[0].display(c_u.frame())
1449
+ e_0 = ∂/∂u
1450
+
1451
+ Equipped with the frame `e`, the manifold `S^1` is manifestly
1452
+ parallelizable::
1453
+
1454
+ sage: M.is_manifestly_parallelizable()
1455
+ True
1456
+
1457
+ Consequently, the module of vector fields on `S^1` is a free module::
1458
+
1459
+ sage: XM = M.vector_field_module() ; XM
1460
+ Free module X(S^1) of vector fields on the 1-dimensional differentiable
1461
+ manifold S^1
1462
+ sage: isinstance(XM, FiniteRankFreeModule)
1463
+ True
1464
+ sage: XM.category()
1465
+ Category of finite dimensional modules
1466
+ over Algebra of differentiable scalar fields
1467
+ on the 1-dimensional differentiable manifold S^1
1468
+ sage: XM.base_ring() is M.scalar_field_algebra()
1469
+ True
1470
+
1471
+ The zero element::
1472
+
1473
+ sage: z = XM.zero() ; z
1474
+ Vector field zero on the 1-dimensional differentiable manifold S^1
1475
+ sage: z.display()
1476
+ zero = 0
1477
+ sage: z.display(c_t.frame())
1478
+ zero = 0
1479
+
1480
+ The module `\mathfrak{X}(S^1)` coerces to any module of vector fields
1481
+ defined on a subdomain of `S^1`, for instance `\mathfrak{X}(U)`::
1482
+
1483
+ sage: XU = U.vector_field_module() ; XU
1484
+ Free module X(U) of vector fields on the Open subset U of the
1485
+ 1-dimensional differentiable manifold S^1
1486
+ sage: XU.has_coerce_map_from(XM)
1487
+ True
1488
+ sage: XU.coerce_map_from(XM)
1489
+ Coercion map:
1490
+ From: Free module X(S^1) of vector fields on the 1-dimensional
1491
+ differentiable manifold S^1
1492
+ To: Free module X(U) of vector fields on the Open subset U of the
1493
+ 1-dimensional differentiable manifold S^1
1494
+
1495
+ The conversion map is actually the restriction of vector fields defined
1496
+ on `S^1` to `U`.
1497
+
1498
+ The Sage test suite for modules is passed::
1499
+
1500
+ sage: TestSuite(XM).run()
1501
+ """
1502
+
1503
+ Element = VectorFieldParal
1504
+
1505
+ def __init__(self, domain, dest_map=None):
1506
+ r"""
1507
+ Construct the free module of vector fields with values on a
1508
+ parallelizable manifold.
1509
+
1510
+ TESTS::
1511
+
1512
+ sage: M = Manifold(2, 'M')
1513
+ sage: X.<x,y> = M.chart() # makes M parallelizable
1514
+ sage: from sage.manifolds.differentiable.vectorfield_module \
1515
+ ....: import VectorFieldFreeModule
1516
+ sage: XM = VectorFieldFreeModule(M, dest_map=M.identity_map()); XM
1517
+ Free module X(M) of vector fields on the 2-dimensional
1518
+ differentiable manifold M
1519
+ sage: XM is M.vector_field_module()
1520
+ True
1521
+ sage: TestSuite(XM).run()
1522
+ """
1523
+ from sage.manifolds.differentiable.scalarfield import DiffScalarField
1524
+ self._domain = domain
1525
+ if dest_map is None:
1526
+ dest_map = domain.identity_map()
1527
+ self._dest_map = dest_map
1528
+ self._ambient_domain = self._dest_map._codomain
1529
+ name = "X(" + domain._name
1530
+ latex_name = r"\mathfrak{X}\left(" + domain._latex_name
1531
+ if dest_map is not domain.identity_map():
1532
+ dm_name = dest_map._name
1533
+ dm_latex_name = dest_map._latex_name
1534
+ if dm_name is None:
1535
+ dm_name = "unnamed map"
1536
+ if dm_latex_name is None:
1537
+ dm_latex_name = r"\mathrm{unnamed\; map}"
1538
+ name += "," + dm_name
1539
+ latex_name += "," + dm_latex_name
1540
+ name += ")"
1541
+ latex_name += r"\right)"
1542
+ manif = self._ambient_domain.manifold()
1543
+ cat = Modules(domain.scalar_field_algebra()).FiniteDimensional()
1544
+ FiniteRankFreeModule.__init__(self, domain.scalar_field_algebra(),
1545
+ manif._dim, name=name, latex_name=latex_name,
1546
+ start_index=manif._sindex,
1547
+ output_formatter=DiffScalarField.coord_function,
1548
+ category=cat)
1549
+ #
1550
+ # Special treatment when self._dest_map != identity:
1551
+ # bases of self are created from vector frames of the ambient domain
1552
+ #
1553
+ self._induced_bases = {}
1554
+ if self._dest_map != self._domain.identity_map():
1555
+ for frame in self._ambient_domain._top_frames:
1556
+ if (frame.destination_map() ==
1557
+ self._ambient_domain.identity_map()):
1558
+ basis = self.basis(from_frame=frame)
1559
+ self._induced_bases[frame] = basis
1560
+
1561
+ # basis is added to the restrictions of bases on a larger
1562
+ # domain
1563
+ for dom in domain.open_supersets():
1564
+ if dom is not domain:
1565
+ for supbase in dom._frames:
1566
+ if (supbase.domain() is dom and
1567
+ supbase.destination_map().restrict(domain)
1568
+ is self._dest_map and
1569
+ domain not in supbase._restrictions):
1570
+ supbase._restrictions[domain] = basis
1571
+ supbase._subframes.add(basis)
1572
+ basis._superframes.add(supbase)
1573
+
1574
+ # basis is added as a superframe of smaller domain
1575
+ for superframe in basis._superframes:
1576
+ for subframe in superframe._subframes:
1577
+ if subframe.domain() is not domain and subframe.domain().is_subset(
1578
+ self._domain) and self._dest_map.restrict(
1579
+ subframe.domain()) is subframe.destination_map():
1580
+ subframe._superframes.update(basis._superframes)
1581
+ basis._subframes.update(subframe._subframes)
1582
+ basis._restrictions.update(subframe._restrictions)
1583
+
1584
+ #### Parent methods
1585
+
1586
+ def _element_constructor_(self, comp=[], basis=None, name=None,
1587
+ latex_name=None):
1588
+ r"""
1589
+ Construct an element of ``self``.
1590
+
1591
+ TESTS::
1592
+
1593
+ sage: M = Manifold(2, 'M')
1594
+ sage: X.<x,y> = M.chart() # makes M parallelizable
1595
+ sage: XM = M.vector_field_module()
1596
+ sage: v = XM([-y,x], name='v'); v
1597
+ Vector field v on the 2-dimensional differentiable manifold M
1598
+ sage: v.display()
1599
+ v = -y ∂/∂x + x ∂/∂y
1600
+ sage: XM(0) is XM.zero()
1601
+ True
1602
+ """
1603
+ try:
1604
+ if comp.is_trivial_zero():
1605
+ return self.zero()
1606
+ except AttributeError:
1607
+ if comp == 0:
1608
+ return self.zero()
1609
+ if isinstance(comp, VectorField):
1610
+ if (self._domain.is_subset(comp._domain)
1611
+ and self._ambient_domain.is_subset(comp._ambient_domain)):
1612
+ return comp.restrict(self._domain)
1613
+ else:
1614
+ raise ValueError("cannot convert the {}".format(comp) +
1615
+ "to a vector field in {}".format(self))
1616
+ if not isinstance(comp, (list, tuple)):
1617
+ raise TypeError("cannot convert the {} ".format(comp) +
1618
+ "to an element of {}".format(self))
1619
+ # standard construction
1620
+ resu = self.element_class(self, name=name, latex_name=latex_name)
1621
+ if comp:
1622
+ resu.set_comp(basis=basis)[:] = comp
1623
+ return resu
1624
+
1625
+ # Rem: _an_element_ is declared in the superclass FiniteRankFreeModule
1626
+
1627
+ def _coerce_map_from_(self, other):
1628
+ r"""
1629
+ Determine whether coercion to ``self`` exists from parent ``other``.
1630
+
1631
+ TESTS::
1632
+
1633
+ sage: M = Manifold(2, 'M')
1634
+ sage: X.<x,y> = M.chart() # makes M parallelizable
1635
+ sage: U = M.open_subset('U')
1636
+ sage: XM = M.vector_field_module()
1637
+ sage: XU = U.vector_field_module()
1638
+ sage: XM._coerce_map_from_(XU)
1639
+ False
1640
+ sage: XU._coerce_map_from_(XM)
1641
+ True
1642
+ """
1643
+ if isinstance(other, (VectorFieldModule, VectorFieldFreeModule)):
1644
+ return (self._domain.is_subset(other._domain)
1645
+ and self._ambient_domain.is_subset(other._ambient_domain))
1646
+ else:
1647
+ return False
1648
+
1649
+ #### End of parent methods
1650
+
1651
+ #### Methods to be redefined by derived classes of FiniteRankFreeModule ####
1652
+
1653
+ def _repr_(self):
1654
+ r"""
1655
+ String representation of ``self``.
1656
+
1657
+ TESTS::
1658
+
1659
+ sage: M = Manifold(2, 'M')
1660
+ sage: X.<x,y> = M.chart() # makes M parallelizable
1661
+ sage: XM = M.vector_field_module()
1662
+ sage: XM._repr_()
1663
+ 'Free module X(M) of vector fields on the 2-dimensional differentiable manifold M'
1664
+ sage: repr(XM) # indirect doctest
1665
+ 'Free module X(M) of vector fields on the 2-dimensional differentiable manifold M'
1666
+ sage: XM # indirect doctest
1667
+ Free module X(M) of vector fields on the 2-dimensional
1668
+ differentiable manifold M
1669
+ """
1670
+ description = "Free module "
1671
+ if self._name is not None:
1672
+ description += self._name + " "
1673
+ description += "of vector fields "
1674
+ if self._dest_map is self._domain.identity_map():
1675
+ description += "on the {}".format(self._domain)
1676
+ else:
1677
+ description += "along the {}".format(self._domain) + \
1678
+ " mapped into the {}".format(self._ambient_domain)
1679
+ return description
1680
+
1681
+ def domain(self) -> DifferentiableManifold:
1682
+ r"""
1683
+ Return the domain of the vector fields in ``self``.
1684
+
1685
+ If the module is `\mathfrak{X}(U, \Phi)`, returns the domain `U`
1686
+ of `\Phi`.
1687
+
1688
+ OUTPUT:
1689
+
1690
+ - a
1691
+ :class:`~sage.manifolds.differentiable.manifold.DifferentiableManifold`
1692
+ representing the domain of the vector fields that belong to this
1693
+ module
1694
+
1695
+ EXAMPLES::
1696
+
1697
+ sage: M = Manifold(3, 'M')
1698
+ sage: X.<x,y,z> = M.chart() # makes M parallelizable
1699
+ sage: XM = M.vector_field_module()
1700
+ sage: XM.domain()
1701
+ 3-dimensional differentiable manifold M
1702
+ sage: U = Manifold(2, 'U')
1703
+ sage: Y.<u,v> = U.chart()
1704
+ sage: Phi = U.diff_map(M, {(Y,X): [u+v, u-v, u*v]}, name='Phi')
1705
+ sage: XU = U.vector_field_module(dest_map=Phi)
1706
+ sage: XU.domain()
1707
+ 2-dimensional differentiable manifold U
1708
+ """
1709
+ return self._domain
1710
+
1711
+ def ambient_domain(self) -> DifferentiableManifold:
1712
+ r"""
1713
+ Return the manifold in which the vector fields of ``self``
1714
+ take their values.
1715
+
1716
+ If the module is `\mathfrak{X}(U, \Phi)`, returns the codomain `M`
1717
+ of `\Phi`.
1718
+
1719
+ OUTPUT:
1720
+
1721
+ - a
1722
+ :class:`~sage.manifolds.differentiable.manifold.DifferentiableManifold`
1723
+ representing the manifold in which the vector fields of ``self``
1724
+ take their values
1725
+
1726
+ EXAMPLES::
1727
+
1728
+ sage: M = Manifold(3, 'M')
1729
+ sage: X.<x,y,z> = M.chart() # makes M parallelizable
1730
+ sage: XM = M.vector_field_module()
1731
+ sage: XM.ambient_domain()
1732
+ 3-dimensional differentiable manifold M
1733
+ sage: U = Manifold(2, 'U')
1734
+ sage: Y.<u,v> = U.chart()
1735
+ sage: Phi = U.diff_map(M, {(Y,X): [u+v, u-v, u*v]}, name='Phi')
1736
+ sage: XU = U.vector_field_module(dest_map=Phi)
1737
+ sage: XU.ambient_domain()
1738
+ 3-dimensional differentiable manifold M
1739
+ """
1740
+ return self._ambient_domain
1741
+
1742
+ def destination_map(self) -> DiffMap:
1743
+ r"""
1744
+ Return the differential map associated to ``self``.
1745
+
1746
+ The differential map associated to this module is the map
1747
+
1748
+ .. MATH::
1749
+
1750
+ \Phi:\ U \longrightarrow M
1751
+
1752
+ such that this module is the set `\mathfrak{X}(U,\Phi)` of all vector
1753
+ fields of the type
1754
+
1755
+ .. MATH::
1756
+
1757
+ v:\ U \longrightarrow TM
1758
+
1759
+ (where `TM` is the tangent bundle of `M`) such that
1760
+
1761
+ .. MATH::
1762
+
1763
+ \forall p \in U,\ v(p) \in T_{\Phi(p)} M,
1764
+
1765
+ where `T_{\Phi(p)} M` is the tangent space to `M` at the
1766
+ point `\Phi(p)`.
1767
+
1768
+ OUTPUT:
1769
+
1770
+ - a :class:`~sage.manifolds.differentiable.diff_map.DiffMap`
1771
+ representing the differential map `\Phi`
1772
+
1773
+ EXAMPLES::
1774
+
1775
+ sage: M = Manifold(3, 'M')
1776
+ sage: X.<x,y,z> = M.chart() # makes M parallelizable
1777
+ sage: XM = M.vector_field_module()
1778
+ sage: XM.destination_map()
1779
+ Identity map Id_M of the 3-dimensional differentiable manifold M
1780
+ sage: U = Manifold(2, 'U')
1781
+ sage: Y.<u,v> = U.chart()
1782
+ sage: Phi = U.diff_map(M, {(Y,X): [u+v, u-v, u*v]}, name='Phi')
1783
+ sage: XU = U.vector_field_module(dest_map=Phi)
1784
+ sage: XU.destination_map()
1785
+ Differentiable map Phi from the 2-dimensional differentiable
1786
+ manifold U to the 3-dimensional differentiable manifold M
1787
+ """
1788
+ return self._dest_map
1789
+
1790
+ def tensor_module(self, k, l, *, sym=None, antisym=None):
1791
+ r"""
1792
+ Return the free module of all tensors of type `(k, l)` defined
1793
+ on ``self``.
1794
+
1795
+ INPUT:
1796
+
1797
+ - ``k`` -- nonnegative integer; the contravariant rank,
1798
+ the tensor type being `(k, l)`
1799
+ - ``l`` -- nonnegative integer; the covariant rank,
1800
+ the tensor type being `(k, l)`
1801
+
1802
+ OUTPUT:
1803
+
1804
+ - a
1805
+ :class:`~sage.manifolds.differentiable.tensorfield_module.TensorFieldFreeModule`
1806
+ representing the free module of type-`(k,l)` tensors on the
1807
+ vector field module
1808
+
1809
+ EXAMPLES:
1810
+
1811
+ A tensor field module on a 2-dimensional differentiable manifold::
1812
+
1813
+ sage: M = Manifold(2, 'M')
1814
+ sage: X.<x,y> = M.chart() # makes M parallelizable
1815
+ sage: XM = M.vector_field_module()
1816
+ sage: XM.tensor_module(1,2)
1817
+ Free module T^(1,2)(M) of type-(1,2) tensors fields on the
1818
+ 2-dimensional differentiable manifold M
1819
+
1820
+ The special case of tensor fields of type (1,0)::
1821
+
1822
+ sage: XM.tensor_module(1,0)
1823
+ Free module X(M) of vector fields on the 2-dimensional
1824
+ differentiable manifold M
1825
+
1826
+ The result is cached::
1827
+
1828
+ sage: XM.tensor_module(1,2) is XM.tensor_module(1,2)
1829
+ True
1830
+ sage: XM.tensor_module(1,0) is XM
1831
+ True
1832
+
1833
+ .. SEEALSO::
1834
+
1835
+ :class:`~sage.manifolds.differentiable.tensorfield_module.TensorFieldFreeModule`
1836
+ for more examples and documentation.
1837
+ """
1838
+ if sym or antisym:
1839
+ raise NotImplementedError
1840
+ try:
1841
+ return self._tensor_modules[(k,l)]
1842
+ except KeyError:
1843
+ if (k, l) == (1, 0):
1844
+ T = self
1845
+ elif (k, l) == (0, 1):
1846
+ T = self.dual()
1847
+ else:
1848
+ from sage.manifolds.differentiable.tensorfield_module import (
1849
+ TensorFieldFreeModule,
1850
+ )
1851
+ T = TensorFieldFreeModule(self, (k,l))
1852
+ self._tensor_modules[(k,l)] = T
1853
+ return T
1854
+
1855
+ def exterior_power(self, p):
1856
+ r"""
1857
+ Return the `p`-th exterior power of ``self``.
1858
+
1859
+ If the vector field module ``self`` is `\mathfrak{X}(U,\Phi)`,
1860
+ its `p`-th exterior power is the set `A^p(U, \Phi)` of
1861
+ `p`-vector fields along `U` with values on `\Phi(U)`. It is a
1862
+ free module over `C^k(U)`, the ring (algebra) of differentiable
1863
+ scalar fields on `U`.
1864
+
1865
+ INPUT:
1866
+
1867
+ - ``p`` -- nonnegative integer
1868
+
1869
+ OUTPUT:
1870
+
1871
+ - for `p=0`, the base ring, i.e. `C^k(U)`
1872
+ - for `p=1`, the vector field free module ``self``, since
1873
+ `A^1(U, \Phi) = \mathfrak{X}(U,\Phi)`
1874
+ - for `p \geq 2`, instance of
1875
+ :class:`~sage.manifolds.differentiable.multivector_module.MultivectorFreeModule`
1876
+ representing the module `A^p(U,\Phi)`
1877
+
1878
+ EXAMPLES::
1879
+
1880
+ sage: M = Manifold(2, 'M')
1881
+ sage: X.<x,y> = M.chart() # makes M parallelizable
1882
+ sage: XM = M.vector_field_module()
1883
+ sage: XM.exterior_power(2)
1884
+ Free module A^2(M) of 2-vector fields on the 2-dimensional
1885
+ differentiable manifold M
1886
+ sage: XM.exterior_power(1)
1887
+ Free module X(M) of vector fields on the 2-dimensional
1888
+ differentiable manifold M
1889
+ sage: XM.exterior_power(1) is XM
1890
+ True
1891
+ sage: XM.exterior_power(0)
1892
+ Algebra of differentiable scalar fields on the 2-dimensional
1893
+ differentiable manifold M
1894
+ sage: XM.exterior_power(0) is M.scalar_field_algebra()
1895
+ True
1896
+
1897
+ .. SEEALSO::
1898
+
1899
+ :class:`~sage.manifolds.differentiable.multivector_module.MultivectorFreeModule`
1900
+ for more examples and documentation.
1901
+ """
1902
+ try:
1903
+ return self._exterior_powers[p]
1904
+ except KeyError:
1905
+ if p == 0:
1906
+ L = self._ring
1907
+ elif p == 1:
1908
+ L = self
1909
+ else:
1910
+ from sage.manifolds.differentiable.multivector_module import (
1911
+ MultivectorFreeModule,
1912
+ )
1913
+ L = MultivectorFreeModule(self, p)
1914
+ self._exterior_powers[p] = L
1915
+ return L
1916
+
1917
+ def dual_exterior_power(self, p):
1918
+ r"""
1919
+ Return the `p`-th exterior power of the dual of ``self``.
1920
+
1921
+ If the vector field module ``self`` is `\mathfrak{X}(U,\Phi)`,
1922
+ the `p`-th exterior power of its dual is the set
1923
+ `\Omega^p(U, \Phi)` of `p`-forms along `U` with values on
1924
+ `\Phi(U)`. It is a free module over `C^k(U)`, the ring (algebra)
1925
+ of differentiable scalar fields on `U`.
1926
+
1927
+ INPUT:
1928
+
1929
+ - ``p`` -- nonnegative integer
1930
+
1931
+ OUTPUT:
1932
+
1933
+ - for `p=0`, the base ring, i.e. `C^k(U)`
1934
+ - for `p \geq 1`, a
1935
+ :class:`~sage.manifolds.differentiable.diff_form_module.DiffFormFreeModule`
1936
+ representing the module `\Omega^p(U,\Phi)`
1937
+
1938
+ EXAMPLES::
1939
+
1940
+ sage: M = Manifold(2, 'M')
1941
+ sage: X.<x,y> = M.chart() # makes M parallelizable
1942
+ sage: XM = M.vector_field_module()
1943
+ sage: XM.dual_exterior_power(2)
1944
+ Free module Omega^2(M) of 2-forms on the 2-dimensional
1945
+ differentiable manifold M
1946
+ sage: XM.dual_exterior_power(1)
1947
+ Free module Omega^1(M) of 1-forms on the 2-dimensional differentiable manifold M
1948
+ sage: XM.dual_exterior_power(1) is XM.dual()
1949
+ True
1950
+ sage: XM.dual_exterior_power(0)
1951
+ Algebra of differentiable scalar fields on the 2-dimensional
1952
+ differentiable manifold M
1953
+ sage: XM.dual_exterior_power(0) is M.scalar_field_algebra()
1954
+ True
1955
+
1956
+ .. SEEALSO::
1957
+
1958
+ :class:`~sage.manifolds.differentiable.diff_form_module.DiffFormFreeModule`
1959
+ for more examples and documentation.
1960
+ """
1961
+ try:
1962
+ return self._dual_exterior_powers[p]
1963
+ except KeyError:
1964
+ if p == 0:
1965
+ L = self._ring
1966
+ elif p == 1:
1967
+ from sage.manifolds.differentiable.diff_form_module import (
1968
+ VectorFieldDualFreeModule,
1969
+ )
1970
+ L = VectorFieldDualFreeModule(self)
1971
+ else:
1972
+ from sage.manifolds.differentiable.diff_form_module import (
1973
+ DiffFormFreeModule,
1974
+ )
1975
+ L = DiffFormFreeModule(self, p)
1976
+ self._dual_exterior_powers[p] = L
1977
+ return L
1978
+
1979
+ def general_linear_group(self):
1980
+ r"""
1981
+ Return the general linear group of ``self``.
1982
+
1983
+ If the vector field module is `\mathfrak{X}(U,\Phi)`, the *general
1984
+ linear group* is the group `\mathrm{GL}(\mathfrak{X}(U,\Phi))` of
1985
+ automorphisms of `\mathfrak{X}(U,\Phi)`. Note that an automorphism of
1986
+ `\mathfrak{X}(U,\Phi)` can also be viewed as a *field* along `U` of
1987
+ automorphisms of the tangent spaces of `V=\Phi(U)`.
1988
+
1989
+ OUTPUT:
1990
+
1991
+ - a
1992
+ :class:`~sage.manifolds.differentiable.automorphismfield_group.AutomorphismFieldParalGroup`
1993
+ representing `\mathrm{GL}(\mathfrak{X}(U,\Phi))`
1994
+
1995
+ EXAMPLES::
1996
+
1997
+ sage: M = Manifold(2, 'M')
1998
+ sage: X.<x,y> = M.chart() # makes M parallelizable
1999
+ sage: XM = M.vector_field_module()
2000
+ sage: XM.general_linear_group()
2001
+ General linear group of the Free module X(M) of vector fields on
2002
+ the 2-dimensional differentiable manifold M
2003
+
2004
+ .. SEEALSO::
2005
+
2006
+ :class:`~sage.manifolds.differentiable.automorphismfield_group.AutomorphismFieldParalGroup`
2007
+ for more examples and documentation.
2008
+ """
2009
+ from sage.manifolds.differentiable.automorphismfield_group import (
2010
+ AutomorphismFieldParalGroup,
2011
+ )
2012
+ return AutomorphismFieldParalGroup(self)
2013
+
2014
+ def basis(self, symbol=None, latex_symbol=None, from_frame=None,
2015
+ indices=None, latex_indices=None, symbol_dual=None,
2016
+ latex_symbol_dual=None):
2017
+ r"""
2018
+ Define a basis of ``self``.
2019
+
2020
+ A basis of the vector field module is actually a vector frame along
2021
+ the differentiable manifold `U` over which the vector field module
2022
+ is defined.
2023
+
2024
+ If the basis specified by the given symbol already exists, it is
2025
+ simply returned.
2026
+ If no argument is provided the module's default basis is returned.
2027
+
2028
+ INPUT:
2029
+
2030
+ - ``symbol`` -- (default: ``None``) either a string, to be used as a
2031
+ common base for the symbols of the elements of the basis, or a
2032
+ tuple of strings, representing the individual symbols of the
2033
+ elements of the basis
2034
+ - ``latex_symbol`` -- (default: ``None``) either a string, to be used
2035
+ as a common base for the LaTeX symbols of the elements of the basis,
2036
+ or a tuple of strings, representing the individual LaTeX symbols
2037
+ of the elements of the basis; if ``None``, ``symbol`` is used in
2038
+ place of ``latex_symbol``
2039
+ - ``from_frame`` -- (default: ``None``) vector frame `\tilde{e}`
2040
+ on the codomain `M` of the destination map `\Phi` of ``self``;
2041
+ the returned basis `e` is then such that for all `p \in U`,
2042
+ we have `e(p) = \tilde{e}(\Phi(p))`
2043
+ - ``indices`` -- (default: ``None``; used only if ``symbol`` is a
2044
+ single string) tuple of strings representing the indices
2045
+ labelling the elements of the basis; if ``None``, the indices will be
2046
+ generated as integers within the range declared on ``self``
2047
+ - ``latex_indices`` -- (default: ``None``) tuple of strings
2048
+ representing the indices for the LaTeX symbols of the elements of
2049
+ the basis; if ``None``, ``indices`` is used instead
2050
+ - ``symbol_dual`` -- (default: ``None``) same as ``symbol`` but for the
2051
+ dual basis; if ``None``, ``symbol`` must be a string and is used
2052
+ for the common base of the symbols of the elements of the dual basis
2053
+ - ``latex_symbol_dual`` -- (default: ``None``) same as ``latex_symbol``
2054
+ but for the dual basis
2055
+
2056
+ OUTPUT:
2057
+
2058
+ - a :class:`~sage.manifolds.differentiable.vectorframe.VectorFrame`
2059
+ representing a basis on ``self``
2060
+
2061
+ EXAMPLES::
2062
+
2063
+ sage: M = Manifold(2, 'M')
2064
+ sage: X.<x,y> = M.chart() # makes M parallelizable
2065
+ sage: XM = M.vector_field_module()
2066
+ sage: e = XM.basis('e'); e
2067
+ Vector frame (M, (e_0,e_1))
2068
+
2069
+ See :class:`~sage.manifolds.differentiable.vectorframe.VectorFrame`
2070
+ for more examples and documentation.
2071
+ """
2072
+ from sage.manifolds.differentiable.vectorframe import VectorFrame
2073
+ if symbol is None:
2074
+ if from_frame is None:
2075
+ return self.default_basis()
2076
+ else:
2077
+ symbol = from_frame._symbol
2078
+ latex_symbol = from_frame._latex_symbol
2079
+ indices = from_frame._indices
2080
+ latex_indices = from_frame._latex_indices
2081
+ symbol_dual = from_frame._symbol_dual
2082
+ latex_symbol_dual = from_frame._latex_symbol_dual
2083
+ for other in self._known_bases:
2084
+ if symbol == other._symbol:
2085
+ return other
2086
+ return VectorFrame(self, symbol, latex_symbol=latex_symbol,
2087
+ from_frame=from_frame, indices=indices,
2088
+ latex_indices=latex_indices,
2089
+ symbol_dual=symbol_dual,
2090
+ latex_symbol_dual=latex_symbol_dual)
2091
+
2092
+ def _tensor(self, tensor_type, name=None, latex_name=None, sym=None,
2093
+ antisym=None, specific_type=None):
2094
+ r"""
2095
+ Construct a tensor on ``self``.
2096
+
2097
+ The tensor is actually a tensor field along the differentiable
2098
+ manifold `U` over which ``self`` is defined.
2099
+
2100
+ INPUT:
2101
+
2102
+ - ``tensor_type`` -- pair (k,l) with k being the contravariant rank
2103
+ and l the covariant rank
2104
+ - ``name`` -- (string; default: ``None``) name given to the tensor
2105
+ - ``latex_name`` -- (string; default: ``None``) LaTeX symbol to denote
2106
+ the tensor; if none is provided, the LaTeX symbol is set to ``name``
2107
+ - ``sym`` -- (default: ``None``) a symmetry or a list of symmetries
2108
+ among the tensor arguments: each symmetry is described by a tuple
2109
+ containing the positions of the involved arguments, with the
2110
+ convention position=0 for the first argument; for instance:
2111
+
2112
+ * ``sym = (0,1)`` for a symmetry between the 1st and 2nd arguments
2113
+ * ``sym = [(0,2), (1,3,4)]`` for a symmetry between the 1st and 3rd
2114
+ arguments and a symmetry between the 2nd, 4th and 5th arguments
2115
+
2116
+ - ``antisym`` -- (default: ``None``) antisymmetry or list of
2117
+ antisymmetries among the arguments, with the same convention
2118
+ as for ``sym``
2119
+ - ``specific_type`` -- (default: ``None``) specific subclass of
2120
+ :class:`~sage.manifolds.differentiable.tensorfield_paral.TensorFieldParal`
2121
+ for the output
2122
+
2123
+ OUTPUT:
2124
+
2125
+ - a
2126
+ :class:`~sage.manifolds.differentiable.tensorfield_paral.TensorFieldParal`
2127
+ representing the tensor defined on ``self`` with the provided
2128
+ characteristics
2129
+
2130
+ EXAMPLES::
2131
+
2132
+ sage: M = Manifold(2, 'M')
2133
+ sage: X.<x,y> = M.chart() # makes M parallelizable
2134
+ sage: XM = M.vector_field_module()
2135
+ sage: XM.tensor((1,2), name='t')
2136
+ Tensor field t of type (1,2) on the 2-dimensional
2137
+ differentiable manifold M
2138
+ sage: XM.tensor((1,0), name='a')
2139
+ Vector field a on the 2-dimensional differentiable
2140
+ manifold M
2141
+ sage: XM.tensor((0,2), name='a', antisym=(0,1))
2142
+ 2-form a on the 2-dimensional differentiable manifold M
2143
+ sage: XM.tensor((2,0), name='a', antisym=(0,1))
2144
+ 2-vector field a on the 2-dimensional differentiable
2145
+ manifold M
2146
+
2147
+ See
2148
+ :class:`~sage.manifolds.differentiable.tensorfield_paral.TensorFieldParal`
2149
+ for more examples and documentation.
2150
+ """
2151
+ from sage.manifolds.differentiable.automorphismfield import (
2152
+ AutomorphismField,
2153
+ AutomorphismFieldParal,
2154
+ )
2155
+ from sage.manifolds.differentiable.metric import (
2156
+ DegenerateMetric,
2157
+ PseudoRiemannianMetric,
2158
+ )
2159
+ from sage.tensor.modules.comp import CompWithSym
2160
+ sym, antisym = CompWithSym._canonicalize_sym_antisym(
2161
+ tensor_type[0] + tensor_type[1], sym, antisym)
2162
+ if tensor_type == (1,0):
2163
+ return self.element_class(self, name=name,
2164
+ latex_name=latex_name)
2165
+ elif tensor_type == (0,1):
2166
+ return self.linear_form(name=name, latex_name=latex_name)
2167
+ elif tensor_type == (1,1) and specific_type is not None:
2168
+ if issubclass(specific_type,
2169
+ (AutomorphismField, AutomorphismFieldParal)):
2170
+ return self.automorphism(name=name, latex_name=latex_name)
2171
+ elif tensor_type[0] == 0 and tensor_type[1] > 1 and antisym:
2172
+ if len(antisym[0]) == tensor_type[1]:
2173
+ return self.alternating_form(tensor_type[1], name=name,
2174
+ latex_name=latex_name)
2175
+ elif tensor_type[0] > 1 and tensor_type[1] == 0 and antisym:
2176
+ if len(antisym[0]) == tensor_type[0]:
2177
+ return self.alternating_contravariant_tensor(
2178
+ tensor_type[0], name=name, latex_name=latex_name)
2179
+ elif tensor_type == (0,2) and specific_type is not None:
2180
+ if issubclass(specific_type, PseudoRiemannianMetric):
2181
+ return self.metric(name, latex_name=latex_name)
2182
+ # NB: the signature is not treated
2183
+ if issubclass(specific_type, DegenerateMetric):
2184
+ sign = self._domain._dim
2185
+ return self.metric(name, latex_name=latex_name,
2186
+ signature=(0, sign-1, 1))
2187
+ # Generic case
2188
+ return self.tensor_module(*tensor_type).element_class(
2189
+ self, tensor_type, name=name, latex_name=latex_name,
2190
+ sym=sym, antisym=antisym)
2191
+
2192
+ def tensor_from_comp(self, tensor_type, comp, name=None,
2193
+ latex_name=None):
2194
+ r"""
2195
+ Construct a tensor on ``self`` from a set of components.
2196
+
2197
+ The tensor is actually a tensor field along the differentiable
2198
+ manifold `U` over which the vector field module is defined.
2199
+ The tensor symmetries are deduced from those of the components.
2200
+
2201
+ INPUT:
2202
+
2203
+ - ``tensor_type`` -- pair `(k,l)` with `k` being the contravariant
2204
+ rank and `l` the covariant rank
2205
+ - ``comp`` -- :class:`~sage.tensor.modules.comp.Components`;
2206
+ the tensor components in a given basis
2207
+ - ``name`` -- string (default: ``None``); name given to the tensor
2208
+ - ``latex_name`` -- string (default: ``None``); LaTeX symbol to denote
2209
+ the tensor; if ``None``, the LaTeX symbol is set to ``name``
2210
+
2211
+ OUTPUT:
2212
+
2213
+ - a
2214
+ :class:`~sage.manifolds.differentiable.tensorfield_paral.TensorFieldParal`
2215
+ representing the tensor defined on the vector field module with the
2216
+ provided characteristics
2217
+
2218
+ EXAMPLES:
2219
+
2220
+ A 2-dimensional set of components transformed into a type-`(1,1)`
2221
+ tensor field::
2222
+
2223
+ sage: M = Manifold(2, 'M')
2224
+ sage: X.<x,y> = M.chart()
2225
+ sage: XM = M.vector_field_module()
2226
+ sage: from sage.tensor.modules.comp import Components
2227
+ sage: comp = Components(M.scalar_field_algebra(), X.frame(), 2,
2228
+ ....: output_formatter=XM._output_formatter)
2229
+ sage: comp[:] = [[1+x, -y], [x*y, 2-y^2]]
2230
+ sage: t = XM.tensor_from_comp((1,1), comp, name='t'); t
2231
+ Tensor field t of type (1,1) on the 2-dimensional differentiable
2232
+ manifold M
2233
+ sage: t.display()
2234
+ t = (x + 1) ∂/∂x⊗dx - y ∂/∂x⊗dy + x*y ∂/∂y⊗dx + (-y^2 + 2) ∂/∂y⊗dy
2235
+
2236
+ The same set of components transformed into a type-`(0,2)`
2237
+ tensor field::
2238
+
2239
+ sage: t = XM.tensor_from_comp((0,2), comp, name='t'); t
2240
+ Tensor field t of type (0,2) on the 2-dimensional differentiable
2241
+ manifold M
2242
+ sage: t.display()
2243
+ t = (x + 1) dx⊗dx - y dx⊗dy + x*y dy⊗dx + (-y^2 + 2) dy⊗dy
2244
+ """
2245
+ from sage.tensor.modules.comp import CompFullyAntiSym, CompWithSym
2246
+
2247
+ # 0/ Compatibility checks:
2248
+ if comp._ring is not self._ring:
2249
+ raise ValueError("the components are not defined on the "
2250
+ "same ring as the module")
2251
+ if comp._frame not in self._known_bases:
2252
+ raise ValueError("the components are not defined on a "
2253
+ "basis of the module")
2254
+ if comp._nid != tensor_type[0] + tensor_type[1]:
2255
+ raise ValueError("number of component indices not "
2256
+ "compatible with the tensor type")
2257
+ #
2258
+ # 1/ Construction of the tensor:
2259
+ if tensor_type == (1, 0):
2260
+ resu = self.element_class(self, name=name,
2261
+ latex_name=latex_name)
2262
+ elif tensor_type == (0,1):
2263
+ resu = self.linear_form(name=name, latex_name=latex_name)
2264
+ elif (tensor_type[0] == 0 and tensor_type[1] > 1
2265
+ and isinstance(comp, CompFullyAntiSym)):
2266
+ resu = self.alternating_form(tensor_type[1], name=name,
2267
+ latex_name=latex_name)
2268
+ elif (tensor_type[0] > 1 and tensor_type[1] == 0
2269
+ and isinstance(comp, CompFullyAntiSym)):
2270
+ resu = self.alternating_contravariant_tensor(tensor_type[0],
2271
+ name=name, latex_name=latex_name)
2272
+ else:
2273
+ resu = self.tensor_module(*tensor_type).element_class(self,
2274
+ tensor_type, name=name, latex_name=latex_name)
2275
+ # Tensor symmetries deduced from those of comp:
2276
+ if isinstance(comp, CompWithSym):
2277
+ resu._sym = comp._sym
2278
+ resu._antisym = comp._antisym
2279
+
2280
+ # 2/ Tensor components set to comp:
2281
+ resu._components[comp._frame] = comp
2282
+
2283
+ return resu
2284
+
2285
+ def sym_bilinear_form(self, name=None, latex_name=None):
2286
+ r"""
2287
+ Construct a symmetric bilinear form on ``self``.
2288
+
2289
+ A symmetric bilinear form on the vector field module is
2290
+ actually a field of tangent-space symmetric bilinear forms
2291
+ along the differentiable manifold `U` over which the vector
2292
+ field module is defined.
2293
+
2294
+ INPUT:
2295
+
2296
+ - ``name`` -- string (default: ``None``); name given to the
2297
+ symmetric bilinear form
2298
+ - ``latex_name`` -- string (default: ``None``); LaTeX symbol to
2299
+ denote the symmetric bilinear form; if ``None``, the LaTeX
2300
+ symbol is set to ``name``
2301
+
2302
+ OUTPUT:
2303
+
2304
+ - a
2305
+ :class:`~sage.manifolds.differentiable.tensorfield_paral.TensorFieldParal`
2306
+ of tensor type `(0,2)` and symmetric
2307
+
2308
+ EXAMPLES::
2309
+
2310
+ sage: M = Manifold(2, 'M')
2311
+ sage: X.<x,y> = M.chart() # makes M parallelizable
2312
+ sage: XM = M.vector_field_module()
2313
+ sage: XM.sym_bilinear_form(name='a')
2314
+ Field of symmetric bilinear forms a on the 2-dimensional
2315
+ differentiable manifold M
2316
+
2317
+ .. SEEALSO::
2318
+
2319
+ :class:`~sage.manifolds.differentiable.tensorfield_paral.TensorFieldParal`
2320
+ for more examples and documentation.
2321
+ """
2322
+ return self.tensor((0,2), name=name, latex_name=latex_name,
2323
+ sym=(0,1))
2324
+
2325
+ #### End of methods to be redefined by derived classes of FiniteRankFreeModule ####
2326
+
2327
+ def metric(self, name, signature=None, latex_name=None):
2328
+ r"""
2329
+ Construct a pseudo-Riemannian metric (nondegenerate symmetric bilinear
2330
+ form) on the current vector field module.
2331
+
2332
+ A pseudo-Riemannian metric of the vector field module is actually a
2333
+ field of tangent-space non-degenerate symmetric bilinear forms along
2334
+ the manifold `U` on which the vector field module is defined.
2335
+
2336
+ INPUT:
2337
+
2338
+ - ``name`` -- string; name given to the metric
2339
+ - ``signature`` -- integer (default: ``None``); signature `S` of the
2340
+ metric: `S = n_+ - n_-`, where `n_+` (resp. `n_-`) is the number of
2341
+ positive terms (resp. number of negative terms) in any diagonal
2342
+ writing of the metric components; if ``signature`` is not provided,
2343
+ `S` is set to the manifold's dimension (Riemannian signature)
2344
+ - ``latex_name`` -- (string; default: ``None``) LaTeX symbol to denote
2345
+ the metric; if ``None``, it is formed from ``name``
2346
+
2347
+ OUTPUT:
2348
+
2349
+ - instance of
2350
+ :class:`~sage.manifolds.differentiable.metric.PseudoRiemannianMetricParal`
2351
+ representing the defined pseudo-Riemannian metric.
2352
+
2353
+ EXAMPLES::
2354
+
2355
+ sage: M = Manifold(2, 'M')
2356
+ sage: X.<x,y> = M.chart() # makes M parallelizable
2357
+ sage: XM = M.vector_field_module()
2358
+ sage: XM.metric('g')
2359
+ Riemannian metric g on the 2-dimensional differentiable manifold M
2360
+ sage: XM.metric('g', signature=0)
2361
+ Lorentzian metric g on the 2-dimensional differentiable manifold M
2362
+
2363
+ .. SEEALSO::
2364
+
2365
+ :class:`~sage.manifolds.differentiable.metric.PseudoRiemannianMetricParal`
2366
+ for more documentation.
2367
+ """
2368
+ ndim = self._ambient_domain.dimension()
2369
+ try:
2370
+ for elt in signature:
2371
+ if (elt < 0) or (not isinstance(elt, (int, Integer))):
2372
+ raise ValueError("{} must be a positive integer".format(elt))
2373
+ sign = signature[0]+signature[1]+signature[2]
2374
+ if sign != ndim:
2375
+ raise ValueError("{} is different from the dimension".format(sign) +
2376
+ " of the manifold, who is {}".format(ndim))
2377
+ if signature[2] != 0:
2378
+ from sage.manifolds.differentiable.metric import DegenerateMetricParal
2379
+ return DegenerateMetricParal(self, name, signature=signature,
2380
+ latex_name=latex_name)
2381
+ except TypeError:
2382
+ pass
2383
+ if signature is None:
2384
+ signature = (ndim,0)
2385
+ if isinstance(signature, (Integer, int)):
2386
+ if (signature+ndim) % 2 == 1:
2387
+ if ndim % 2 == 0:
2388
+ raise ValueError("the metric signature must be even")
2389
+ else:
2390
+ raise ValueError("the metric signature must be odd")
2391
+ signature = (int((ndim+signature)/2), int((ndim-signature)/2))
2392
+ from sage.manifolds.differentiable.metric import PseudoRiemannianMetricParal
2393
+ return PseudoRiemannianMetricParal(self, name,
2394
+ signature=signature[0]-signature[1],
2395
+ latex_name=latex_name)
2396
+
2397
+ def symplectic_form(
2398
+ self, name: Optional[str] = None, latex_name: Optional[str] = None
2399
+ ):
2400
+ r"""
2401
+ Construct a symplectic form on the current vector field module.
2402
+
2403
+ OUTPUT:
2404
+
2405
+ - instance of
2406
+ :class:`~sage.manifolds.differentiable.symplectic_form.SymplecticFormParal`
2407
+
2408
+ EXAMPLES:
2409
+
2410
+ Standard symplectic form on `\RR^2`::
2411
+
2412
+ sage: M.<q, p> = EuclideanSpace(2)
2413
+ sage: omega = M.vector_field_module().symplectic_form('omega', r'\omega')
2414
+ sage: omega.set_comp()[1,2] = -1
2415
+ sage: omega.display()
2416
+ omega = -dq∧dp
2417
+ """
2418
+ from sage.manifolds.differentiable.symplectic_form import SymplecticFormParal
2419
+
2420
+ return SymplecticFormParal(self, name, latex_name)
2421
+
2422
+ def poisson_tensor(
2423
+ self, name: Optional[str] = None, latex_name: Optional[str] = None
2424
+ ):
2425
+ r"""
2426
+ Construct a Poisson tensor on the current vector field module.
2427
+
2428
+ OUTPUT:
2429
+
2430
+ - instance of
2431
+ :class:`~sage.manifolds.differentiable.poisson_tensor.PoissonTensorFieldParal`
2432
+
2433
+ EXAMPLES:
2434
+
2435
+ Standard Poisson tensor on `\RR^2`::
2436
+
2437
+ sage: M.<q, p> = EuclideanSpace(2)
2438
+ sage: poisson = M.vector_field_module().poisson_tensor('varpi')
2439
+ sage: poisson.set_comp()[1,2] = -1
2440
+ sage: poisson.display()
2441
+ varpi = -e_q∧e_p
2442
+ """
2443
+ from sage.manifolds.differentiable.poisson_tensor import PoissonTensorFieldParal
2444
+
2445
+ return PoissonTensorFieldParal(self, name, latex_name)