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,1347 @@
1
+ # sage_setup: distribution = sagemath-symbolics
2
+ r"""
3
+ Topological Vector Bundle
4
+
5
+ Let `K` be a topological field. A *vector bundle* of rank `n` over the field
6
+ `K` and over a topological manifold `B` (base space) is a topological manifold
7
+ `E` (total space) together with a continuous and surjective map `\pi: E \to B`
8
+ such that for every point `p \in B`, we have:
9
+
10
+ - the set `E_p=\pi^{-1}(p)` has the vector space structure of `K^n`,
11
+ - there is a neighborhood `U \subset B` of `p` and a homeomorphism
12
+ (trivialization) `\varphi: \pi^{-1}(p) \to U \times K^n` such that `\varphi`
13
+ is compatible with the fibers, namely `\pi \circ \varphi^{-1} = \mathrm{pr}_1`,
14
+ and `v \mapsto \varphi^{-1}(q,v)` is a linear isomorphism between `K^n` and
15
+ `E_q` for any `q \in U`.
16
+
17
+ AUTHORS:
18
+
19
+ - Michael Jung (2019) : initial version
20
+
21
+ REFERENCES:
22
+
23
+ - [Lee2013]_
24
+ - [Mil1974]_
25
+ """
26
+
27
+ # ****************************************************************************
28
+ # Copyright (C) 2019 Michael Jung <micjung@uni-potsdam.de>
29
+ #
30
+ # Distributed under the terms of the GNU General Public License (GPL)
31
+ # as published by the Free Software Foundation; either version 2 of
32
+ # the License, or (at your option) any later version.
33
+ # https://www.gnu.org/licenses/
34
+ # ****************************************************************************
35
+
36
+ import sage.rings.abc
37
+ from sage.categories.vector_bundles import VectorBundles
38
+ from sage.manifolds.vector_bundle_fiber import VectorBundleFiber
39
+ from sage.rings.cc import CC
40
+ from sage.rings.integer import Integer
41
+ from sage.rings.real_mpfr import RR
42
+ from sage.structure.category_object import CategoryObject
43
+ from sage.structure.unique_representation import UniqueRepresentation
44
+
45
+
46
+ class TopologicalVectorBundle(CategoryObject, UniqueRepresentation):
47
+ r"""
48
+ An instance of this class is a topological vector bundle `E \to B` over a
49
+ topological field `K`.
50
+
51
+ INPUT:
52
+
53
+ - ``rank`` -- positive integer; rank of the vector bundle
54
+ - ``name`` -- string representation given to the total space
55
+ - ``base_space`` -- the base space (topological manifold) over which the
56
+ vector bundle is defined
57
+ - ``field`` -- field `K` which gives the fibers the structure of a
58
+ vector space over `K`; allowed values are
59
+
60
+ - ``'real'`` or an object of type ``RealField`` (e.g., ``RR``) for
61
+ a vector bundle over `\RR`
62
+ - ``'complex'`` or an object of type ``ComplexField`` (e.g., ``CC``)
63
+ for a vector bundle over `\CC`
64
+ - an object in the category of topological fields (see
65
+ :class:`~sage.categories.fields.Fields` and
66
+ :class:`~sage.categories.topological_spaces.TopologicalSpaces`)
67
+ for other types of topological fields
68
+
69
+ - ``latex_name`` -- (default: ``None``) LaTeX representation given to the
70
+ total space
71
+ - ``category`` -- (default: ``None``) to specify the category; if
72
+ ``None``, ``VectorBundles(base_space, c_field)`` is assumed (see the
73
+ category :class:`~sage.categories.vector_bundles.VectorBundles`)
74
+ - ``unique_tag`` -- (default: ``None``) tag used to force the construction
75
+ of a new object when all the other arguments have been used previously
76
+ (without ``unique_tag``, the
77
+ :class:`~sage.structure.unique_representation.UniqueRepresentation`
78
+ behavior would return the previously constructed object corresponding to
79
+ these arguments)
80
+
81
+ EXAMPLES:
82
+
83
+ A real line bundle over some 4-dimensional topological manifold::
84
+
85
+ sage: M = Manifold(4, 'M', structure='top')
86
+ sage: E = M.vector_bundle(1, 'E'); E
87
+ Topological real vector bundle E -> M of rank 1 over the base space
88
+ 4-dimensional topological manifold M
89
+ sage: E.base_space()
90
+ 4-dimensional topological manifold M
91
+ sage: E.base_ring()
92
+ Real Field with 53 bits of precision
93
+ sage: E.rank()
94
+ 1
95
+
96
+ For a more sophisticated example, let us define a non-trivial
97
+ 2-manifold to work with::
98
+
99
+ sage: M = Manifold(2, 'M', structure='top')
100
+ sage: U = M.open_subset('U') ; V = M.open_subset('V')
101
+ sage: M.declare_union(U,V) # M is the union of U and V
102
+ sage: c_xy.<x,y> = U.chart() ; c_uv.<u,v> = V.chart()
103
+ sage: xy_to_uv = c_xy.transition_map(c_uv, (x+y, x-y),
104
+ ....: intersection_name='W', restrictions1= x>0,
105
+ ....: restrictions2= u+v>0)
106
+ sage: uv_to_xy = xy_to_uv.inverse()
107
+ sage: W = U.intersection(V)
108
+ sage: E = M.vector_bundle(2, 'E'); E
109
+ Topological real vector bundle E -> M of rank 2 over the base space
110
+ 2-dimensional topological manifold M
111
+
112
+ Now, there a two ways to go. Most effortlessly, we define
113
+ trivializations similar to charts (see
114
+ :class:`~sage.manifolds.trivialization.Trivialization`)::
115
+
116
+ sage: phi_U = E.trivialization('phi_U', domain=U); phi_U
117
+ Trivialization (phi_U, E|_U)
118
+ sage: phi_V = E.trivialization('phi_V', domain=V); phi_V
119
+ Trivialization (phi_V, E|_V)
120
+ sage: transf = phi_U.transition_map(phi_V, [[0,x],[x,0]]) # transition map between trivializations
121
+ sage: fU = phi_U.frame(); fU
122
+ Trivialization frame (E|_U, ((phi_U^*e_1),(phi_U^*e_2)))
123
+ sage: fV = phi_V.frame(); fV
124
+ Trivialization frame (E|_V, ((phi_V^*e_1),(phi_V^*e_2)))
125
+ sage: E.changes_of_frame() # random
126
+ {(Local frame (E|_W, ((phi_U^*e_1),(phi_U^*e_2))),
127
+ Local frame (E|_W, ((phi_V^*e_1),(phi_V^*e_2)))): Automorphism
128
+ phi_U^(-1)*phi_V^(-1) of the Free module C^0(W;E) of sections on
129
+ the Open subset W of the 2-dimensional topological manifold M with
130
+ values in the real vector bundle E of rank 2,
131
+ (Local frame (E|_W, ((phi_V^*e_1),(phi_V^*e_2))),
132
+ Local frame (E|_W, ((phi_U^*e_1),(phi_U^*e_2)))): Automorphism
133
+ phi_U^(-1)*phi_V of the Free module C^0(W;E) of sections on the
134
+ Open subset W of the 2-dimensional topological manifold M with
135
+ values in the real vector bundle E of rank 2}
136
+
137
+ Then, the atlas of `E` consists of all known trivializations defined
138
+ on E::
139
+
140
+ sage: E.atlas() # a shallow copy of the atlas
141
+ [Trivialization (phi_U, E|_U), Trivialization (phi_V, E|_V)]
142
+
143
+ Or we just define frames, an automorphism on the free
144
+ section module over the intersection domain `W` and declare the change
145
+ of frame manually (for more details consult
146
+ :class:`~sage.manifolds.local_frame.LocalFrame`)::
147
+
148
+ sage: eU = E.local_frame('eU', domain=U); eU
149
+ Local frame (E|_U, (eU_0,eU_1))
150
+ sage: eUW = eU.restrict(W) # to trivialize E|_W
151
+ sage: eV = E.local_frame('eV', domain=V); eV
152
+ Local frame (E|_V, (eV_0,eV_1))
153
+ sage: eVW = eV.restrict(W)
154
+ sage: a = E.section_module(domain=W).automorphism(); a
155
+ Automorphism of the Free module C^0(W;E) of sections on the Open
156
+ subset W of the 2-dimensional topological manifold M with values in
157
+ the real vector bundle E of rank 2
158
+ sage: a[eUW,:] = [[0,x],[x,0]]
159
+ sage: E.set_change_of_frame(eUW, eVW, a)
160
+ sage: E.change_of_frame(eUW, eVW)
161
+ Automorphism of the Free module C^0(W;E) of sections on the Open
162
+ subset W of the 2-dimensional topological manifold M with values in
163
+ the real vector bundle E of rank 2
164
+
165
+ Now, the list of all known frames defined on `E` can be displayed via
166
+ :meth:`frames`::
167
+
168
+ sage: E.frames() # a shallow copy of all known frames on E
169
+ [Trivialization frame (E|_U, ((phi_U^*e_1),(phi_U^*e_2))),
170
+ Trivialization frame (E|_V, ((phi_V^*e_1),(phi_V^*e_2))),
171
+ Local frame (E|_W, ((phi_U^*e_1),(phi_U^*e_2))),
172
+ Local frame (E|_W, ((phi_V^*e_1),(phi_V^*e_2))),
173
+ Local frame (E|_U, (eU_0,eU_1)),
174
+ Local frame (E|_W, (eU_0,eU_1)),
175
+ Local frame (E|_V, (eV_0,eV_1)),
176
+ Local frame (E|_W, (eV_0,eV_1))]
177
+
178
+ By definition `E` is a manifold, in this case of dimension 4 (notice
179
+ that the induced charts are not implemented, yet)::
180
+
181
+ sage: E.total_space()
182
+ 4-dimensional topological manifold E
183
+
184
+ The method :meth:`section` returns a section while the method
185
+ :meth:`section_module` returns the section module on the corresponding
186
+ domain::
187
+
188
+ sage: s = E.section(name='s'); s
189
+ Section s on the 2-dimensional topological manifold M with values in
190
+ the real vector bundle E of rank 2
191
+ sage: s in E.section_module()
192
+ True
193
+ """
194
+ def __init__(self, rank, name, base_space, field='real',
195
+ latex_name=None, category=None, unique_tag=None):
196
+ r"""
197
+ Construct a topological vector bundle.
198
+
199
+ TESTS::
200
+
201
+ sage: M = Manifold(2, 'M', structure='top')
202
+ sage: from sage.manifolds.vector_bundle import TopologicalVectorBundle
203
+ sage: TopologicalVectorBundle(2, 'E', M)
204
+ Topological real vector bundle E -> M of rank 2 over the base space
205
+ 2-dimensional topological manifold M
206
+ """
207
+ if base_space is None:
208
+ raise ValueError("a base space must be provided")
209
+ ###
210
+ # Handle the field:
211
+ if field == 'real':
212
+ self._field = RR
213
+ self._field_type = field
214
+ elif field == 'complex':
215
+ self._field = CC
216
+ self._field_type = field
217
+ else:
218
+ self._field = field
219
+ if isinstance(field, sage.rings.abc.RealField):
220
+ self._field_type = 'real'
221
+ elif isinstance(field, sage.rings.abc.ComplexField):
222
+ self._field_type = 'complex'
223
+ else:
224
+ self._field_type = 'neither_real_nor_complex'
225
+ bs_field = base_space.base_field()
226
+ if not bs_field.is_subring(self._field):
227
+ raise ValueError("for concrete implementation, manifold's base "
228
+ "field must be a subfield of the vector bundle's "
229
+ "base field")
230
+ ###
231
+ # Get the category:
232
+ if category is None:
233
+ category = VectorBundles(base_space, self._field)
234
+ CategoryObject.__init__(self, base=self._field,
235
+ category=category)
236
+ # Check rank:
237
+ if not isinstance(rank, (int, Integer)):
238
+ raise TypeError("the rank must be an integer")
239
+ if rank < 1:
240
+ raise ValueError("the rank must be strictly positive")
241
+ ###
242
+ # Define remaining attributes:
243
+ self._rank = rank
244
+ self._diff_degree = 0
245
+ self._base_space = base_space
246
+ self._total_space = None
247
+ self._orientation = [] # set no orientation a priori
248
+ ###
249
+ # Set names:
250
+ self._name = name
251
+ if latex_name is None:
252
+ self._latex_name = self._name
253
+ else:
254
+ self._latex_name = latex_name
255
+ ###
256
+ # Initialize quantities like frames and trivializations:
257
+ self._init_attributes()
258
+
259
+ def _init_attributes(self):
260
+ r"""
261
+ Initialize the derived quantities.
262
+
263
+ TESTS::
264
+
265
+ sage: M = Manifold(2, 'M', structure='topological')
266
+ sage: E = M.vector_bundle(2, 'E')
267
+ sage: E._init_attributes()
268
+ """
269
+ self._section_modules = {}
270
+ # dict of section modules with domains as keys
271
+
272
+ self._atlas = [] # list of trivializations defined on self
273
+ self._transitions = {}
274
+ # dictionary of transition maps (key: pair of trivializations)
275
+
276
+ self._frames = [] # list of local frames for self
277
+ self._frame_changes = {} # dictionary of changes of frames
278
+ self._coframes = [] # list of local coframes for self
279
+ self._trivial_parts = set()
280
+ # subsets of base space on which self is trivial
281
+
282
+ self._def_frame = None
283
+
284
+ def base_space(self):
285
+ r"""
286
+ Return the base space of the vector bundle.
287
+
288
+ EXAMPLES::
289
+
290
+ sage: M = Manifold(2, 'M', structure='top')
291
+ sage: E = M.vector_bundle(2, 'E')
292
+ sage: E.base_space()
293
+ 2-dimensional topological manifold M
294
+ """
295
+ return self._base_space
296
+
297
+ def base_field_type(self):
298
+ r"""
299
+ Return the type of topological field on which the fibers are defined.
300
+
301
+ OUTPUT:
302
+
303
+ A string describing the field, with three possible values:
304
+
305
+ - ``'real'`` for the real field `\RR`
306
+ - ``'complex'`` for the complex field `\CC`
307
+ - ``'neither_real_nor_complex'`` for a field different from `\RR` and `\CC`
308
+
309
+ EXAMPLES::
310
+
311
+ sage: M = Manifold(2, 'M', structure='top')
312
+ sage: E = M.vector_bundle(2, 'E', field=CC)
313
+ sage: E.base_field_type()
314
+ 'complex'
315
+ """
316
+ return self._field_type
317
+
318
+ def base_field(self):
319
+ r"""
320
+ Return the field on which the fibers are defined.
321
+
322
+ OUTPUT: a topological field
323
+
324
+ EXAMPLES::
325
+
326
+ sage: M = Manifold(3, 'M', structure='topological')
327
+ sage: E = M.vector_bundle(2, 'E', field=CC)
328
+ sage: E.base_field()
329
+ Complex Field with 53 bits of precision
330
+ """
331
+ return self._field
332
+
333
+ def rank(self):
334
+ r"""
335
+ Return the rank of the vector bundle.
336
+
337
+ EXAMPLES::
338
+
339
+ sage: M = Manifold(2, 'M', structure='top')
340
+ sage: E = M.vector_bundle(3, 'E')
341
+ sage: E.rank()
342
+ 3
343
+ """
344
+ return self._rank
345
+
346
+ def _repr_object_name(self):
347
+ r"""
348
+ String name of the object without structure.
349
+
350
+ TESTS::
351
+
352
+ sage: M = Manifold(2, 'M', structure='top')
353
+ sage: E = M.vector_bundle(1, 'E')
354
+ sage: E._repr_object_name()
355
+ 'real vector bundle E -> M of rank 1 over the base space
356
+ 2-dimensional topological manifold M'
357
+ """
358
+ desc = self.base_field_type() + " "
359
+ desc += "vector bundle "
360
+ desc += self._name + " -> " + self.base_space()._name + " "
361
+ desc += "of rank {} ".format(self._rank)
362
+ desc += "over the base space {}".format(self.base_space())
363
+ return desc
364
+
365
+ def _repr_(self):
366
+ r"""
367
+ String representation of ``self``.
368
+
369
+ TESTS::
370
+
371
+ sage: M = Manifold(2, 'M', structure='top')
372
+ sage: E = M.vector_bundle(1, 'E')
373
+ sage: E._repr_()
374
+ 'Topological real vector bundle E -> M of rank 1 over the base space
375
+ 2-dimensional topological manifold M'
376
+ """
377
+ desc = "Topological "
378
+ desc += self._repr_object_name()
379
+ return desc
380
+
381
+ def _latex_(self):
382
+ r"""
383
+ Return the LaTeX representation of the object.
384
+
385
+ TESTS::
386
+
387
+ sage: M = Manifold(2, 'M', structure='top')
388
+ sage: E = M.vector_bundle(1, 'E')
389
+ sage: E._latex_()
390
+ 'E\\to M'
391
+ """
392
+ latex = self._latex_name
393
+ latex += r'\to '
394
+ latex += self.base_space()._latex_name
395
+ return latex
396
+
397
+ def _add_local_frame(self, frame):
398
+ r"""
399
+ Helper method to add local frames to the vector bundle.
400
+
401
+ INPUT:
402
+
403
+ - ``frame`` -- the local frame that shall be added
404
+
405
+ TESTS::
406
+
407
+ sage: M = Manifold(3, 'M', structure='top')
408
+ sage: E = M.vector_bundle(2, 'E')
409
+ sage: e = E.local_frame('e')
410
+ sage: E._add_local_frame(e)
411
+ sage: E._frames
412
+ [Local frame (E|_M, (e_0,e_1)), Local frame (E|_M, (e_0,e_1))]
413
+ """
414
+ self._trivial_parts.add(frame.domain())
415
+ self._frames.append(frame)
416
+
417
+ def trivialization(self, name, domain=None, latex_name=None):
418
+ r"""
419
+ Return a trivialization of ``self`` over the domain ``domain``.
420
+
421
+ INPUT:
422
+
423
+ - ``domain`` -- (default: ``None``) domain on which the trivialization
424
+ is defined; if ``None`` the base space is assumed
425
+ - ``name`` -- (default: ``None``) name given to the trivialization
426
+ - ``latex_name`` -- (default: ``None``) LaTeX name given to the
427
+ trivialization
428
+
429
+ OUTPUT:
430
+
431
+ - a :class:`~sage.manifolds.trivialization.Trivialization` representing
432
+ a trivialization of `E`
433
+
434
+ EXAMPLES::
435
+
436
+ sage: M = Manifold(3, 'M')
437
+ sage: U = M.open_subset('U')
438
+ sage: E = M.vector_bundle(2, 'E')
439
+ sage: phi = E.trivialization('phi', domain=U); phi
440
+ Trivialization (phi, E|_U)
441
+ """
442
+ if domain is None:
443
+ domain = self._base_space
444
+ from sage.manifolds.trivialization import Trivialization
445
+ return Trivialization(self, name, domain=domain, latex_name=latex_name)
446
+
447
+ def transitions(self):
448
+ r"""
449
+ Return the transition maps defined over subsets of the base space.
450
+
451
+ OUTPUT: dictionary of transition maps, with pairs of trivializations as keys
452
+
453
+ EXAMPLES::
454
+
455
+ sage: M = Manifold(3, 'M')
456
+ sage: X.<x,y,z> = M.chart()
457
+ sage: U = M.open_subset('U')
458
+ sage: V = M.open_subset('V')
459
+ sage: X_UV = X.restrict(U.intersection(V))
460
+ sage: E = M.vector_bundle(2, 'E')
461
+ sage: phi_U = E.trivialization('phi_U', domain=U)
462
+ sage: phi_V = E.trivialization('phi_U', domain=V)
463
+ sage: phi_U_to_phi_V = phi_U.transition_map(phi_V, 1)
464
+ sage: E.transitions() # random
465
+ {(Trivialization (phi_U, E|_U),
466
+ Trivialization (phi_U, E|_V)): Transition map from Trivialization
467
+ (phi_U, E|_U) to Trivialization (phi_U, E|_V),
468
+ (Trivialization (phi_U, E|_V),
469
+ Trivialization (phi_U, E|_U)): Transition map from Trivialization
470
+ (phi_U, E|_V) to Trivialization (phi_U, E|_U)}
471
+ """
472
+ return self._transitions.copy()
473
+
474
+ def transition(self, triv1, triv2):
475
+ r"""
476
+ Return the transition map between two trivializations defined over the
477
+ manifold.
478
+
479
+ The transition map must have been defined previously, for instance by
480
+ the method
481
+ :meth:`~sage.manifolds.trivialization.Trivialization.transition_map`.
482
+
483
+ INPUT:
484
+
485
+ - ``triv1`` -- trivialization 1
486
+ - ``triv2`` -- trivialization 2
487
+
488
+ OUTPUT:
489
+
490
+ - instance of :class:`~sage.manifolds.trivialization.TransitionMap`
491
+ representing the transition map from trivialization 1 to
492
+ trivialization 2
493
+
494
+ EXAMPLES::
495
+
496
+ sage: M = Manifold(3, 'M')
497
+ sage: X.<x,y,z> = M.chart()
498
+ sage: U = M.open_subset('U')
499
+ sage: V = M.open_subset('V')
500
+ sage: X_UV = X.restrict(U.intersection(V))
501
+ sage: E = M.vector_bundle(2, 'E')
502
+ sage: phi_U = E.trivialization('phi_U', domain=U)
503
+ sage: phi_V = E.trivialization('phi_V', domain=V)
504
+ sage: phi_U_to_phi_V = phi_U.transition_map(phi_V, 1)
505
+ sage: E.transition(phi_V, phi_U)
506
+ Transition map from Trivialization (phi_V, E|_V) to Trivialization
507
+ (phi_U, E|_U)
508
+ """
509
+ if (triv1, triv2) not in self._transitions:
510
+ raise TypeError("the transition map from " +
511
+ "{} to {}".format(triv1, triv2) + " has not " +
512
+ "been defined on the {}".format(self))
513
+ return self._transitions[(triv1, triv2)]
514
+
515
+ def atlas(self):
516
+ r"""
517
+ Return the list of trivializations that have been defined for ``self``.
518
+
519
+ EXAMPLES::
520
+
521
+ sage: M = Manifold(3, 'M')
522
+ sage: U = M.open_subset('U')
523
+ sage: V = M.open_subset('V')
524
+ sage: E = M.vector_bundle(2, 'E')
525
+ sage: phi_U = E.trivialization('phi_U', domain=U)
526
+ sage: phi_V = E.trivialization('phi_V', domain=V)
527
+ sage: phi_M = E.trivialization('phi_M')
528
+ sage: E.atlas()
529
+ [Trivialization (phi_U, E|_U),
530
+ Trivialization (phi_V, E|_V),
531
+ Trivialization (phi_M, E|_M)]
532
+ """
533
+ return list(self._atlas) # Make a (shallow) copy
534
+
535
+ def is_manifestly_trivial(self):
536
+ r"""
537
+ Return ``True`` if ``self`` is manifestly a trivial bundle, i.e. there
538
+ exists a frame or a trivialization defined on the whole base space.
539
+
540
+ EXAMPLES::
541
+
542
+ sage: M = Manifold(2, 'M', structure='top')
543
+ sage: E = M.vector_bundle(1, 'E')
544
+ sage: U = M.open_subset('U')
545
+ sage: V = M.open_subset('V')
546
+ sage: M.declare_union(U, V)
547
+ sage: phi_U = E.trivialization('phi_U', domain=U); phi_U
548
+ Trivialization (phi_U, E|_U)
549
+ sage: phi_V = E.trivialization('phi_V', domain=V); phi_V
550
+ Trivialization (phi_V, E|_V)
551
+ sage: E.is_manifestly_trivial()
552
+ False
553
+ sage: E.trivialization('phi_M', M)
554
+ Trivialization (phi_M, E|_M)
555
+ sage: E.is_manifestly_trivial()
556
+ True
557
+ """
558
+ return self.base_space() in self._trivial_parts
559
+
560
+ def section_module(self, domain=None, force_free=False):
561
+ r"""
562
+ Return the section module of continuous sections on ``self``.
563
+
564
+ See :class:`~sage.manifolds.section_module.SectionModule` for a complete
565
+ documentation.
566
+
567
+ INPUT:
568
+
569
+ - ``domain`` -- (default: ``None``) the domain on which the module is
570
+ defined; if ``None`` the base space is assumed
571
+ - ``force_free`` -- boolean (default: ``False``); if set to ``True``, force
572
+ the construction of a *free* module (this implies that `E` is trivial)
573
+
574
+ OUTPUT:
575
+
576
+ - a
577
+ :class:`~sage.manifolds.section_module.SectionModule`
578
+ (or if `E` is trivial, a
579
+ :class:`~sage.manifolds.section_module.SectionFreeModule`)
580
+ representing the module of continuous sections on
581
+ `U` taking values in `E`
582
+
583
+ EXAMPLES:
584
+
585
+ Module of sections on the Möbius bundle over the real-projective space
586
+ `M=\RR P^1`::
587
+
588
+ sage: M = Manifold(1, 'RP^1', structure='top', start_index=1)
589
+ sage: U = M.open_subset('U') # the complement of one point
590
+ sage: c_u.<u> = U.chart() # [1:u] in homogeneous coord.
591
+ sage: V = M.open_subset('V') # the complement of the point u=0
592
+ sage: M.declare_union(U,V) # [v:1] in homogeneous coord.
593
+ sage: c_v.<v> = V.chart()
594
+ sage: u_to_v = c_u.transition_map(c_v, (1/u),
595
+ ....: intersection_name='W',
596
+ ....: restrictions1 = u!=0,
597
+ ....: restrictions2 = v!=0)
598
+ sage: v_to_u = u_to_v.inverse()
599
+ sage: W = U.intersection(V)
600
+ sage: E = M.vector_bundle(1, 'E')
601
+ sage: phi_U = E.trivialization('phi_U', latex_name=r'\varphi_U',
602
+ ....: domain=U)
603
+ sage: phi_V = E.trivialization('phi_V', latex_name=r'\varphi_V',
604
+ ....: domain=V)
605
+ sage: transf = phi_U.transition_map(phi_V, [[u]])
606
+ sage: C0 = E.section_module(); C0
607
+ Module C^0(RP^1;E) of sections on the 1-dimensional topological
608
+ manifold RP^1 with values in the real vector bundle E of rank 1
609
+
610
+ `C^0(\RR P^1;E)` is a module over the algebra `C^0(\RR P^1)`::
611
+
612
+ sage: C0.category()
613
+ Category of modules over Algebra of scalar fields on the
614
+ 1-dimensional topological manifold RP^1
615
+ sage: C0.base_ring() is M.scalar_field_algebra()
616
+ True
617
+
618
+ However, `C^0(\RR P^1;E)` is not a free module::
619
+
620
+ sage: isinstance(C0, FiniteRankFreeModule)
621
+ False
622
+
623
+ since the Möbius bundle is not trivial::
624
+
625
+ sage: E.is_manifestly_trivial()
626
+ False
627
+
628
+ The section module over `U`, on the other hand, is a free module since
629
+ `E|_U` admits a trivialization and therefore has a local frame::
630
+
631
+ sage: C0_U = E.section_module(domain=U)
632
+ sage: isinstance(C0_U, FiniteRankFreeModule)
633
+ True
634
+
635
+ The elements of `C^0(U)` are sections on `U`::
636
+
637
+ sage: C0_U.an_element()
638
+ Section on the Open subset U of the 1-dimensional topological
639
+ manifold RP^1 with values in the real vector bundle E of rank 1
640
+ sage: C0_U.an_element().display(phi_U.frame())
641
+ 2 (phi_U^*e_1)
642
+ """
643
+ if domain is None:
644
+ domain = self._base_space
645
+ from sage.manifolds.section_module import SectionFreeModule, SectionModule
646
+ if domain not in self._section_modules:
647
+ if force_free or domain in self._trivial_parts:
648
+ self._section_modules[domain] = SectionFreeModule(self, domain)
649
+ else:
650
+ self._section_modules[domain] = SectionModule(self, domain)
651
+
652
+ return self._section_modules[domain]
653
+
654
+ def fiber(self, point):
655
+ r"""
656
+ Return the vector bundle fiber over a point.
657
+
658
+ INPUT:
659
+
660
+ - ``point`` -- :class:`~sage.manifolds.point.ManifoldPoint`;
661
+ point `p` of the base space of ``self``
662
+
663
+ OUTPUT:
664
+
665
+ - instance of :class:`~sage.manifolds.vector_bundle_fiber.VectorBundleFiber`
666
+ representing the fiber over `p`
667
+
668
+ EXAMPLES::
669
+
670
+ sage: M = Manifold(3, 'M', structure='top')
671
+ sage: X.<x,y,z> = M.chart()
672
+ sage: p = M((0,2,1), name='p'); p
673
+ Point p on the 3-dimensional topological manifold M
674
+ sage: E = M.vector_bundle(2, 'E'); E
675
+ Topological real vector bundle E -> M of rank 2 over the base space
676
+ 3-dimensional topological manifold M
677
+ sage: E.fiber(p)
678
+ Fiber of E at Point p on the 3-dimensional topological manifold M
679
+ """
680
+ return VectorBundleFiber(self, point)
681
+
682
+ def local_frame(self, *args, **kwargs):
683
+ r"""
684
+ Define a local frame on ``self``.
685
+
686
+ A *local frame* is a section on a subset `U \subset M` in `E` that
687
+ provides, at each point `p` of the base space, a vector basis of the
688
+ fiber `E_p` at `p`.
689
+
690
+ .. SEEALSO::
691
+
692
+ :class:`~sage.manifolds.local_frame.LocalFrame` for complete
693
+ documentation.
694
+
695
+ INPUT:
696
+
697
+ - ``symbol`` -- either a string, to be used as a common base for the
698
+ symbols of the sections constituting the local frame, or a list/tuple
699
+ of strings, representing the individual symbols of the sections
700
+ - ``sections`` -- tuple or list of `n` linearly independent sections on
701
+ ``self`` (`n` being the rank of ``self``) defining the local
702
+ frame; can be omitted if the local frame is created from scratch
703
+ - ``latex_symbol`` -- (default: ``None``) either a string, to be used
704
+ as a common base for the LaTeX symbols of the sections
705
+ constituting the local frame, or a list/tuple of strings,
706
+ representing the individual LaTeX symbols of the sections;
707
+ if ``None``, ``symbol`` is used in place of ``latex_symbol``
708
+ - ``indices`` -- (default: ``None``; used only if ``symbol`` is a
709
+ single string) tuple of strings representing the indices labelling
710
+ the sections of the frame; if ``None``, the indices will be
711
+ generated as integers within the range declared on ``self``
712
+ - ``latex_indices`` -- (default: ``None``) tuple of strings
713
+ representing the indices for the LaTeX symbols of the sections;
714
+ if ``None``, ``indices`` is used instead
715
+ - ``symbol_dual`` -- (default: ``None``) same as ``symbol`` but for the
716
+ dual coframe; if ``None``, ``symbol`` must be a string and is used
717
+ for the common base of the symbols of the elements of the dual
718
+ coframe
719
+ - ``latex_symbol_dual`` -- (default: ``None``) same as ``latex_symbol``
720
+ but for the dual coframe
721
+ - ``domain`` -- (default: ``None``) domain on which the local frame
722
+ is defined; if ``None``, the whole base space is assumed
723
+
724
+ OUTPUT:
725
+
726
+ - a :class:`~sage.manifolds.local_frame.LocalFrame` representing the
727
+ defined local frame
728
+
729
+ EXAMPLES:
730
+
731
+
732
+ Defining a local frame from two linearly independent sections on a
733
+ real rank-2 vector bundle::
734
+
735
+ sage: M = Manifold(3, 'M', structure='top')
736
+ sage: U = M.open_subset('U')
737
+ sage: X.<x,y,z> = U.chart()
738
+ sage: E = M.vector_bundle(2, 'E')
739
+ sage: phi = E.trivialization('phi', domain=U)
740
+ sage: s0 = E.section(name='s_0', domain=U)
741
+ sage: s0[:] = 1+z^2, -2
742
+ sage: s1 = E.section(name='s_1', domain=U)
743
+ sage: s1[:] = 1, 1+x^2
744
+ sage: e = E.local_frame('e', (s0, s1), domain=U); e
745
+ Local frame (E|_U, (e_0,e_1))
746
+ sage: (e[0], e[1]) == (s0, s1)
747
+ True
748
+
749
+ If the sections are not linearly independent, an error is raised::
750
+
751
+ sage: e = E.local_frame('z', (s0, -s0), domain=U)
752
+ Traceback (most recent call last):
753
+ ...
754
+ ValueError: the provided sections are not linearly independent
755
+
756
+ It is also possible to create a local frame from scratch, without
757
+ connecting it to previously defined local frames or sections
758
+ (this can still be performed later via the method
759
+ :meth:`set_change_of_frame`)::
760
+
761
+ sage: f = E.local_frame('f', domain=U); f
762
+ Local frame (E|_U, (f_0,f_1))
763
+
764
+ For a global frame, the argument ``domain`` is omitted::
765
+
766
+ sage: g = E.local_frame('g'); g
767
+ Local frame (E|_M, (g_0,g_1))
768
+
769
+ .. SEEALSO::
770
+
771
+ For more options, in particular for the choice of symbols and
772
+ indices, see :class:`~sage.manifolds.local_frame.LocalFrame`.
773
+ """
774
+ from sage.manifolds.local_frame import LocalFrame
775
+ # Input processing
776
+ n_args = len(args)
777
+ if n_args < 1 or n_args > 2:
778
+ raise TypeError("local_frame() takes one or two positional "
779
+ "arguments, not {}".format(n_args))
780
+ symbol = args[0]
781
+ sections = None
782
+ if n_args == 2:
783
+ sections = args[1]
784
+ latex_symbol = kwargs.pop('latex_symbol', None)
785
+ indices = kwargs.pop('indices', None)
786
+ latex_indices = kwargs.pop('latex_indices', None)
787
+ symbol_dual = kwargs.pop('symbol_dual', None)
788
+ latex_symbol_dual = kwargs.pop('latex_symbol_dual', None)
789
+ domain = kwargs.pop('domain', None)
790
+
791
+ sec_module = self.section_module(domain=domain, force_free=True)
792
+ resu = LocalFrame(sec_module, symbol=symbol, latex_symbol=latex_symbol,
793
+ indices=indices, latex_indices=latex_indices,
794
+ symbol_dual=symbol_dual,
795
+ latex_symbol_dual=latex_symbol_dual)
796
+ if sections:
797
+ linked = False
798
+ try:
799
+ resu._init_from_family(sections)
800
+ except ArithmeticError as err:
801
+ linked = str(err) in ["non-invertible matrix",
802
+ "input matrix must be nonsingular"]
803
+ if linked:
804
+ raise ValueError("the provided sections are not linearly "
805
+ "independent")
806
+ return resu
807
+
808
+ def section(self, *comp, **kwargs):
809
+ r"""
810
+ Return a continuous section of ``self``.
811
+
812
+ INPUT:
813
+
814
+ - ``domain`` -- (default: ``None``) domain on which the section shall be
815
+ defined; if ``None``, the base space is assumed
816
+ - ``name`` -- (default: ``None``) name of the local section
817
+ - ``latex_name`` -- (default``None``) latex representation of the local
818
+ section
819
+
820
+ OUTPUT:
821
+
822
+ - an instance of :class:`~sage.manifolds.section.Section` representing
823
+ a continuous section of `M` with values on `E`
824
+
825
+ EXAMPLES:
826
+
827
+ A section on a non-trivial rank 2 vector bundle over a non-trivial
828
+ 2-manifold::
829
+
830
+ sage: M = Manifold(2, 'M', structure='top')
831
+ sage: U = M.open_subset('U') ; V = M.open_subset('V')
832
+ sage: M.declare_union(U,V) # M is the union of U and V
833
+ sage: c_xy.<x,y> = U.chart() ; c_uv.<u,v> = V.chart()
834
+ sage: xy_to_uv = c_xy.transition_map(c_uv, (x+y, x-y),
835
+ ....: intersection_name='W', restrictions1= x>0,
836
+ ....: restrictions2= u+v>0)
837
+ sage: uv_to_xy = xy_to_uv.inverse()
838
+ sage: W = U.intersection(V)
839
+ sage: E = M.vector_bundle(2, 'E') # define the vector bundle
840
+ sage: phi_U = E.trivialization('phi_U', domain=U) # define trivializations
841
+ sage: phi_V = E.trivialization('phi_V', domain=V)
842
+ sage: transf = phi_U.transition_map(phi_V, [[0,x],[x,0]]) # transition map between trivializations
843
+ sage: fU = phi_U.frame(); fV = phi_V.frame() # define induced frames
844
+ sage: s = E.section(name='s'); s
845
+ Section s on the 2-dimensional topological manifold M with values in the
846
+ real vector bundle E of rank 2
847
+ """
848
+ domain = kwargs.pop('domain', self._base_space)
849
+ name = kwargs.pop('name', None)
850
+ latex_name = kwargs.pop('latex_name', None)
851
+ smodule = self.section_module(domain=domain) # the parent
852
+ resu = smodule.element_class(smodule, name=name, latex_name=latex_name)
853
+ if comp:
854
+ # Some components are to be initialized
855
+ resu._init_components(*comp, **kwargs)
856
+ return resu
857
+
858
+ def total_space(self):
859
+ r"""
860
+ Return the total space of ``self``.
861
+
862
+ .. NOTE::
863
+
864
+ At this stage, the total space does not come with induced charts.
865
+
866
+ OUTPUT:
867
+
868
+ - the total space of ``self`` as an instance of
869
+ :class:`~sage.manifolds.manifold.TopologicalManifold`
870
+
871
+ EXAMPLES::
872
+
873
+ sage: M = Manifold(3, 'M', structure='top')
874
+ sage: E = M.vector_bundle(2, 'E')
875
+ sage: E.total_space()
876
+ 5-dimensional topological manifold E
877
+ """
878
+ if self._total_space is None:
879
+ from sage.manifolds.manifold import Manifold
880
+ base_space = self._base_space
881
+ dim = base_space._dim + self._rank
882
+ sindex = base_space.start_index()
883
+ self._total_space = Manifold(
884
+ dim, self._name,
885
+ latex_name=self._latex_name,
886
+ field=self._field, structure='topological',
887
+ start_index=sindex
888
+ )
889
+
890
+ # TODO: if update_atlas: introduce charts via self._atlas
891
+
892
+ return self._total_space
893
+
894
+ def set_change_of_frame(self, frame1, frame2, change_of_frame,
895
+ compute_inverse=True):
896
+ r"""
897
+ Relate two vector frames by an automorphism.
898
+
899
+ This updates the internal dictionary ``self._frame_changes``.
900
+
901
+ INPUT:
902
+
903
+ - ``frame1`` -- frame 1, denoted `(e_i)` below
904
+ - ``frame2`` -- frame 2, denoted `(f_i)` below
905
+ - ``change_of_frame`` -- instance of class
906
+ :class:`~sage.tensor.modules.free_module_automorphism.FreeModuleAutomorphism`
907
+ describing the automorphism `P` that relates the basis `(e_i)` to
908
+ the basis `(f_i)` according to `f_i = P(e_i)`
909
+ - ``compute_inverse`` -- boolean (default: ``True``); if set to True,
910
+ the inverse automorphism is computed and the change from basis
911
+ `(f_i)` to `(e_i)` is set to it in the internal dictionary
912
+ ``self._frame_changes``
913
+
914
+ EXAMPLES::
915
+
916
+ sage: M = Manifold(3, 'M')
917
+ sage: c_xyz.<x,y,z> = M.chart()
918
+ sage: E = M.vector_bundle(2, 'E')
919
+ sage: e = E.local_frame('e')
920
+ sage: f = E.local_frame('f')
921
+ sage: a = E.section_module().automorphism()
922
+ sage: a[e,:] = [[1,2],[0,3]]
923
+ sage: E.set_change_of_frame(e, f, a)
924
+ sage: f[0].display(e)
925
+ f_0 = e_0
926
+ sage: f[1].display(e)
927
+ f_1 = 2 e_0 + 3 e_1
928
+ sage: e[0].display(f)
929
+ e_0 = f_0
930
+ sage: e[1].display(f)
931
+ e_1 = -2/3 f_0 + 1/3 f_1
932
+ sage: E.change_of_frame(e,f)[e,:]
933
+ [1 2]
934
+ [0 3]
935
+ """
936
+ from sage.tensor.modules.free_module_automorphism import FreeModuleAutomorphism
937
+ sec_module = frame1._fmodule
938
+ if frame2._fmodule != sec_module:
939
+ raise ValueError("the two frames are not defined on the same " +
940
+ "section module")
941
+ if isinstance(change_of_frame, FreeModuleAutomorphism):
942
+ auto = change_of_frame
943
+ else: # Otherwise try to coerce the input
944
+ auto_group = sec_module.general_linear_group()
945
+ auto = auto_group(change_of_frame, basis=frame1)
946
+ sec_module.set_change_of_basis(frame1, frame2, auto,
947
+ compute_inverse=compute_inverse)
948
+ self._frame_changes[(frame1, frame2)] = auto
949
+ if compute_inverse:
950
+ self._frame_changes[(frame2, frame1)] = ~auto
951
+
952
+ def change_of_frame(self, frame1, frame2):
953
+ r"""
954
+ Return a change of local frames defined on ``self``.
955
+
956
+ INPUT:
957
+
958
+ - ``frame1`` -- local frame 1
959
+ - ``frame2`` -- local frame 2
960
+
961
+ OUTPUT:
962
+
963
+ - a :class:`~sage.tensor.modules.free_module_automorphism.FreeModuleAutomorphism`
964
+ representing, at each point, the vector space automorphism `P` that
965
+ relates frame 1, `(e_i)` say, to frame 2, `(f_i)` say, according to
966
+ `f_i = P(e_i)`
967
+
968
+ EXAMPLES::
969
+
970
+ sage: M = Manifold(3, 'M', structure='top')
971
+ sage: X.<x,y,z> = M.chart()
972
+ sage: E = M.vector_bundle(2, 'E')
973
+ sage: e = E.local_frame('e')
974
+ sage: a = E.section_module().automorphism() # Now, the section module is free
975
+ sage: a[:] = [[sqrt(3)/2, -1/2], [1/2, sqrt(3)/2]]
976
+ sage: f = e.new_frame(a, 'f')
977
+ sage: E.change_of_frame(e, f)
978
+ Automorphism of the Free module C^0(M;E) of sections on the
979
+ 3-dimensional topological manifold M with values in the real vector
980
+ bundle E of rank 2
981
+ sage: a == E.change_of_frame(e, f)
982
+ True
983
+ sage: a.inverse() == E.change_of_frame(f, e)
984
+ True
985
+ """
986
+ if (frame1, frame2) not in self._frame_changes:
987
+ raise ValueError("the change of frame from {} to {}".format(frame1, frame2) +
988
+ " has not been defined on the {}".format(self))
989
+ return self._frame_changes[(frame1, frame2)]
990
+
991
+ def changes_of_frame(self):
992
+ r"""
993
+ Return all the changes of local frames defined on ``self``.
994
+
995
+ OUTPUT:
996
+
997
+ - dictionary of vector bundle automorphisms representing
998
+ the changes of frames, the keys being the pair of frames
999
+
1000
+ EXAMPLES::
1001
+
1002
+ sage: M = Manifold(3, 'M', structure='top')
1003
+ sage: c_xyz.<x,y,z> = M.chart()
1004
+ sage: E = M.vector_bundle(2, 'E')
1005
+ sage: e = E.local_frame('e'); e
1006
+ Local frame (E|_M, (e_0,e_1))
1007
+ sage: auto_group = E.section_module().general_linear_group()
1008
+ sage: e_to_f = auto_group([[0,1],[1,0]]); e_to_f
1009
+ Automorphism of the Free module C^0(M;E) of sections on the
1010
+ 3-dimensional topological manifold M with values in the real vector
1011
+ bundle E of rank 2
1012
+ sage: f_in_e = auto_group([[0,1],[1,0]])
1013
+ sage: f = e.new_frame(f_in_e, 'f'); f
1014
+ Local frame (E|_M, (f_0,f_1))
1015
+ sage: E.changes_of_frame() # random
1016
+ {(Local frame (E|_M, (f_0,f_1)),
1017
+ Local frame (E|_M, (e_0,e_1))): Automorphism of the Free module
1018
+ C^0(M;E) of sections on the 3-dimensional topological manifold M
1019
+ with values in the real vector bundle E of rank 2,
1020
+ (Local frame (E|_M, (e_0,e_1)),
1021
+ Local frame (E|_M, (f_0,f_1))): Automorphism of the Free module
1022
+ C^0(M;E) of sections on the 3-dimensional topological manifold M
1023
+ with values in the real vector bundle E of rank 2}
1024
+ """
1025
+ return self._frame_changes.copy()
1026
+
1027
+ def frames(self):
1028
+ r"""
1029
+ Return the list of local frames defined on ``self``.
1030
+
1031
+ OUTPUT: list of local frames defined on ``self``
1032
+
1033
+ EXAMPLES::
1034
+
1035
+ sage: M = Manifold(3, 'M', structure='top')
1036
+ sage: E = M.vector_bundle(2, 'E')
1037
+ sage: U = M.open_subset('U'); V = M.open_subset('V')
1038
+ sage: phi_U = E.trivialization('phi_U', domain=U)
1039
+ sage: e = E.local_frame('e', domain=V)
1040
+ sage: E.frames()
1041
+ [Trivialization frame (E|_U, ((phi_U^*e_1),(phi_U^*e_2))),
1042
+ Local frame (E|_V, (e_0,e_1))]
1043
+ """
1044
+ return list(self._frames)
1045
+
1046
+ def coframes(self):
1047
+ r"""
1048
+ Return the list of coframes defined on ``self``.
1049
+
1050
+ OUTPUT: list of coframes defined on ``self``
1051
+
1052
+ EXAMPLES::
1053
+
1054
+ sage: M = Manifold(3, 'M', structure='top')
1055
+ sage: E = M.vector_bundle(2, 'E')
1056
+ sage: U = M.open_subset('U'); V = M.open_subset('V')
1057
+ sage: phi_U = E.trivialization('phi_U', domain=U)
1058
+ sage: e = E.local_frame('e', domain=V)
1059
+ sage: E.coframes()
1060
+ [Trivialization coframe (E|_U, ((phi_U^*e^1),(phi_U^*e^2))),
1061
+ Local coframe (E|_V, (e^0,e^1))]
1062
+ """
1063
+ return list(self._coframes)
1064
+
1065
+ def default_frame(self):
1066
+ r"""
1067
+ Return the default frame of on ``self``.
1068
+
1069
+ OUTPUT:
1070
+
1071
+ - a local frame as an instance of
1072
+ :class:`~sage.manifolds.local_frame.LocalFrame`
1073
+
1074
+ EXAMPLES::
1075
+
1076
+ sage: M = Manifold(3, 'M', structure='top')
1077
+ sage: E = M.vector_bundle(2, 'E')
1078
+ sage: e = E.local_frame('e')
1079
+ sage: E.default_frame()
1080
+ Local frame (E|_M, (e_0,e_1))
1081
+ """
1082
+ return self._def_frame
1083
+
1084
+ def set_default_frame(self, frame):
1085
+ r"""
1086
+ Set the default frame of ``self``.
1087
+
1088
+ INPUT:
1089
+
1090
+ - ``frame`` -- a local frame defined on ``self`` as an instance of
1091
+ :class:`~sage.manifolds.local_frame.LocalFrame`
1092
+
1093
+ EXAMPLES::
1094
+
1095
+ sage: M = Manifold(3, 'M', structure='top')
1096
+ sage: E = M.vector_bundle(2, 'E')
1097
+ sage: e = E.local_frame('e')
1098
+ sage: E.default_frame()
1099
+ Local frame (E|_M, (e_0,e_1))
1100
+ sage: f = E.local_frame('f')
1101
+ sage: E.set_default_frame(f)
1102
+ sage: E.default_frame()
1103
+ Local frame (E|_M, (f_0,f_1))
1104
+ """
1105
+ from sage.manifolds.local_frame import LocalFrame
1106
+ if not isinstance(frame, LocalFrame):
1107
+ raise TypeError("{} is not a local frame".format(frame))
1108
+ if not frame._domain.is_subset(self._base_space):
1109
+ raise ValueError("the frame must be defined on " +
1110
+ "the {}".format(self))
1111
+ frame._fmodule.set_default_basis(frame)
1112
+ self._def_frame = frame
1113
+
1114
+ def set_orientation(self, orientation):
1115
+ r"""
1116
+ Set the preferred orientation of ``self``.
1117
+
1118
+ INPUT:
1119
+
1120
+ - ``orientation`` -- a local frame or a list of local frames whose
1121
+ domains cover the base space
1122
+
1123
+ .. WARNING::
1124
+
1125
+ It is the user's responsibility that the orientation set here
1126
+ is indeed an orientation. There is no check going on in the
1127
+ background. See :meth:`orientation` for the definition of an
1128
+ orientation.
1129
+
1130
+ EXAMPLES:
1131
+
1132
+ Set an orientation on a vector bundle::
1133
+
1134
+ sage: M = Manifold(3, 'M', structure='top')
1135
+ sage: E = M.vector_bundle(2, 'E')
1136
+ sage: e = E.local_frame('e'); e
1137
+ Local frame (E|_M, (e_0,e_1))
1138
+ sage: f = E.local_frame('f'); f
1139
+ Local frame (E|_M, (f_0,f_1))
1140
+ sage: E.set_orientation(f)
1141
+ sage: E.orientation()
1142
+ [Local frame (E|_M, (f_0,f_1))]
1143
+
1144
+ Set an orientation in the non-trivial case::
1145
+
1146
+ sage: M = Manifold(3, 'M', structure='top')
1147
+ sage: U = M.open_subset('U'); V = M.open_subset('V')
1148
+ sage: M.declare_union(U, V)
1149
+ sage: E = M.vector_bundle(2, 'E')
1150
+ sage: e = E.local_frame('e', domain=U); e
1151
+ Local frame (E|_U, (e_0,e_1))
1152
+ sage: f = E.local_frame('f', domain=V); f
1153
+ Local frame (E|_V, (f_0,f_1))
1154
+ sage: E.orientation()
1155
+ []
1156
+ sage: E.set_orientation([e, f])
1157
+ sage: E.orientation()
1158
+ [Local frame (E|_U, (e_0,e_1)),
1159
+ Local frame (E|_V, (f_0,f_1))]
1160
+ """
1161
+ from sage.manifolds.local_frame import LocalFrame
1162
+ if isinstance(orientation, LocalFrame):
1163
+ orientation = [orientation]
1164
+ elif isinstance(orientation, (tuple, list)):
1165
+ orientation = list(orientation)
1166
+ else:
1167
+ raise TypeError("orientation must be a frame or a list/tuple of "
1168
+ "frames")
1169
+ dom_union = None
1170
+ for frame in orientation:
1171
+ if frame not in self.frames():
1172
+ raise ValueError("{} must be a frame ".format(frame) +
1173
+ "defined on {}".format(self))
1174
+ dom = frame.domain()
1175
+ if dom_union is not None:
1176
+ dom_union = dom.union(dom_union)
1177
+ else:
1178
+ dom_union = dom
1179
+ base_space = self._base_space
1180
+ if dom_union != base_space:
1181
+ raise ValueError("the frames's domains must "
1182
+ "cover {}".format(base_space))
1183
+ self._orientation = orientation
1184
+
1185
+ def orientation(self):
1186
+ r"""
1187
+ Get the orientation of ``self`` if available.
1188
+
1189
+ An *orientation* on a vector bundle is a choice of local frames whose
1190
+
1191
+ 1. union of domains cover the base space,
1192
+ 2. changes of frames are pairwise orientation preserving, i.e. have
1193
+ positive determinant.
1194
+
1195
+ A vector bundle endowed with an orientation is called *orientable*.
1196
+
1197
+ The trivial case corresponds to ``self`` being trivial, i.e. ``self``
1198
+ can be covered by one frame. In that case, if no preferred
1199
+ orientation has been set before, one of those frames (usually the
1200
+ default frame) is set automatically to the preferred orientation and
1201
+ returned here.
1202
+
1203
+ EXAMPLES:
1204
+
1205
+ The trivial case is covered automatically::
1206
+
1207
+ sage: M = Manifold(3, 'M', structure='top')
1208
+ sage: E = M.vector_bundle(2, 'E')
1209
+ sage: e = E.local_frame('e'); e
1210
+ Local frame (E|_M, (e_0,e_1))
1211
+ sage: E.orientation() # trivial case
1212
+ [Local frame (E|_M, (e_0,e_1))]
1213
+
1214
+ The orientation can also be set by the user::
1215
+
1216
+ sage: f = E.local_frame('f'); f
1217
+ Local frame (E|_M, (f_0,f_1))
1218
+ sage: E.set_orientation(f)
1219
+ sage: E.orientation()
1220
+ [Local frame (E|_M, (f_0,f_1))]
1221
+
1222
+ In case of the non-trivial case, the orientation must be set manually,
1223
+ otherwise no orientation is returned::
1224
+
1225
+ sage: M = Manifold(3, 'M', structure='top')
1226
+ sage: U = M.open_subset('U'); V = M.open_subset('V')
1227
+ sage: M.declare_union(U, V)
1228
+ sage: E = M.vector_bundle(2, 'E')
1229
+ sage: e = E.local_frame('e', domain=U); e
1230
+ Local frame (E|_U, (e_0,e_1))
1231
+ sage: f = E.local_frame('f', domain=V); f
1232
+ Local frame (E|_V, (f_0,f_1))
1233
+ sage: E.orientation()
1234
+ []
1235
+ sage: E.set_orientation([e, f])
1236
+ sage: E.orientation()
1237
+ [Local frame (E|_U, (e_0,e_1)),
1238
+ Local frame (E|_V, (f_0,f_1))]
1239
+ """
1240
+ if not self._orientation:
1241
+ # Trivial case:
1242
+ if self.is_manifestly_trivial():
1243
+ # Try the default frame:
1244
+ def_frame = self._def_frame
1245
+ if def_frame is not None:
1246
+ if def_frame._domain is self._base_space:
1247
+ self._orientation = [def_frame]
1248
+ # Still no orientation? Choose arbitrary frame:
1249
+ if not self._orientation:
1250
+ for frame in self.frames():
1251
+ if frame._domain is self._base_space:
1252
+ self._orientation = [frame]
1253
+ break
1254
+ return list(self._orientation)
1255
+
1256
+ def has_orientation(self) -> bool:
1257
+ r"""
1258
+ Check whether ``self`` admits an obvious or by user set orientation.
1259
+
1260
+ .. SEEALSO::
1261
+
1262
+ Consult :meth:`orientation` for details about orientations.
1263
+
1264
+ .. NOTE::
1265
+
1266
+ Notice that if :meth:`has_orientation` returns ``False`` this does
1267
+ not necessarily mean that the vector bundle admits no orientation.
1268
+ It just means that the user has to set an orientation manually
1269
+ in that case, see :meth:`set_orientation`.
1270
+
1271
+ EXAMPLES:
1272
+
1273
+ The trivial case::
1274
+
1275
+ sage: M = Manifold(3, 'M', structure='top')
1276
+ sage: E = M.vector_bundle(2, 'E')
1277
+ sage: e = E.local_frame('e')
1278
+ sage: E.has_orientation() # trivial case
1279
+ True
1280
+
1281
+ Non-trivial case::
1282
+
1283
+ sage: M = Manifold(3, 'M', structure='top')
1284
+ sage: U = M.open_subset('U'); V = M.open_subset('V')
1285
+ sage: M.declare_union(U, V)
1286
+ sage: E = M.vector_bundle(2, 'E')
1287
+ sage: e = E.local_frame('e', domain=U)
1288
+ sage: f = E.local_frame('f', domain=V)
1289
+ sage: E.has_orientation()
1290
+ False
1291
+ sage: E.set_orientation([e, f])
1292
+ sage: E.has_orientation()
1293
+ True
1294
+ """
1295
+ return bool(self.orientation())
1296
+
1297
+ def irange(self, start=None):
1298
+ r"""
1299
+ Single index generator.
1300
+
1301
+ INPUT:
1302
+
1303
+ - ``start`` -- (default: ``None``) initial value `i_0` of the index;
1304
+ if none are provided, the value returned by
1305
+ :meth:`sage.manifolds.manifold.Manifold.start_index()` is assumed
1306
+
1307
+ OUTPUT:
1308
+
1309
+ - an iterable index, starting from `i_0` and ending at
1310
+ `i_0 + n - 1`, where `n` is the vector bundle's dimension
1311
+
1312
+ EXAMPLES:
1313
+
1314
+ Index range on a 4-dimensional vector bundle over a 5-dimensional
1315
+ manifold::
1316
+
1317
+ sage: M = Manifold(5, 'M', structure='topological')
1318
+ sage: E = M.vector_bundle(4, 'E')
1319
+ sage: list(E.irange())
1320
+ [0, 1, 2, 3]
1321
+ sage: list(E.irange(2))
1322
+ [2, 3]
1323
+
1324
+ Index range on a 4-dimensional vector bundle over a 5-dimensional
1325
+ manifold with starting index=1::
1326
+
1327
+ sage: M = Manifold(5, 'M', structure='topological', start_index=1)
1328
+ sage: E = M.vector_bundle(4, 'E')
1329
+ sage: list(E.irange())
1330
+ [1, 2, 3, 4]
1331
+ sage: list(E.irange(2))
1332
+ [2, 3, 4]
1333
+
1334
+ In general, one has always::
1335
+
1336
+ sage: next(E.irange()) == M.start_index()
1337
+ True
1338
+ """
1339
+ si = self._base_space._sindex
1340
+ imax = self._rank + si
1341
+ if start is None:
1342
+ i = si
1343
+ else:
1344
+ i = start
1345
+ while i < imax:
1346
+ yield i
1347
+ i += 1