passagemath-symbolics 10.6.43__cp314-cp314t-musllinux_1_2_x86_64.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.

Potentially problematic release.


This version of passagemath-symbolics might be problematic. Click here for more details.

Files changed (171) hide show
  1. passagemath_symbolics/__init__.py +3 -0
  2. passagemath_symbolics-10.6.43.dist-info/METADATA +187 -0
  3. passagemath_symbolics-10.6.43.dist-info/RECORD +171 -0
  4. passagemath_symbolics-10.6.43.dist-info/WHEEL +5 -0
  5. passagemath_symbolics-10.6.43.dist-info/top_level.txt +3 -0
  6. sage/all__sagemath_symbolics.py +17 -0
  7. sage/calculus/all.py +14 -0
  8. sage/calculus/calculus.py +2826 -0
  9. sage/calculus/desolvers.py +1866 -0
  10. sage/calculus/predefined.py +51 -0
  11. sage/calculus/tests.py +225 -0
  12. sage/calculus/var.cpython-314t-x86_64-linux-musl.so +0 -0
  13. sage/calculus/var.pyx +401 -0
  14. sage/dynamics/all__sagemath_symbolics.py +6 -0
  15. sage/dynamics/complex_dynamics/all.py +5 -0
  16. sage/dynamics/complex_dynamics/mandel_julia.py +765 -0
  17. sage/dynamics/complex_dynamics/mandel_julia_helper.cpython-314t-x86_64-linux-musl.so +0 -0
  18. sage/dynamics/complex_dynamics/mandel_julia_helper.pyx +1035 -0
  19. sage/ext/all__sagemath_symbolics.py +1 -0
  20. sage/ext_data/kenzo/CP2.txt +45 -0
  21. sage/ext_data/kenzo/CP3.txt +349 -0
  22. sage/ext_data/kenzo/CP4.txt +4774 -0
  23. sage/ext_data/kenzo/README.txt +49 -0
  24. sage/ext_data/kenzo/S4.txt +20 -0
  25. sage/ext_data/magma/latex/latex.m +1021 -0
  26. sage/ext_data/magma/latex/latex.spec +1 -0
  27. sage/ext_data/magma/sage/basic.m +356 -0
  28. sage/ext_data/magma/sage/sage.spec +1 -0
  29. sage/ext_data/magma/spec +9 -0
  30. sage/geometry/all__sagemath_symbolics.py +8 -0
  31. sage/geometry/hyperbolic_space/all.py +5 -0
  32. sage/geometry/hyperbolic_space/hyperbolic_coercion.py +743 -0
  33. sage/geometry/hyperbolic_space/hyperbolic_constants.py +5 -0
  34. sage/geometry/hyperbolic_space/hyperbolic_geodesic.py +2409 -0
  35. sage/geometry/hyperbolic_space/hyperbolic_interface.py +206 -0
  36. sage/geometry/hyperbolic_space/hyperbolic_isometry.py +1082 -0
  37. sage/geometry/hyperbolic_space/hyperbolic_model.py +1502 -0
  38. sage/geometry/hyperbolic_space/hyperbolic_point.py +621 -0
  39. sage/geometry/riemannian_manifolds/all.py +7 -0
  40. sage/geometry/riemannian_manifolds/parametrized_surface3d.py +1632 -0
  41. sage/geometry/riemannian_manifolds/surface3d_generators.py +461 -0
  42. sage/interfaces/all__sagemath_symbolics.py +1 -0
  43. sage/interfaces/magma.py +3017 -0
  44. sage/interfaces/magma_free.py +92 -0
  45. sage/interfaces/maple.py +1397 -0
  46. sage/interfaces/mathematica.py +1345 -0
  47. sage/interfaces/mathics.py +1312 -0
  48. sage/interfaces/sympy.py +1398 -0
  49. sage/interfaces/sympy_wrapper.py +197 -0
  50. sage/interfaces/tides.py +938 -0
  51. sage/libs/all__sagemath_symbolics.py +6 -0
  52. sage/manifolds/all.py +7 -0
  53. sage/manifolds/calculus_method.py +555 -0
  54. sage/manifolds/catalog.py +437 -0
  55. sage/manifolds/chart.py +4019 -0
  56. sage/manifolds/chart_func.py +3419 -0
  57. sage/manifolds/continuous_map.py +2183 -0
  58. sage/manifolds/continuous_map_image.py +155 -0
  59. sage/manifolds/differentiable/affine_connection.py +2475 -0
  60. sage/manifolds/differentiable/all.py +1 -0
  61. sage/manifolds/differentiable/automorphismfield.py +1383 -0
  62. sage/manifolds/differentiable/automorphismfield_group.py +604 -0
  63. sage/manifolds/differentiable/bundle_connection.py +1445 -0
  64. sage/manifolds/differentiable/characteristic_cohomology_class.py +1840 -0
  65. sage/manifolds/differentiable/chart.py +1241 -0
  66. sage/manifolds/differentiable/curve.py +1028 -0
  67. sage/manifolds/differentiable/de_rham_cohomology.py +541 -0
  68. sage/manifolds/differentiable/degenerate.py +559 -0
  69. sage/manifolds/differentiable/degenerate_submanifold.py +1671 -0
  70. sage/manifolds/differentiable/diff_form.py +1658 -0
  71. sage/manifolds/differentiable/diff_form_module.py +1062 -0
  72. sage/manifolds/differentiable/diff_map.py +1315 -0
  73. sage/manifolds/differentiable/differentiable_submanifold.py +291 -0
  74. sage/manifolds/differentiable/examples/all.py +1 -0
  75. sage/manifolds/differentiable/examples/euclidean.py +2517 -0
  76. sage/manifolds/differentiable/examples/real_line.py +897 -0
  77. sage/manifolds/differentiable/examples/sphere.py +1186 -0
  78. sage/manifolds/differentiable/examples/symplectic_space.py +187 -0
  79. sage/manifolds/differentiable/examples/symplectic_space_test.py +40 -0
  80. sage/manifolds/differentiable/integrated_curve.py +4035 -0
  81. sage/manifolds/differentiable/levi_civita_connection.py +841 -0
  82. sage/manifolds/differentiable/manifold.py +4254 -0
  83. sage/manifolds/differentiable/manifold_homset.py +1826 -0
  84. sage/manifolds/differentiable/metric.py +3032 -0
  85. sage/manifolds/differentiable/mixed_form.py +1507 -0
  86. sage/manifolds/differentiable/mixed_form_algebra.py +559 -0
  87. sage/manifolds/differentiable/multivector_module.py +800 -0
  88. sage/manifolds/differentiable/multivectorfield.py +1520 -0
  89. sage/manifolds/differentiable/poisson_tensor.py +268 -0
  90. sage/manifolds/differentiable/pseudo_riemannian.py +755 -0
  91. sage/manifolds/differentiable/pseudo_riemannian_submanifold.py +1839 -0
  92. sage/manifolds/differentiable/scalarfield.py +1343 -0
  93. sage/manifolds/differentiable/scalarfield_algebra.py +472 -0
  94. sage/manifolds/differentiable/symplectic_form.py +910 -0
  95. sage/manifolds/differentiable/symplectic_form_test.py +220 -0
  96. sage/manifolds/differentiable/tangent_space.py +412 -0
  97. sage/manifolds/differentiable/tangent_vector.py +616 -0
  98. sage/manifolds/differentiable/tensorfield.py +4665 -0
  99. sage/manifolds/differentiable/tensorfield_module.py +963 -0
  100. sage/manifolds/differentiable/tensorfield_paral.py +2450 -0
  101. sage/manifolds/differentiable/tensorfield_paral_test.py +16 -0
  102. sage/manifolds/differentiable/vector_bundle.py +1728 -0
  103. sage/manifolds/differentiable/vectorfield.py +1717 -0
  104. sage/manifolds/differentiable/vectorfield_module.py +2445 -0
  105. sage/manifolds/differentiable/vectorframe.py +1832 -0
  106. sage/manifolds/family.py +270 -0
  107. sage/manifolds/local_frame.py +1490 -0
  108. sage/manifolds/manifold.py +3090 -0
  109. sage/manifolds/manifold_homset.py +452 -0
  110. sage/manifolds/operators.py +359 -0
  111. sage/manifolds/point.py +994 -0
  112. sage/manifolds/scalarfield.py +3718 -0
  113. sage/manifolds/scalarfield_algebra.py +629 -0
  114. sage/manifolds/section.py +3111 -0
  115. sage/manifolds/section_module.py +831 -0
  116. sage/manifolds/structure.py +229 -0
  117. sage/manifolds/subset.py +2764 -0
  118. sage/manifolds/subsets/all.py +1 -0
  119. sage/manifolds/subsets/closure.py +131 -0
  120. sage/manifolds/subsets/pullback.py +885 -0
  121. sage/manifolds/topological_submanifold.py +891 -0
  122. sage/manifolds/trivialization.py +733 -0
  123. sage/manifolds/utilities.py +1348 -0
  124. sage/manifolds/vector_bundle.py +1342 -0
  125. sage/manifolds/vector_bundle_fiber.py +332 -0
  126. sage/manifolds/vector_bundle_fiber_element.py +111 -0
  127. sage/matrix/all__sagemath_symbolics.py +1 -0
  128. sage/matrix/matrix_symbolic_dense.cpython-314t-x86_64-linux-musl.so +0 -0
  129. sage/matrix/matrix_symbolic_dense.pxd +6 -0
  130. sage/matrix/matrix_symbolic_dense.pyx +1022 -0
  131. sage/matrix/matrix_symbolic_sparse.cpython-314t-x86_64-linux-musl.so +0 -0
  132. sage/matrix/matrix_symbolic_sparse.pxd +6 -0
  133. sage/matrix/matrix_symbolic_sparse.pyx +1029 -0
  134. sage/modules/all__sagemath_symbolics.py +1 -0
  135. sage/modules/vector_callable_symbolic_dense.py +105 -0
  136. sage/modules/vector_symbolic_dense.py +116 -0
  137. sage/modules/vector_symbolic_sparse.py +118 -0
  138. sage/rings/all__sagemath_symbolics.py +4 -0
  139. sage/rings/asymptotic/all.py +6 -0
  140. sage/rings/asymptotic/asymptotic_expansion_generators.py +1485 -0
  141. sage/rings/asymptotic/asymptotic_ring.py +4858 -0
  142. sage/rings/asymptotic/asymptotics_multivariate_generating_functions.py +4153 -0
  143. sage/rings/asymptotic/growth_group.py +5373 -0
  144. sage/rings/asymptotic/growth_group_cartesian.py +1400 -0
  145. sage/rings/asymptotic/term_monoid.py +5237 -0
  146. sage/rings/function_field/all__sagemath_symbolics.py +2 -0
  147. sage/rings/polynomial/all__sagemath_symbolics.py +1 -0
  148. sage/symbolic/all.py +15 -0
  149. sage/symbolic/assumptions.py +985 -0
  150. sage/symbolic/benchmark.py +93 -0
  151. sage/symbolic/callable.py +459 -0
  152. sage/symbolic/complexity_measures.py +35 -0
  153. sage/symbolic/constants.py +1287 -0
  154. sage/symbolic/expression_conversion_algebraic.py +310 -0
  155. sage/symbolic/expression_conversion_sympy.py +317 -0
  156. sage/symbolic/expression_conversions.py +1713 -0
  157. sage/symbolic/function_factory.py +355 -0
  158. sage/symbolic/integration/all.py +1 -0
  159. sage/symbolic/integration/external.py +270 -0
  160. sage/symbolic/integration/integral.py +1115 -0
  161. sage/symbolic/maxima_wrapper.py +162 -0
  162. sage/symbolic/operators.py +267 -0
  163. sage/symbolic/random_tests.py +462 -0
  164. sage/symbolic/relation.py +1907 -0
  165. sage/symbolic/ring.cpython-314t-x86_64-linux-musl.so +0 -0
  166. sage/symbolic/ring.pxd +5 -0
  167. sage/symbolic/ring.pyx +1396 -0
  168. sage/symbolic/subring.py +1025 -0
  169. sage/symbolic/symengine.py +19 -0
  170. sage/symbolic/tests.py +40 -0
  171. sage/symbolic/units.py +1470 -0
@@ -0,0 +1,1826 @@
1
+ # sage_setup: distribution = sagemath-symbolics
2
+ r"""
3
+ Sets of Morphisms between Differentiable Manifolds
4
+
5
+ The class :class:`DifferentiableManifoldHomset` implements sets of morphisms
6
+ between two differentiable manifolds over the same topological field `K`
7
+ (in most applications, `K = \RR` or `K = \CC`), a morphism being a
8
+ *differentiable map* for the category of differentiable manifolds.
9
+
10
+ The subclass :class:`DifferentiableCurveSet` is devoted to the specific case
11
+ of differential curves, i.e. morphisms whose domain is an open interval of
12
+ `\RR`.
13
+
14
+ The subclass :class:`IntegratedCurveSet` is devoted to differentiable
15
+ curves that are defined as a solution to a system of second order
16
+ differential equations.
17
+
18
+ The subclass :class:`IntegratedAutoparallelCurveSet` is devoted to
19
+ differentiable curves that are defined as autoparallel curves with respect to
20
+ a certain affine connection.
21
+
22
+ The subclass :class:`IntegratedGeodesicSet` is devoted to differentiable
23
+ curves that are defined as geodesics with respect to a certain metric.
24
+
25
+ AUTHORS:
26
+
27
+ - Eric Gourgoulhon (2015): initial version
28
+ - Travis Scrimshaw (2016): review tweaks
29
+ - Karim Van Aelst (2017): sets of integrated curves
30
+
31
+
32
+ REFERENCES:
33
+
34
+ - [Lee2013]_
35
+ - [KN1963]_
36
+ """
37
+ #******************************************************************************
38
+ # Copyright (C) 2015 Eric Gourgoulhon <eric.gourgoulhon@obspm.fr>
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 sage.manifolds.differentiable.curve import DifferentiableCurve
47
+ from sage.manifolds.differentiable.diff_map import DiffMap
48
+ from sage.manifolds.differentiable.integrated_curve import (
49
+ IntegratedAutoparallelCurve,
50
+ IntegratedCurve,
51
+ IntegratedGeodesic,
52
+ )
53
+ from sage.manifolds.manifold_homset import TopologicalManifoldHomset
54
+
55
+
56
+ class DifferentiableManifoldHomset(TopologicalManifoldHomset):
57
+ r"""
58
+ Set of differentiable maps between two differentiable manifolds.
59
+
60
+ Given two differentiable manifolds `M` and `N` over a topological field `K`,
61
+ the class :class:`DifferentiableManifoldHomset` implements the set
62
+ `\mathrm{Hom}(M,N)` of morphisms (i.e. differentiable maps)
63
+ `M\rightarrow N`.
64
+
65
+ This is a Sage *parent* class, whose *element* class is
66
+ :class:`~sage.manifolds.differentiable.diff_map.DiffMap`.
67
+
68
+ INPUT:
69
+
70
+ - ``domain`` -- differentiable manifold `M` (domain of the morphisms),
71
+ as an instance of
72
+ :class:`~sage.manifolds.differentiable.manifold.DifferentiableManifold`
73
+ - ``codomain`` -- differentiable manifold `N` (codomain of the morphisms),
74
+ as an instance of
75
+ :class:`~sage.manifolds.differentiable.manifold.DifferentiableManifold`
76
+ - ``name`` -- (default: ``None``) string; name given to the homset; if
77
+ ``None``, Hom(M,N) will be used
78
+ - ``latex_name`` -- (default: ``None``) string; LaTeX symbol to denote the
79
+ homset; if ``None``, `\mathrm{Hom}(M,N)` will be used
80
+
81
+ EXAMPLES:
82
+
83
+ Set of differentiable maps between a 2-dimensional differentiable manifold
84
+ and a 3-dimensional one::
85
+
86
+ sage: M = Manifold(2, 'M')
87
+ sage: X.<x,y> = M.chart()
88
+ sage: N = Manifold(3, 'N')
89
+ sage: Y.<u,v,w> = N.chart()
90
+ sage: H = Hom(M, N) ; H
91
+ Set of Morphisms from 2-dimensional differentiable manifold M to
92
+ 3-dimensional differentiable manifold N in Category of smooth
93
+ manifolds over Real Field with 53 bits of precision
94
+ sage: type(H)
95
+ <class 'sage.manifolds.differentiable.manifold_homset.DifferentiableManifoldHomset_with_category'>
96
+ sage: H.category()
97
+ Category of homsets of topological spaces
98
+ sage: latex(H)
99
+ \mathrm{Hom}\left(M,N\right)
100
+ sage: H.domain()
101
+ 2-dimensional differentiable manifold M
102
+ sage: H.codomain()
103
+ 3-dimensional differentiable manifold N
104
+
105
+ An element of ``H`` is a differentiable map from ``M`` to ``N``::
106
+
107
+ sage: H.Element
108
+ <class 'sage.manifolds.differentiable.diff_map.DiffMap'>
109
+ sage: f = H.an_element() ; f
110
+ Differentiable map from the 2-dimensional differentiable manifold M to the
111
+ 3-dimensional differentiable manifold N
112
+ sage: f.display()
113
+ M → N
114
+ (x, y) ↦ (u, v, w) = (0, 0, 0)
115
+
116
+ The test suite is passed::
117
+
118
+ sage: TestSuite(H).run()
119
+
120
+ When the codomain coincides with the domain, the homset is a set of
121
+ *endomorphisms* in the category of differentiable manifolds::
122
+
123
+ sage: E = Hom(M, M) ; E
124
+ Set of Morphisms from 2-dimensional differentiable manifold M to
125
+ 2-dimensional differentiable manifold M in Category of smooth
126
+ manifolds over Real Field with 53 bits of precision
127
+ sage: E.category()
128
+ Category of endsets of topological spaces
129
+ sage: E.is_endomorphism_set()
130
+ True
131
+ sage: E is End(M)
132
+ True
133
+
134
+ In this case, the homset is a monoid for the law of morphism composition::
135
+
136
+ sage: E in Monoids()
137
+ True
138
+
139
+ This was of course not the case for ``H = Hom(M, N)``::
140
+
141
+ sage: H in Monoids()
142
+ False
143
+
144
+ The identity element of the monoid is of course the identity map of ``M``::
145
+
146
+ sage: E.one()
147
+ Identity map Id_M of the 2-dimensional differentiable manifold M
148
+ sage: E.one() is M.identity_map()
149
+ True
150
+ sage: E.one().display()
151
+ Id_M: M → M
152
+ (x, y) ↦ (x, y)
153
+
154
+ The test suite is passed by ``E``::
155
+
156
+ sage: TestSuite(E).run()
157
+
158
+ This test suite includes more tests than in the case of ``H``, since ``E``
159
+ has some extra structure (monoid).
160
+ """
161
+
162
+ Element = DiffMap
163
+
164
+ def __init__(self, domain, codomain, name=None, latex_name=None):
165
+ r"""
166
+ TESTS::
167
+
168
+ sage: M = Manifold(2, 'M')
169
+ sage: X.<x,y> = M.chart()
170
+ sage: N = Manifold(3, 'N')
171
+ sage: Y.<u,v,w> = N.chart()
172
+ sage: H = Hom(M, N) ; H
173
+ Set of Morphisms from 2-dimensional differentiable manifold M to
174
+ 3-dimensional differentiable manifold N in Category of smooth
175
+ manifolds over Real Field with 53 bits of precision
176
+ sage: TestSuite(H).run()
177
+
178
+ Test for an endomorphism set::
179
+
180
+ sage: E = Hom(M, M) ; E
181
+ Set of Morphisms from 2-dimensional differentiable manifold M to
182
+ 2-dimensional differentiable manifold M in Category of smooth
183
+ manifolds over Real Field with 53 bits of precision
184
+ sage: TestSuite(E).run()
185
+ """
186
+ from sage.manifolds.differentiable.manifold import DifferentiableManifold
187
+ if not isinstance(domain, DifferentiableManifold):
188
+ raise TypeError("domain = {} is not an ".format(domain) +
189
+ "instance of DifferentiableManifold")
190
+ if not isinstance(codomain, DifferentiableManifold):
191
+ raise TypeError("codomain = {} is not an ".format(codomain) +
192
+ "instance of DifferentiableManifold")
193
+ TopologicalManifoldHomset.__init__(self, domain, codomain, name=name,
194
+ latex_name=latex_name)
195
+
196
+ #### Parent methods ####
197
+
198
+ def _coerce_map_from_(self, other):
199
+ r"""
200
+ Determine whether coercion to ``self`` exists from other parent.
201
+
202
+ EXAMPLES::
203
+
204
+ sage: M = Manifold(2, 'M')
205
+ sage: X.<x,y> = M.chart()
206
+ sage: N = Manifold(3, 'N')
207
+ sage: Y.<u,v,w> = N.chart()
208
+ sage: H = Hom(M,N)
209
+ sage: H._coerce_map_from_(ZZ)
210
+ False
211
+ sage: H._coerce_map_from_(M)
212
+ False
213
+ sage: H._coerce_map_from_(N)
214
+ False
215
+ """
216
+ #!# for the time being:
217
+ return False
218
+
219
+ #### End of parent methods ####
220
+
221
+
222
+ #******************************************************************************
223
+
224
+ class DifferentiableCurveSet(DifferentiableManifoldHomset):
225
+ r"""
226
+ Set of differentiable curves in a differentiable manifold.
227
+
228
+ Given an open interval `I` of `\RR` (possibly `I = \RR`) and
229
+ a differentiable manifold `M` over `\RR`, this is the set
230
+ `\mathrm{Hom}(I,M)` of morphisms (i.e. differentiable curves) `I \to M`.
231
+
232
+ INPUT:
233
+
234
+ - ``domain`` --
235
+ :class:`~sage.manifolds.differentiable.examples.real_line.OpenInterval`
236
+ if an open interval `I \subset \RR` (domain of the morphisms),
237
+ or :class:`~sage.manifolds.differentiable.examples.real_line.RealLine`
238
+ if `I = \RR`
239
+ - ``codomain`` --
240
+ :class:`~sage.manifolds.differentiable.manifold.DifferentiableManifold`;
241
+ differentiable manifold `M` (codomain of the morphisms)
242
+ - ``name`` -- (default: ``None``) string; name given to the set of
243
+ curves; if ``None``, ``Hom(I, M)`` will be used
244
+ - ``latex_name`` -- (default: ``None``) string; LaTeX symbol to denote
245
+ the set of curves; if ``None``, `\mathrm{Hom}(I,M)` will be used
246
+
247
+ EXAMPLES:
248
+
249
+ Set of curves `\RR \longrightarrow M`, where `M` is a 2-dimensional
250
+ manifold::
251
+
252
+ sage: M = Manifold(2, 'M')
253
+ sage: X.<x,y> = M.chart()
254
+ sage: R.<t> = manifolds.RealLine() ; R
255
+ Real number line ℝ
256
+ sage: H = Hom(R, M) ; H
257
+ Set of Morphisms from Real number line ℝ to 2-dimensional
258
+ differentiable manifold M in Category of smooth manifolds over Real
259
+ Field with 53 bits of precision
260
+ sage: H.category()
261
+ Category of homsets of topological spaces
262
+ sage: latex(H)
263
+ \mathrm{Hom}\left(\Bold{R},M\right)
264
+ sage: H.domain()
265
+ Real number line ℝ
266
+ sage: H.codomain()
267
+ 2-dimensional differentiable manifold M
268
+
269
+ An element of ``H`` is a curve in ``M``::
270
+
271
+ sage: c = H.an_element(); c
272
+ Curve in the 2-dimensional differentiable manifold M
273
+ sage: c.display()
274
+ ℝ → M
275
+ t ↦ (x, y) = (1/(t^2 + 1) - 1/2, 0)
276
+
277
+ The test suite is passed::
278
+
279
+ sage: TestSuite(H).run()
280
+
281
+ The set of curves `(0,1) \longrightarrow U`, where `U` is an open
282
+ subset of `M`::
283
+
284
+ sage: I = R.open_interval(0, 1) ; I
285
+ Real interval (0, 1)
286
+ sage: U = M.open_subset('U', coord_def={X: x^2+y^2<1}) ; U
287
+ Open subset U of the 2-dimensional differentiable manifold M
288
+ sage: H = Hom(I, U) ; H
289
+ Set of Morphisms from Real interval (0, 1) to Open subset U of the
290
+ 2-dimensional differentiable manifold M in Join of Category of
291
+ subobjects of sets and Category of smooth manifolds over Real Field
292
+ with 53 bits of precision
293
+
294
+ An element of ``H`` is a curve in ``U``::
295
+
296
+ sage: c = H.an_element() ; c
297
+ Curve in the Open subset U of the 2-dimensional differentiable
298
+ manifold M
299
+ sage: c.display()
300
+ (0, 1) → U
301
+ t ↦ (x, y) = (1/(t^2 + 1) - 1/2, 0)
302
+
303
+ The set of curves `\RR \longrightarrow \RR` is a set of (manifold)
304
+ endomorphisms::
305
+
306
+ sage: E = Hom(R, R) ; E
307
+ Set of Morphisms from Real number line ℝ to Real number line ℝ in
308
+ Category of smooth connected manifolds over Real Field with 53 bits of
309
+ precision
310
+ sage: E.category()
311
+ Category of endsets of topological spaces
312
+ sage: E.is_endomorphism_set()
313
+ True
314
+ sage: E is End(R)
315
+ True
316
+
317
+ It is a monoid for the law of morphism composition::
318
+
319
+ sage: E in Monoids()
320
+ True
321
+
322
+ The identity element of the monoid is the identity map of `\RR`::
323
+
324
+ sage: E.one()
325
+ Identity map Id_ℝ of the Real number line ℝ
326
+ sage: E.one() is R.identity_map()
327
+ True
328
+ sage: E.one().display()
329
+ Id_ℝ: ℝ → ℝ
330
+ t ↦ t
331
+
332
+ A "typical" element of the monoid::
333
+
334
+ sage: E.an_element().display()
335
+ ℝ → ℝ
336
+ t ↦ 1/(t^2 + 1) - 1/2
337
+
338
+ The test suite is passed by ``E``::
339
+
340
+ sage: TestSuite(E).run()
341
+
342
+ Similarly, the set of curves `I \longrightarrow I` is a monoid, whose
343
+ elements are (manifold) endomorphisms::
344
+
345
+ sage: EI = Hom(I, I) ; EI
346
+ Set of Morphisms from Real interval (0, 1) to Real interval (0, 1) in
347
+ Join of Category of subobjects of sets and Category of smooth manifolds
348
+ over Real Field with 53 bits of precision and Category of connected
349
+ manifolds over Real Field with 53 bits of precision
350
+ sage: EI.category()
351
+ Category of endsets of subobjects of sets and topological spaces
352
+ sage: EI is End(I)
353
+ True
354
+ sage: EI in Monoids()
355
+ True
356
+
357
+ The identity element and a "typical" element of this monoid::
358
+
359
+ sage: EI.one()
360
+ Identity map Id_(0, 1) of the Real interval (0, 1)
361
+ sage: EI.one().display()
362
+ Id_(0, 1): (0, 1) → (0, 1)
363
+ t ↦ t
364
+ sage: EI.an_element().display()
365
+ (0, 1) → (0, 1)
366
+ t ↦ 1/2/(t^2 + 1) + 1/4
367
+
368
+ The test suite is passed by ``EI``::
369
+
370
+ sage: TestSuite(EI).run()
371
+ """
372
+ Element = DifferentiableCurve
373
+
374
+ def __init__(self, domain, codomain, name=None, latex_name=None):
375
+ r"""
376
+ Initialize ``self``.
377
+
378
+ TESTS::
379
+
380
+ sage: M = Manifold(3, 'M')
381
+ sage: X.<x,y,z> = M.chart()
382
+ sage: R.<t> = manifolds.RealLine()
383
+ sage: H = Hom(R, M); H
384
+ Set of Morphisms from Real number line ℝ to 3-dimensional
385
+ differentiable manifold M in Category of smooth manifolds over
386
+ Real Field with 53 bits of precision
387
+ sage: TestSuite(H).run()
388
+ sage: Hom(R, M) is Hom(R, M)
389
+ True
390
+ sage: H = Hom(R, R); H
391
+ Set of Morphisms from Real number line ℝ to Real number line ℝ in
392
+ Category of smooth connected manifolds over Real Field with 53 bits
393
+ of precision
394
+ sage: TestSuite(H).run()
395
+ sage: I = R.open_interval(-1, 2)
396
+ sage: H = Hom(I, M); H
397
+ Set of Morphisms from Real interval (-1, 2) to 3-dimensional
398
+ differentiable manifold M in Category of smooth manifolds over Real
399
+ Field with 53 bits of precision
400
+ sage: TestSuite(H).run()
401
+ sage: H = Hom(I, I); H
402
+ Set of Morphisms from Real interval (-1, 2) to Real interval (-1, 2)
403
+ in Join of Category of subobjects of sets and Category of smooth
404
+ manifolds over Real Field with 53 bits of precision and Category of
405
+ connected manifolds over Real Field with 53 bits of precision
406
+ sage: TestSuite(H).run()
407
+ """
408
+ from sage.manifolds.differentiable.examples.real_line import OpenInterval
409
+ if not isinstance(domain, OpenInterval):
410
+ raise TypeError("{} is not an open real interval".format(domain))
411
+ DifferentiableManifoldHomset.__init__(self, domain, codomain, name=name,
412
+ latex_name=latex_name)
413
+
414
+ #### Parent methods ####
415
+
416
+ def _element_constructor_(self, coord_expression, name=None,
417
+ latex_name=None, is_isomorphism=False,
418
+ is_identity=False):
419
+ r"""
420
+ Construct an element of ``self``, i.e. a differentiable curve
421
+ `I \to M`, where `I` is a real interval and `M` some
422
+ differentiable manifold.
423
+
424
+ OUTPUT: :class:`~sage.manifolds.differentiable.curve.DifferentiableCurve`
425
+
426
+ EXAMPLES::
427
+
428
+ sage: M = Manifold(2, 'M')
429
+ sage: X.<x,y> = M.chart()
430
+ sage: R.<t> = manifolds.RealLine() ; R
431
+ Real number line ℝ
432
+ sage: H = Hom(R, M)
433
+ sage: c = H({X: [sin(t), sin(2*t)/2]}, name='c') ; c
434
+ Curve c in the 2-dimensional differentiable manifold M
435
+ sage: c = Hom(R, R)({}, is_identity=True) ; c
436
+ Identity map Id_ℝ of the Real number line ℝ
437
+ """
438
+ # Standard construction
439
+ return self.element_class(self, coord_expression=coord_expression,
440
+ name=name, latex_name=latex_name,
441
+ is_isomorphism=is_isomorphism,
442
+ is_identity=is_identity)
443
+
444
+ def _an_element_(self):
445
+ r"""
446
+ Construct some element of ``self``.
447
+
448
+ OUTPUT: :class:`~sage.manifolds.differentiable.curve.DifferentiableCurve`
449
+
450
+ EXAMPLES::
451
+
452
+ sage: M = Manifold(3, 'M')
453
+ sage: X.<x,y,z> = M.chart()
454
+ sage: R.<t> = manifolds.RealLine()
455
+ sage: c = Hom(R,M)._an_element_() ; c
456
+ Curve in the 3-dimensional differentiable manifold M
457
+ sage: c.display()
458
+ ℝ → M
459
+ t ↦ (x, y, z) = (1/(t^2 + 1) - 1/2, 0, 0)
460
+
461
+ ::
462
+
463
+ sage: I = R.open_interval(0, pi)
464
+ sage: c = Hom(I,M)._an_element_() ; c
465
+ Curve in the 3-dimensional differentiable manifold M
466
+ sage: c.display()
467
+ (0, pi) → M
468
+ t ↦ (x, y, z) = (1/(t^2 + 1) - 1/2, 0, 0)
469
+
470
+ ::
471
+
472
+ sage: c = Hom(I,I)._an_element_() ; c
473
+ Differentiable map from the Real interval (0, pi) to itself
474
+ sage: c.display()
475
+ (0, pi) → (0, pi)
476
+ t ↦ 1/4*pi + 1/2*pi/(t^2 + 1)
477
+ """
478
+ from sage.rings.infinity import Infinity
479
+ from sage.rings.rational_field import QQ
480
+ dom = self.domain()
481
+ codom = self.codomain()
482
+ # A simple curve is constructed around a point of the codomain:
483
+ chart2 = codom.default_chart()
484
+ target_point = chart2.domain().an_element()
485
+ target_coord = list(target_point.coord(chart2))
486
+ bounds = chart2._bounds[0] # bounds of first coordinate
487
+ # Determination of an interval (x1, x2) around target_point:
488
+ xmin = bounds[0][0]
489
+ xmax = bounds[1][0]
490
+ one_half = QQ(1) / QQ(2)
491
+ if xmin == -Infinity:
492
+ if xmax == Infinity:
493
+ x1 = - one_half
494
+ x2 = one_half
495
+ else:
496
+ x1 = xmax - 3*one_half
497
+ x2 = xmax - one_half
498
+ else:
499
+ if xmax == Infinity:
500
+ x1 = xmin + one_half
501
+ x2 = xmin + 3*one_half
502
+ else:
503
+ dx = (xmax - xmin) / 4
504
+ x1 = xmin + dx
505
+ x2 = xmax - dx
506
+ # The coordinate function defining the curve:
507
+ t = dom.canonical_coordinate()
508
+ target_coord[0] = x1 + (x2-x1) / (1+t*t)
509
+ coord_expression = {chart2: target_coord}
510
+ return self.element_class(self, coord_expression)
511
+
512
+ #******************************************************************************
513
+
514
+
515
+ class IntegratedCurveSet(DifferentiableCurveSet):
516
+ r"""
517
+ Set of integrated curves in a differentiable manifold.
518
+
519
+ INPUT:
520
+
521
+ - ``domain`` --
522
+ :class:`~sage.manifolds.differentiable.examples.real_line.OpenInterval`
523
+ open interval `I \subset \RR` with finite boundaries (domain of
524
+ the morphisms)
525
+ - ``codomain`` --
526
+ :class:`~sage.manifolds.differentiable.manifold.DifferentiableManifold`;
527
+ differentiable manifold `M` (codomain of the morphisms)
528
+ - ``name`` -- (default: ``None``) string; name given to the set of
529
+ integrated curves; if ``None``, ``Hom_integrated(I, M)`` will be
530
+ used
531
+ - ``latex_name`` -- (default: ``None``) string; LaTeX symbol to
532
+ denote the set of integrated curves; if ``None``,
533
+ `\mathrm{Hom_{integrated}}(I,M)` will be used
534
+
535
+ EXAMPLES:
536
+
537
+ This parent class needs to be imported::
538
+
539
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedCurveSet
540
+
541
+ Integrated curves are only allowed to be defined on an interval with
542
+ finite bounds.
543
+ This forbids to define an instance of this parent class whose domain
544
+ has infinite bounds::
545
+
546
+ sage: M = Manifold(2, 'M')
547
+ sage: X.<x,y> = M.chart()
548
+ sage: R.<t> = manifolds.RealLine()
549
+ sage: H = IntegratedCurveSet(R, M)
550
+ Traceback (most recent call last):
551
+ ...
552
+ ValueError: both boundaries of the interval defining the domain
553
+ of a Homset of integrated curves need to be finite
554
+
555
+ An instance whose domain is an interval with finite bounds allows to
556
+ build an integrated curve defined on the interval::
557
+
558
+ sage: I = R.open_interval(-1, 2)
559
+ sage: H = IntegratedCurveSet(I, M) ; H
560
+ Set of Morphisms from Real interval (-1, 2) to 2-dimensional
561
+ differentiable manifold M in Category of homsets of topological spaces
562
+ which actually are integrated curves
563
+ sage: eqns_rhs = [1,1]
564
+ sage: vels = X.symbolic_velocities()
565
+ sage: t = var('t')
566
+ sage: p = M.point((3,4))
567
+ sage: Tp = M.tangent_space(p)
568
+ sage: v = Tp((1,2))
569
+ sage: c = H(eqns_rhs, vels, t, v, name='c') ; c
570
+ Integrated curve c in the 2-dimensional differentiable
571
+ manifold M
572
+
573
+ A "typical" element of ``H`` is a curve in ``M``::
574
+
575
+ sage: d = H.an_element(); d
576
+ Integrated curve in the 2-dimensional differentiable manifold M
577
+ sage: sys = d.system(verbose=True)
578
+ Curve in the 2-dimensional differentiable manifold M integrated
579
+ over the Real interval (-1, 2) as a solution to the following
580
+ system, written with respect to Chart (M, (x, y)):
581
+ <BLANKLINE>
582
+ Initial point: Point on the 2-dimensional differentiable
583
+ manifold M with coordinates [0, 0] with respect to Chart (M, (x, y))
584
+ Initial tangent vector: Tangent vector at Point on the
585
+ 2-dimensional differentiable manifold M with components
586
+ [1/4, 0] with respect to Chart (M, (x, y))
587
+ <BLANKLINE>
588
+ d(x)/dt = Dx
589
+ d(y)/dt = Dy
590
+ d(Dx)/dt = -1/4*sin(t + 1)
591
+ d(Dy)/dt = 0
592
+ <BLANKLINE>
593
+
594
+ The test suite is passed::
595
+
596
+ sage: TestSuite(H).run()
597
+
598
+ More generally, an instance of this class may be defined with
599
+ abstract bounds `(a,b)`::
600
+
601
+ sage: [a,b] = var('a b')
602
+ sage: J = R.open_interval(a, b)
603
+ sage: H = IntegratedCurveSet(J, M) ; H
604
+ Set of Morphisms from Real interval (a, b) to 2-dimensional
605
+ differentiable manifold M in Category of homsets of topological spaces
606
+ which actually are integrated curves
607
+
608
+ A "typical" element of ``H`` is a curve in ``M``::
609
+
610
+ sage: f = H.an_element(); f
611
+ Integrated curve in the 2-dimensional differentiable manifold M
612
+ sage: sys = f.system(verbose=True)
613
+ Curve in the 2-dimensional differentiable manifold M integrated
614
+ over the Real interval (a, b) as a solution to the following
615
+ system, written with respect to Chart (M, (x, y)):
616
+ <BLANKLINE>
617
+ Initial point: Point on the 2-dimensional differentiable
618
+ manifold M with coordinates [0, 0] with respect to Chart (M, (x, y))
619
+ Initial tangent vector: Tangent vector at Point on the
620
+ 2-dimensional differentiable manifold M with components
621
+ [1/4, 0] with respect to Chart (M, (x, y))
622
+ <BLANKLINE>
623
+ d(x)/dt = Dx
624
+ d(y)/dt = Dy
625
+ d(Dx)/dt = -1/4*sin(-a + t)
626
+ d(Dy)/dt = 0
627
+ <BLANKLINE>
628
+
629
+ Yet, even in the case of abstract bounds, considering any of them to
630
+ be infinite is still prohibited since no numerical integration could
631
+ be performed::
632
+
633
+ sage: f.solve(parameters_values={a:-1, b:+oo})
634
+ Traceback (most recent call last):
635
+ ...
636
+ ValueError: both boundaries of the interval need to be finite
637
+
638
+ The set of integrated curves `J \longrightarrow J` is a set of
639
+ numerical (manifold) endomorphisms::
640
+
641
+ sage: H = IntegratedCurveSet(J, J); H
642
+ Set of Morphisms from Real interval (a, b) to Real interval
643
+ (a, b) in Category of endsets of subobjects of sets and
644
+ topological spaces which actually are integrated curves
645
+ sage: H.category()
646
+ Category of endsets of subobjects of sets and topological spaces
647
+
648
+ It is a monoid for the law of morphism composition::
649
+
650
+ sage: H in Monoids()
651
+ True
652
+
653
+ Although it is a monoid, no identity map is implemented via the
654
+ ``one`` method of this class or any of its subclasses.
655
+ This is justified by the lack of relevance of the identity map
656
+ within the framework of this parent class and its subclasses, whose
657
+ purpose is mainly devoted to numerical issues (therefore, the user
658
+ is left free to set a numerical version of the identity if needed)::
659
+
660
+ sage: H.one()
661
+ Traceback (most recent call last):
662
+ ...
663
+ ValueError: the identity is not implemented for integrated
664
+ curves and associated subclasses
665
+
666
+ A "typical" element of the monoid::
667
+
668
+ sage: g = H.an_element() ; g
669
+ Integrated curve in the Real interval (a, b)
670
+ sage: sys = g.system(verbose=True)
671
+ Curve in the Real interval (a, b) integrated over the Real
672
+ interval (a, b) as a solution to the following system, written
673
+ with respect to Chart ((a, b), (t,)):
674
+ <BLANKLINE>
675
+ Initial point: Point on the Real number line ℝ with coordinates
676
+ [0] with respect to Chart ((a, b), (t,))
677
+ Initial tangent vector: Tangent vector at Point on the Real
678
+ number line ℝ with components [1/4] with respect to
679
+ Chart ((a, b), (t,))
680
+ <BLANKLINE>
681
+ d(t)/ds = Dt
682
+ d(Dt)/ds = -1/4*sin(-a + s)
683
+ <BLANKLINE>
684
+
685
+ The test suite is passed, tests ``_test_one`` and ``_test_prod`` being
686
+ skipped for reasons mentioned above::
687
+
688
+ sage: TestSuite(H).run(skip=["_test_one", "_test_prod"])
689
+ """
690
+
691
+ Element = IntegratedCurve
692
+
693
+ def __init__(self, domain, codomain, name=None, latex_name=None):
694
+ r"""
695
+ Initialize ``self``.
696
+
697
+ TESTS::
698
+
699
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedCurveSet
700
+ sage: M = Manifold(3, 'M')
701
+ sage: X.<x,y,z> = M.chart()
702
+ sage: R.<t> = manifolds.RealLine()
703
+ sage: H = IntegratedCurveSet(R, M)
704
+ Traceback (most recent call last):
705
+ ...
706
+ ValueError: both boundaries of the interval defining the
707
+ domain of a Homset of integrated curves need to be finite
708
+ sage: I = R.open_interval(-1, 2)
709
+ sage: H = IntegratedCurveSet(I, M) ; H
710
+ Set of Morphisms from Real interval (-1, 2) to 3-dimensional
711
+ differentiable manifold M in Category of homsets of topological
712
+ spaces which actually are integrated curves
713
+ sage: TestSuite(H).run()
714
+ sage: H = IntegratedCurveSet(I, I); H
715
+ Set of Morphisms from Real interval (-1, 2) to Real interval
716
+ (-1, 2) in Category of endsets of subobjects of sets and
717
+ topological spaces which actually are integrated curves
718
+ sage: TestSuite(H).run(skip=["_test_one", "_test_prod"])
719
+ """
720
+
721
+ from sage.rings.infinity import Infinity
722
+
723
+ DifferentiableCurveSet.__init__(self, domain, codomain,
724
+ name=name, latex_name=latex_name)
725
+
726
+ # checking argument 'domain': 't_min' and 't_max' are only
727
+ # allowed to be either expressions of finite real values
728
+ t_min = domain.lower_bound()
729
+ t_max = domain.upper_bound()
730
+ if t_min == -Infinity or t_max == +Infinity:
731
+ raise ValueError("both boundaries of the interval " +
732
+ "defining the domain of a Homset of " +
733
+ "integrated curves need to be finite")
734
+
735
+ if name is None:
736
+ self._name = "Hom_integrated({},{})".format(domain._name,
737
+ codomain._name)
738
+ else:
739
+ self._name = name
740
+ if latex_name is None:
741
+ self._latex_name = r"\mathrm{{Hom}_{integrated}}"
742
+ self._latex_name += r"\left({},{}\right)".format(
743
+ domain._latex_name, codomain._latex_name)
744
+ else:
745
+ self._latex_name = latex_name
746
+
747
+ #### Parent methods ####
748
+
749
+ def _repr_(self):
750
+ """
751
+ TESTS::
752
+
753
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedCurveSet
754
+ sage: M = Manifold(3, 'M')
755
+ sage: X.<x,y,z> = M.chart()
756
+ sage: R.<t> = manifolds.RealLine()
757
+ sage: I = R.open_interval(-1, 2)
758
+ sage: H = IntegratedCurveSet(I, M) ; H
759
+ Set of Morphisms from Real interval (-1, 2) to 3-dimensional
760
+ differentiable manifold M in Category of homsets of topological
761
+ spaces which actually are integrated curves
762
+ """
763
+ description = "Set of Morphisms "
764
+ description += "from {} to {} in {} ".format(self._domain,
765
+ self._codomain, self.category())
766
+ description += "which actually are integrated curves"
767
+ return description
768
+
769
+ def _element_constructor_(self, equations_rhs, velocities,
770
+ curve_parameter, initial_tangent_vector, chart=None,
771
+ name=None, latex_name=None, verbose=False, across_charts=False):
772
+ r"""
773
+ Construct an element of ``self``, i.e. an integrated curve
774
+ `I \to M`, where `I` is a real interval and `M` some
775
+ differentiable manifold.
776
+
777
+ OUTPUT: :class:`~sage.manifolds.differentiable.integrated_curve.IntegratedCurve`
778
+
779
+ EXAMPLES::
780
+
781
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedCurveSet
782
+ sage: M = Manifold(2, 'M')
783
+ sage: X.<x,y> = M.chart()
784
+ sage: R.<t> = manifolds.RealLine()
785
+ sage: I = R.open_interval(-1, 2)
786
+ sage: H = IntegratedCurveSet(I, M)
787
+ sage: eqns_rhs = [1,1]
788
+ sage: vels = X.symbolic_velocities()
789
+ sage: t = var('t')
790
+ sage: p = M.point((3,4))
791
+ sage: Tp = M.tangent_space(p)
792
+ sage: v = Tp((1,2))
793
+ sage: c = H(eqns_rhs, vels, t, v, name='c') ; c
794
+ Integrated curve c in the 2-dimensional differentiable
795
+ manifold M
796
+ """
797
+ # Standard construction
798
+ return self.element_class(self, equations_rhs, velocities,
799
+ curve_parameter, initial_tangent_vector, chart=chart,
800
+ name=name, latex_name=latex_name, verbose=verbose, across_charts=across_charts)
801
+
802
+ def _an_element_(self):
803
+ r"""
804
+ Construct some element of ``self``.
805
+
806
+ OUTPUT: :class:`~sage.manifolds.differentiable.integrated_curve.IntegratedCurve`
807
+
808
+ EXAMPLES::
809
+
810
+ sage: # needs scipy
811
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedCurveSet
812
+ sage: M = Manifold(2, 'M')
813
+ sage: X.<x,y> = M.chart()
814
+ sage: R.<t> = manifolds.RealLine()
815
+ sage: I = R.open_interval(-1, 2)
816
+ sage: H = IntegratedCurveSet(I, M)
817
+ sage: c = H._an_element_() ; c
818
+ Integrated curve in the 2-dimensional differentiable
819
+ manifold M
820
+ sage: sys = c.system(verbose=True)
821
+ Curve in the 2-dimensional differentiable manifold M
822
+ integrated over the Real interval (-1, 2) as a solution to
823
+ the following system, written with respect to Chart (M, (x, y)):
824
+ <BLANKLINE>
825
+ Initial point: Point on the 2-dimensional differentiable
826
+ manifold M with coordinates [0, 0] with respect to
827
+ Chart (M, (x, y))
828
+ Initial tangent vector: Tangent vector at Point on the
829
+ 2-dimensional differentiable manifold M with components
830
+ [1/4, 0] with respect to Chart (M, (x, y))
831
+ <BLANKLINE>
832
+ d(x)/dt = Dx
833
+ d(y)/dt = Dy
834
+ d(Dx)/dt = -1/4*sin(t + 1)
835
+ d(Dy)/dt = 0
836
+ <BLANKLINE>
837
+ sage: sol = c.solve()
838
+ sage: interp = c.interpolate()
839
+ sage: p = c(1) ; p
840
+ Point on the 2-dimensional differentiable manifold M
841
+ sage: p.coordinates() # abs tol 1e-12
842
+ (0.2273243562383228, 0.0)
843
+ sage: H = IntegratedCurveSet(I, I)
844
+ sage: c = H._an_element_() ; c
845
+ Integrated curve in the Real interval (-1, 2)
846
+ sage: sys = c.system(verbose=True)
847
+ Curve in the Real interval (-1, 2) integrated over the Real
848
+ interval (-1, 2) as a solution to the following system,
849
+ written with respect to Chart ((-1, 2), (t,)):
850
+ <BLANKLINE>
851
+ Initial point: Point on the Real number line ℝ with
852
+ coordinates [1/2] with respect to Chart ((-1, 2), (t,))
853
+ Initial tangent vector: Tangent vector at Point on the Real
854
+ number line ℝ with components [3/8] with respect to
855
+ Chart ((-1, 2), (t,))
856
+ <BLANKLINE>
857
+ d(t)/ds = Dt
858
+ d(Dt)/ds = -3/8*sin(s + 1)
859
+ sage: sol = c.solve()
860
+ sage: interp = c.interpolate()
861
+ sage: p = c(1) ; p
862
+ Point on the Real number line ℝ
863
+ sage: p.coordinates() # abs tol 1e-12
864
+ (0.8409865343211089,)
865
+ """
866
+
867
+ from sage.categories.homset import Hom
868
+ from sage.functions.trig import sin
869
+ from sage.symbolic.ring import var
870
+
871
+ dom = self.domain()
872
+ t = dom.canonical_coordinate()
873
+ t_min = dom.lower_bound() # this is either an expression or a
874
+ # finite value thanks to tests in '__init__'
875
+
876
+ codom = self.codomain()
877
+ dim = codom.dim()
878
+ chart2 = codom.default_chart()
879
+ # In case the codomain coincides with the domain,
880
+ # it is important to distinguish between the canonical
881
+ # coordinate, and the curve parameter since, in such a
882
+ # situation, the coordinate should not be used to denote the
883
+ # curve parameter, since it actually becomes a function of the
884
+ # curve parameter, and such a function is an unknown of the
885
+ # system defining the curve.
886
+ # In other cases, it might still happen for a coordinate of the
887
+ # codomain to be denoted the same as the canonical coordinate of
888
+ # the domain (for instance, the codomain could be another
889
+ # real interval, different from the domain, and yet with same
890
+ # letter denoting its canonical coordinate).
891
+ # In such case, an error is raised from method 'init'
892
+ # of class IntegratedCurve; to solve it, the user is
893
+ # free to change the name of the codomain coordinate in the
894
+ # chart used on the codomain.
895
+ if dom == codom:
896
+ param = var('s')
897
+ if t == param:
898
+ # the canonical coordinate of the domain
899
+ # might be the expression 's' even though it was affected
900
+ # above to the variable 't'
901
+ param = var('u')
902
+ else:
903
+ param = t
904
+
905
+ # An analytical curve is used to find a region of the codomain
906
+ # where a certain integrated curve may be defined:
907
+ H = Hom(dom, codom)
908
+ c = H.an_element()
909
+ x0_A = c.expr()[0].substitute({t: 1})
910
+ x0_B = c.expr()[0].substitute({t: 0}) # necessarily, x0_A < x0_B
911
+ p_coords = [x0_A] + list(c.expr()[1:dim])
912
+ p = codom.point(p_coords)
913
+
914
+ # The initial tangent vector:
915
+ v_comps = [(x0_B-x0_A)/2] + [0 for i in range(dim-1)]
916
+ v = codom.tangent_space(p)(v_comps)
917
+
918
+ # The equations defining the curve:
919
+ eqns_rhs = [-(x0_B-x0_A)/2*sin(param-t_min)]+[0 for i in range(dim-1)]
920
+ # combined with the initial components above, all velocities
921
+ # vanish, except the first one, which is a cosine function.
922
+ # This differential system results in a curve constant in all
923
+ # its coordinates, except the first one, which oscillates around
924
+ # the value 'x0_A' with an amplitude '(x0_B-x0_A)/2'
925
+
926
+ # The symbolic expressions for the velocities:
927
+ vels = chart2.symbolic_velocities()
928
+
929
+ return self.element_class(self,eqns_rhs,vels,param,v)
930
+
931
+ def one(self):
932
+ r"""
933
+ Raise an error refusing to provide the identity element.
934
+ This overrides the ``one`` method of class
935
+ :class:`~sage.manifolds.manifold_homset.TopologicalManifoldHomset`,
936
+ which would actually raise an error as well, due to lack of option
937
+ ``is_identity`` in ``element_constructor`` method of ``self``.
938
+
939
+ TESTS::
940
+
941
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedCurveSet
942
+ sage: M = Manifold(3, 'M')
943
+ sage: X.<x,y,z> = M.chart()
944
+ sage: R.<t> = manifolds.RealLine()
945
+ sage: I = R.open_interval(-1, 2)
946
+ sage: H = IntegratedCurveSet(I, M)
947
+ sage: H.one()
948
+ Traceback (most recent call last):
949
+ ...
950
+ TypeError: Set of Morphisms from Real interval (-1, 2) to
951
+ 3-dimensional differentiable manifold M in Category of homsets of
952
+ topological spaces which actually are integrated curves is not a
953
+ monoid
954
+ sage: H = IntegratedCurveSet(I, I)
955
+ sage: H.one()
956
+ Traceback (most recent call last):
957
+ ...
958
+ ValueError: the identity is not implemented for integrated
959
+ curves and associated subclasses
960
+ """
961
+
962
+ if self.codomain() != self.domain():
963
+ raise TypeError("{} is not a monoid".format(self))
964
+ else:
965
+ raise ValueError("the identity is not implemented for " +
966
+ "integrated curves and associated " +
967
+ "subclasses")
968
+
969
+ #******************************************************************************
970
+
971
+
972
+ class IntegratedAutoparallelCurveSet(IntegratedCurveSet):
973
+ r"""
974
+ Set of integrated autoparallel curves in a differentiable manifold.
975
+
976
+ INPUT:
977
+
978
+ - ``domain`` --
979
+ :class:`~sage.manifolds.differentiable.examples.real_line.OpenInterval`
980
+ open interval `I \subset \RR` with finite boundaries (domain of
981
+ the morphisms)
982
+ - ``codomain`` --
983
+ :class:`~sage.manifolds.differentiable.manifold.DifferentiableManifold`;
984
+ differentiable manifold `M` (codomain of the morphisms)
985
+ - ``name`` -- (default: ``None``) string; name given to the set of
986
+ integrated autoparallel curves; if ``None``,
987
+ ``Hom_autoparallel(I, M)`` will be used
988
+ - ``latex_name`` -- (default: ``None``) string; LaTeX symbol to denote
989
+ the set of integrated autoparallel curves; if ``None``,
990
+ `\mathrm{Hom_{autoparallel}}(I,M)` will be used
991
+
992
+ EXAMPLES:
993
+
994
+ This parent class needs to be imported::
995
+
996
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedAutoparallelCurveSet
997
+
998
+ Integrated autoparallel curves are only allowed to be defined on an
999
+ interval with finite bounds.
1000
+ This forbids to define an instance of this parent class whose domain
1001
+ has infinite bounds::
1002
+
1003
+ sage: M = Manifold(2, 'M')
1004
+ sage: X.<x,y> = M.chart()
1005
+ sage: R.<t> = manifolds.RealLine()
1006
+ sage: H = IntegratedAutoparallelCurveSet(R, M)
1007
+ Traceback (most recent call last):
1008
+ ...
1009
+ ValueError: both boundaries of the interval defining the domain
1010
+ of a Homset of integrated autoparallel curves need to be finite
1011
+
1012
+ An instance whose domain is an interval with finite bounds allows to
1013
+ build a curve that is autoparallel with respect to a connection
1014
+ defined on the codomain::
1015
+
1016
+ sage: I = R.open_interval(-1, 2)
1017
+ sage: H = IntegratedAutoparallelCurveSet(I, M) ; H
1018
+ Set of Morphisms from Real interval (-1, 2) to 2-dimensional
1019
+ differentiable manifold M in Category of homsets of topological spaces
1020
+ which actually are integrated autoparallel curves with respect to a
1021
+ certain affine connection
1022
+ sage: nab = M.affine_connection('nabla')
1023
+ sage: nab[0,1,0], nab[0,0,1] = 1,2
1024
+ sage: nab.torsion()[:]
1025
+ [[[0, -1], [1, 0]], [[0, 0], [0, 0]]]
1026
+ sage: t = var('t')
1027
+ sage: p = M.point((3,4))
1028
+ sage: Tp = M.tangent_space(p)
1029
+ sage: v = Tp((1,2))
1030
+ sage: c = H(nab, t, v, name='c') ; c
1031
+ Integrated autoparallel curve c in the 2-dimensional
1032
+ differentiable manifold M
1033
+
1034
+ A "typical" element of ``H`` is an autoparallel curve in ``M``::
1035
+
1036
+ sage: d = H.an_element(); d
1037
+ Integrated autoparallel curve in the 2-dimensional
1038
+ differentiable manifold M
1039
+ sage: sys = d.system(verbose=True)
1040
+ Autoparallel curve in the 2-dimensional differentiable manifold
1041
+ M equipped with Affine connection nab on the 2-dimensional
1042
+ differentiable manifold M, and integrated over the Real
1043
+ interval (-1, 2) as a solution to the following equations,
1044
+ written with respect to Chart (M, (x, y)):
1045
+ <BLANKLINE>
1046
+ Initial point: Point on the 2-dimensional differentiable
1047
+ manifold M with coordinates [0, -1/2] with respect to
1048
+ Chart (M, (x, y))
1049
+ Initial tangent vector: Tangent vector at Point on the
1050
+ 2-dimensional differentiable manifold M with components
1051
+ [-1/6/(e^(-1) - 1), 1/3] with respect to Chart (M, (x, y))
1052
+ <BLANKLINE>
1053
+ d(x)/dt = Dx
1054
+ d(y)/dt = Dy
1055
+ d(Dx)/dt = -Dx*Dy
1056
+ d(Dy)/dt = 0
1057
+ <BLANKLINE>
1058
+
1059
+ The test suite is passed::
1060
+
1061
+ sage: TestSuite(H).run()
1062
+
1063
+ For any open interval `J` with finite bounds `(a,b)`, all curves are
1064
+ autoparallel with respect to any connection.
1065
+ Therefore, the set of autoparallel curves `J \longrightarrow J` is a
1066
+ set of numerical (manifold) endomorphisms that is a monoid for the
1067
+ law of morphism composition::
1068
+
1069
+ sage: [a,b] = var('a b')
1070
+ sage: J = R.open_interval(a, b)
1071
+ sage: H = IntegratedAutoparallelCurveSet(J, J); H
1072
+ Set of Morphisms from Real interval (a, b) to Real interval
1073
+ (a, b) in Category of endsets of subobjects of sets and
1074
+ topological spaces which actually are integrated autoparallel
1075
+ curves with respect to a certain affine connection
1076
+ sage: H.category()
1077
+ Category of endsets of subobjects of sets and topological spaces
1078
+ sage: H in Monoids()
1079
+ True
1080
+
1081
+ Although it is a monoid, no identity map is implemented via the
1082
+ ``one`` method of this class or its subclass devoted to geodesics.
1083
+ This is justified by the lack of relevance of the identity map
1084
+ within the framework of this parent class and its subclass, whose
1085
+ purpose is mainly devoted to numerical issues (therefore, the user
1086
+ is left free to set a numerical version of the identity if needed)::
1087
+
1088
+ sage: H.one()
1089
+ Traceback (most recent call last):
1090
+ ...
1091
+ ValueError: the identity is not implemented for integrated
1092
+ curves and associated subclasses
1093
+
1094
+ A "typical" element of the monoid::
1095
+
1096
+ sage: g = H.an_element() ; g
1097
+ Integrated autoparallel curve in the Real interval (a, b)
1098
+ sage: sys = g.system(verbose=True)
1099
+ Autoparallel curve in the Real interval (a, b) equipped with
1100
+ Affine connection nab on the Real interval (a, b), and
1101
+ integrated over the Real interval (a, b) as a solution to the
1102
+ following equations, written with respect to Chart ((a, b), (t,)):
1103
+ <BLANKLINE>
1104
+ Initial point: Point on the Real number line ℝ with coordinates
1105
+ [0] with respect to Chart ((a, b), (t,))
1106
+ Initial tangent vector: Tangent vector at Point on the Real
1107
+ number line ℝ with components
1108
+ [-(e^(1/2) - 1)/(a - b)] with respect to
1109
+ Chart ((a, b), (t,))
1110
+ <BLANKLINE>
1111
+ d(t)/ds = Dt
1112
+ d(Dt)/ds = -Dt^2
1113
+ <BLANKLINE>
1114
+
1115
+ The test suite is passed, tests ``_test_one`` and ``_test_prod`` being
1116
+ skipped for reasons mentioned above::
1117
+
1118
+ sage: TestSuite(H).run(skip=["_test_one", "_test_prod"])
1119
+ """
1120
+
1121
+ Element = IntegratedAutoparallelCurve
1122
+
1123
+ def __init__(self, domain, codomain, name=None, latex_name=None):
1124
+ r"""
1125
+ Initialize ``self``.
1126
+
1127
+ TESTS::
1128
+
1129
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedAutoparallelCurveSet
1130
+ sage: M = Manifold(3, 'M')
1131
+ sage: X.<x,y,z> = M.chart()
1132
+ sage: R.<t> = manifolds.RealLine()
1133
+ sage: H = IntegratedAutoparallelCurveSet(R, M)
1134
+ Traceback (most recent call last):
1135
+ ...
1136
+ ValueError: both boundaries of the interval defining the
1137
+ domain of a Homset of integrated autoparallel curves need
1138
+ to be finite
1139
+ sage: I = R.open_interval(-1, 2)
1140
+ sage: H = IntegratedAutoparallelCurveSet(I, M) ; H
1141
+ Set of Morphisms from Real interval (-1, 2) to 3-dimensional
1142
+ differentiable manifold M in Category of homsets of topological
1143
+ spaces which actually are integrated autoparallel curves with
1144
+ respect to a certain affine connection
1145
+ sage: TestSuite(H).run()
1146
+ sage: H = IntegratedAutoparallelCurveSet(I, I); H
1147
+ Set of Morphisms from Real interval (-1, 2) to Real interval
1148
+ (-1, 2) in Category of endsets of subobjects of sets and
1149
+ topological spaces which actually are integrated
1150
+ autoparallel curves with respect to a certain affine connection
1151
+ sage: TestSuite(H).run(skip=["_test_one", "_test_prod"])
1152
+ """
1153
+
1154
+ from sage.rings.infinity import Infinity
1155
+
1156
+ DifferentiableCurveSet.__init__(self, domain, codomain,
1157
+ name=name, latex_name=latex_name)
1158
+
1159
+ # checking argument 'domain'
1160
+ t_min = domain.lower_bound()
1161
+ t_max = domain.upper_bound()
1162
+ if t_min == -Infinity or t_max == +Infinity:
1163
+ raise ValueError("both boundaries of the interval " +
1164
+ "defining the domain of a Homset of " +
1165
+ "integrated autoparallel curves need to " +
1166
+ "be finite")
1167
+
1168
+ if name is None:
1169
+ self._name = "Hom_autoparallel"
1170
+ self._name += "({},{})".format(domain._name, codomain._name)
1171
+ else:
1172
+ self._name = name
1173
+ if latex_name is None:
1174
+ self._latex_name = r"\mathrm{{Hom}_{autoparallel}}"
1175
+ self._latex_name += r"\left({},{}\right)".format(
1176
+ domain._latex_name, codomain._latex_name)
1177
+ else:
1178
+ self._latex_name = latex_name
1179
+
1180
+ #### Parent methods ####
1181
+
1182
+ def _repr_(self):
1183
+ """
1184
+ TESTS::
1185
+
1186
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedAutoparallelCurveSet
1187
+ sage: M = Manifold(3, 'M')
1188
+ sage: X.<x,y,z> = M.chart()
1189
+ sage: R.<t> = manifolds.RealLine()
1190
+ sage: I = R.open_interval(-1, 2)
1191
+ sage: H = IntegratedAutoparallelCurveSet(I, M) ; H
1192
+ Set of Morphisms from Real interval (-1, 2) to 3-dimensional
1193
+ differentiable manifold M in Category of homsets of topological
1194
+ spaces which actually are integrated autoparallel curves with
1195
+ respect to a certain affine connection
1196
+ """
1197
+
1198
+ description = "Set of Morphisms "
1199
+ description += "from {} to {} in {} ".format(self._domain,
1200
+ self._codomain, self.category())
1201
+ description += "which actually are integrated autoparallel "
1202
+ description += "curves with respect to a certain affine connection"
1203
+ return description
1204
+
1205
+ def _element_constructor_(self, affine_connection, curve_parameter,
1206
+ initial_tangent_vector, chart=None, name=None,
1207
+ latex_name=None, verbose=False, across_charts=False):
1208
+ r"""
1209
+ Construct an element of ``self``, i.e. an integrated
1210
+ autoparallel curve `I \to M`, where `I` is a real interval and
1211
+ `M` some differentiable manifold.
1212
+
1213
+ OUTPUT: :class:`~sage.manifolds.differentiable.integrated_curve.IntegratedAutoparallelCurve`
1214
+
1215
+ EXAMPLES::
1216
+
1217
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedAutoparallelCurveSet
1218
+ sage: M = Manifold(2, 'M')
1219
+ sage: X.<x,y> = M.chart()
1220
+ sage: R.<t> = manifolds.RealLine()
1221
+ sage: I = R.open_interval(-1, 2)
1222
+ sage: H = IntegratedAutoparallelCurveSet(I, M)
1223
+ sage: nab = M.affine_connection('nabla')
1224
+ sage: nab[0,1,0], nab[0,0,1] = 1,2
1225
+ sage: nab.torsion()[:]
1226
+ [[[0, -1], [1, 0]], [[0, 0], [0, 0]]]
1227
+ sage: t = var('t')
1228
+ sage: p = M.point((3,4))
1229
+ sage: Tp = M.tangent_space(p)
1230
+ sage: v = Tp((1,2))
1231
+ sage: c = H(nab, t, v, name='c') ; c
1232
+ Integrated autoparallel curve c in the 2-dimensional
1233
+ differentiable manifold M
1234
+ """
1235
+ # Standard construction
1236
+ return self.element_class(self, affine_connection,
1237
+ curve_parameter, initial_tangent_vector, chart=chart,
1238
+ name=name,latex_name=latex_name, verbose=verbose, across_charts=across_charts)
1239
+
1240
+ def _an_element_(self):
1241
+ r"""
1242
+ Construct some element of ``self``.
1243
+
1244
+ OUTPUT: :class:`~sage.manifolds.differentiable.integrated_curve.IntegratedAutoparallelCurve`
1245
+
1246
+ EXAMPLES::
1247
+
1248
+ sage: # needs scipy
1249
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedAutoparallelCurveSet
1250
+ sage: M = Manifold(2, 'M')
1251
+ sage: X.<x,y> = M.chart()
1252
+ sage: R.<t> = manifolds.RealLine()
1253
+ sage: [a,b] = var('a b')
1254
+ sage: J = R.open_interval(a, b)
1255
+ sage: H = IntegratedAutoparallelCurveSet(J, M)
1256
+ sage: c = H._an_element_() ; c
1257
+ Integrated autoparallel curve in the 2-dimensional
1258
+ differentiable manifold M
1259
+ sage: sys = c.system(verbose=True)
1260
+ Autoparallel curve in the 2-dimensional differentiable
1261
+ manifold M equipped with Affine connection nab on the
1262
+ 2-dimensional differentiable manifold M, and integrated
1263
+ over the Real interval (a, b) as a solution to the
1264
+ following equations, written with respect to Chart (M, (x, y)):
1265
+ <BLANKLINE>
1266
+ Initial point: Point on the 2-dimensional differentiable
1267
+ manifold M with coordinates [0, -1/2]
1268
+ with respect to Chart (M, (x, y))
1269
+ Initial tangent vector: Tangent vector at Point on the
1270
+ 2-dimensional differentiable manifold M with components
1271
+ [1/2/((a - b)*(e^(-1) - 1)), -1/(a - b)] with respect to
1272
+ Chart (M, (x, y))
1273
+ <BLANKLINE>
1274
+ d(x)/dt = Dx
1275
+ d(y)/dt = Dy
1276
+ d(Dx)/dt = -Dx*Dy
1277
+ d(Dy)/dt = 0
1278
+ <BLANKLINE>
1279
+ sage: sol = c.solve(parameters_values={a:0,b:4})
1280
+ sage: interp = c.interpolate()
1281
+ sage: p = c(1) ; p
1282
+ Point on the 2-dimensional differentiable manifold M
1283
+ sage: p.coordinates() # abs tol 1e-12
1284
+ (0.1749660044707089, -0.25)
1285
+ sage: I = R.open_interval(-1, 2)
1286
+ sage: H = IntegratedAutoparallelCurveSet(I, I)
1287
+ sage: c = H._an_element_() ; c
1288
+ Integrated autoparallel curve in the Real interval (-1, 2)
1289
+ sage: sys = c.system(verbose=True)
1290
+ Autoparallel curve in the Real interval (-1, 2) equipped
1291
+ with Affine connection nab on the Real interval (-1, 2),
1292
+ and integrated over the Real interval (-1, 2) as a solution
1293
+ to the following equations, written with respect to
1294
+ Chart ((-1, 2), (t,)):
1295
+ <BLANKLINE>
1296
+ Initial point: Point on the Real number line ℝ with
1297
+ coordinates [1/2] with respect to Chart ((-1, 2), (t,))
1298
+ Initial tangent vector: Tangent vector at Point on the Real
1299
+ number line ℝ with components [1/3*e^(3/4) - 1/3]
1300
+ with respect to Chart ((-1, 2), (t,))
1301
+ <BLANKLINE>
1302
+ d(t)/ds = Dt
1303
+ d(Dt)/ds = -Dt^2
1304
+ <BLANKLINE>
1305
+ sage: sol = c.solve()
1306
+ sage: interp = c.interpolate()
1307
+ sage: p = c(1) ; p
1308
+ Point on the Real number line ℝ
1309
+ sage: p.coordinates() # abs tol 1e-12
1310
+ (1.0565635217644918,)
1311
+ """
1312
+
1313
+ from sage.categories.homset import Hom
1314
+ from sage.functions.log import exp
1315
+ from sage.rings.infinity import Infinity
1316
+ from sage.rings.rational_field import QQ
1317
+ from sage.symbolic.ring import var
1318
+
1319
+ dom = self.domain()
1320
+ t = dom.canonical_coordinate()
1321
+ t_min = dom.lower_bound() # this is either an expression or a
1322
+ # finite value thanks to tests in '__init__'
1323
+ t_max = dom.upper_bound() # idem
1324
+
1325
+ codom = self.codomain()
1326
+ dim = codom.dim()
1327
+ i0 = codom.start_index()
1328
+ chart2 = codom.default_chart()
1329
+ # In case the codomain coincides with the domain,
1330
+ # it is important to distinguish between the canonical
1331
+ # coordinate, and the curve parameter since, in such a
1332
+ # situation, the coordinate should not be used to denote the
1333
+ # curve parameter, since it actually becomes a function of the
1334
+ # curve parameter, and such a function is an unknown of the
1335
+ # system defining the curve.
1336
+ # In other cases, it might still happen for a coordinate of the
1337
+ # codomain to be denoted the same as the canonical coordinate of
1338
+ # the domain (for instance, the codomain could be another
1339
+ # real interval, different from the domain, and yet with same
1340
+ # letter denoting its canonical coordinate).
1341
+ # In such case, an error is raised from method 'init'
1342
+ # of class IntegratedCurve; to solve it, the user is
1343
+ # free to change the name of the codomain coordinate in the
1344
+ # chart used on the codomain.
1345
+ if dom == codom:
1346
+ param = var('s')
1347
+ else:
1348
+ param = t
1349
+
1350
+ # An analytical curve is used to find a region of the codomain
1351
+ # where a certain integrated autoparallel curve may be defined:
1352
+ H = Hom(dom, codom)
1353
+ c = H.an_element()
1354
+ x_A = c.expr()[0].substitute({t:1})
1355
+ x_B = c.expr()[0].substitute({t:0}) # necessarily, x_A < x_B
1356
+
1357
+ if dim == 1:
1358
+ nab = codom.affine_connection('nab')
1359
+ nab.set_coef()[i0,i0,i0] = 1
1360
+
1361
+ # The initial point:
1362
+ p = codom.point([x_A])
1363
+
1364
+ # The initial tangent vector:
1365
+ x_dot_A = (exp(x_B - x_A) - 1)/(t_max - t_min)
1366
+ v = codom.tangent_space(p)([x_dot_A])
1367
+
1368
+ return self.element_class(self, nab, param, v)
1369
+ # the autoparallel curve returned will correspond to the
1370
+ # following analytical solution:
1371
+ # x(t) = ln( x_dot_A*(t-t_min) + 1 ) + x_A, which is such
1372
+ # that x(t_min) = x_A and x(t_max) = x_B due to x_dot_A
1373
+ # set to the value above
1374
+
1375
+ # else: (i.e. dim >= 2)
1376
+
1377
+ nab = codom.affine_connection('nab')
1378
+ nab.set_coef()[i0,i0,i0+1] = 1
1379
+
1380
+ y_bounds = chart2._bounds[1] # bounds of second coordinate
1381
+ # Determination of an interval (y_A, y_B) around target_point:
1382
+ y_min = y_bounds[0][0]
1383
+ y_max = y_bounds[1][0]
1384
+ one_half = QQ(1) / QQ(2)
1385
+ if y_min == -Infinity:
1386
+ if y_max == Infinity:
1387
+ y_A = - one_half
1388
+ y_B = one_half
1389
+ else:
1390
+ y_A = y_max - 3*one_half
1391
+ y_B = y_max - one_half
1392
+ else:
1393
+ if y_max == Infinity:
1394
+ y_A = y_min + one_half
1395
+ y_B = y_min + 3*one_half
1396
+ else:
1397
+ dy = (y_max - y_min) / 4
1398
+ y_A = y_min + dy
1399
+ y_B = y_max - dy
1400
+
1401
+ # The initial point:
1402
+ p_coords = [x_A] + [y_A] + list(c.expr()[2:dim])
1403
+ p = codom.point(p_coords)
1404
+
1405
+ # The initial tangent vector:
1406
+ y_dot_A = (y_B - y_A) / (t_max - t_min)
1407
+ x_dot_A = y_dot_A*(x_B - x_A) / (1-exp(-y_dot_A*(t_max-t_min)))
1408
+ v_comps = [x_dot_A] + [y_dot_A] + [0 for i in range(dim-2)]
1409
+ v = codom.tangent_space(p)(v_comps)
1410
+
1411
+ return self.element_class(self, nab, param, v)
1412
+ # the autoparallel curve returned will correspond to the
1413
+ # following analytical solution:
1414
+ # all coordinates other than the first two coordinates are
1415
+ # constant, and
1416
+ # x(t) = x_dot_A/y_dot_A*(1 - exp(-y_dot_A*(t-t_min))) + x_A
1417
+ # y(t) = y_dot_A*(t-t_min) + y_A
1418
+ # This solution is such that
1419
+ # x(t_min) = x_A and x(t_max) = x_B due to x_dot_A set to the
1420
+ # value above, and
1421
+ # y(t_min) = y_A and y(t_max) = y_B due to y_dot_A set to the
1422
+ # value above
1423
+
1424
+ #******************************************************************************
1425
+
1426
+
1427
+ class IntegratedGeodesicSet(IntegratedAutoparallelCurveSet):
1428
+ r"""
1429
+ Set of integrated geodesic in a differentiable manifold.
1430
+
1431
+ INPUT:
1432
+
1433
+ - ``domain`` --
1434
+ :class:`~sage.manifolds.differentiable.examples.real_line.OpenInterval`
1435
+ open interval `I \subset \RR` with finite boundaries (domain of
1436
+ the morphisms)
1437
+ - ``codomain`` --
1438
+ :class:`~sage.manifolds.differentiable.manifold.DifferentiableManifold`;
1439
+ differentiable manifold `M` (codomain of the morphisms)
1440
+ - ``name`` -- (default: ``None``) string; name given to the set of
1441
+ integrated geodesics; if ``None``, ``Hom_geodesic(I, M)`` will be used
1442
+ - ``latex_name`` -- (default: ``None``) string; LaTeX symbol to denote
1443
+ the set of integrated geodesics; if ``None``,
1444
+ `\mathrm{Hom_{geodesic}}(I,M)` will be used
1445
+
1446
+ EXAMPLES:
1447
+
1448
+ This parent class needs to be imported::
1449
+
1450
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedGeodesicSet
1451
+
1452
+ Integrated geodesics are only allowed to be defined on an interval
1453
+ with finite bounds.
1454
+ This forbids to define an instance of this parent class whose domain
1455
+ has infinite bounds::
1456
+
1457
+ sage: M = Manifold(2, 'M')
1458
+ sage: X.<x,y> = M.chart()
1459
+ sage: R.<t> = manifolds.RealLine()
1460
+ sage: H = IntegratedGeodesicSet(R, M)
1461
+ Traceback (most recent call last):
1462
+ ...
1463
+ ValueError: both boundaries of the interval defining the domain
1464
+ of a Homset of integrated geodesics need to be finite
1465
+
1466
+ An instance whose domain is an interval with finite bounds allows to
1467
+ build a geodesic with respect to a metric defined on the codomain::
1468
+
1469
+ sage: I = R.open_interval(-1, 2)
1470
+ sage: H = IntegratedGeodesicSet(I, M) ; H
1471
+ Set of Morphisms from Real interval (-1, 2) to 2-dimensional
1472
+ differentiable manifold M in Category of homsets of topological spaces
1473
+ which actually are integrated geodesics with respect to a certain
1474
+ metric
1475
+ sage: g = M.metric('g')
1476
+ sage: g[0,0], g[1,1], g[0,1] = 1, 1, 2
1477
+ sage: t = var('t')
1478
+ sage: p = M.point((3,4))
1479
+ sage: Tp = M.tangent_space(p)
1480
+ sage: v = Tp((1,2))
1481
+ sage: c = H(g, t, v, name='c') ; c
1482
+ Integrated geodesic c in the 2-dimensional differentiable
1483
+ manifold M
1484
+
1485
+ A "typical" element of ``H`` is a geodesic in ``M``::
1486
+
1487
+ sage: d = H.an_element(); d
1488
+ Integrated geodesic in the 2-dimensional differentiable
1489
+ manifold M
1490
+ sage: sys = d.system(verbose=True)
1491
+ Geodesic in the 2-dimensional differentiable manifold M equipped
1492
+ with Riemannian metric g on the 2-dimensional differentiable
1493
+ manifold M, and integrated over the Real interval (-1, 2) as a
1494
+ solution to the following geodesic equations, written
1495
+ with respect to Chart (M, (x, y)):
1496
+ <BLANKLINE>
1497
+ Initial point: Point on the 2-dimensional differentiable
1498
+ manifold M with coordinates [0, 0] with respect to
1499
+ Chart (M, (x, y))
1500
+ Initial tangent vector: Tangent vector at Point on the
1501
+ 2-dimensional differentiable manifold M with components
1502
+ [1/3*e^(1/2) - 1/3, 0] with respect to Chart (M, (x, y))
1503
+ <BLANKLINE>
1504
+ d(x)/dt = Dx
1505
+ d(y)/dt = Dy
1506
+ d(Dx)/dt = -Dx^2
1507
+ d(Dy)/dt = 0
1508
+
1509
+ The test suite is passed::
1510
+
1511
+ sage: TestSuite(H).run()
1512
+
1513
+ For any open interval `J` with finite bounds `(a,b)`, all curves are
1514
+ geodesics with respect to any metric.
1515
+ Therefore, the set of geodesics `J \longrightarrow J` is a set of
1516
+ numerical (manifold) endomorphisms that is a monoid for the law of
1517
+ morphism composition::
1518
+
1519
+ sage: [a,b] = var('a b')
1520
+ sage: J = R.open_interval(a, b)
1521
+ sage: H = IntegratedGeodesicSet(J, J); H
1522
+ Set of Morphisms from Real interval (a, b) to Real interval
1523
+ (a, b) in Category of endsets of subobjects of sets and
1524
+ topological spaces which actually are integrated geodesics
1525
+ with respect to a certain metric
1526
+ sage: H.category()
1527
+ Category of endsets of subobjects of sets and topological spaces
1528
+ sage: H in Monoids()
1529
+ True
1530
+
1531
+ Although it is a monoid, no identity map is implemented via the
1532
+ ``one`` method of this class.
1533
+ This is justified by the lack of relevance of the identity map
1534
+ within the framework of this parent class, whose purpose is mainly
1535
+ devoted to numerical issues (therefore, the user is left free to set
1536
+ a numerical version of the identity if needed)::
1537
+
1538
+ sage: H.one()
1539
+ Traceback (most recent call last):
1540
+ ...
1541
+ ValueError: the identity is not implemented for integrated
1542
+ curves and associated subclasses
1543
+
1544
+ A "typical" element of the monoid::
1545
+
1546
+ sage: g = H.an_element() ; g
1547
+ Integrated geodesic in the Real interval (a, b)
1548
+ sage: sys = g.system(verbose=True)
1549
+ Geodesic in the Real interval (a, b) equipped with Riemannian
1550
+ metric g on the Real interval (a, b), and integrated over the
1551
+ Real interval (a, b) as a solution to the following geodesic
1552
+ equations, written with respect to Chart ((a, b), (t,)):
1553
+ <BLANKLINE>
1554
+ Initial point: Point on the Real number line ℝ with coordinates
1555
+ [0] with respect to Chart ((a, b), (t,))
1556
+ Initial tangent vector: Tangent vector at Point on the Real
1557
+ number line ℝ with components [-(e^(1/2) - 1)/(a - b)]
1558
+ with respect to Chart ((a, b), (t,))
1559
+ <BLANKLINE>
1560
+ d(t)/ds = Dt
1561
+ d(Dt)/ds = -Dt^2
1562
+ <BLANKLINE>
1563
+
1564
+ The test suite is passed, tests ``_test_one`` and ``_test_prod`` being
1565
+ skipped for reasons mentioned above::
1566
+
1567
+ sage: TestSuite(H).run(skip=["_test_one", "_test_prod"])
1568
+ """
1569
+
1570
+ Element = IntegratedGeodesic
1571
+
1572
+ def __init__(self, domain, codomain, name=None, latex_name=None):
1573
+ r"""
1574
+ Initialize ``self``.
1575
+
1576
+ TESTS::
1577
+
1578
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedGeodesicSet
1579
+ sage: M = Manifold(3, 'M')
1580
+ sage: X.<x,y,z> = M.chart()
1581
+ sage: R.<t> = manifolds.RealLine()
1582
+ sage: H = IntegratedGeodesicSet(R, M)
1583
+ Traceback (most recent call last):
1584
+ ...
1585
+ ValueError: both boundaries of the interval defining the
1586
+ domain of a Homset of integrated geodesics need to be
1587
+ finite
1588
+ sage: I = R.open_interval(-1, 2)
1589
+ sage: H = IntegratedGeodesicSet(I, M) ; H
1590
+ Set of Morphisms from Real interval (-1, 2) to 3-dimensional
1591
+ differentiable manifold M in Category of homsets of topological
1592
+ spaces which actually are integrated geodesics with respect to a
1593
+ certain metric
1594
+ sage: TestSuite(H).run()
1595
+ sage: H = IntegratedGeodesicSet(I, I); H
1596
+ Set of Morphisms from Real interval (-1, 2) to Real interval
1597
+ (-1, 2) in Category of endsets of subobjects of sets and
1598
+ topological spaces which actually are integrated geodesics
1599
+ with respect to a certain metric
1600
+ sage: TestSuite(H).run(skip=["_test_one", "_test_prod"])
1601
+ """
1602
+
1603
+ from sage.rings.infinity import Infinity
1604
+
1605
+ DifferentiableCurveSet.__init__(self, domain, codomain,
1606
+ name=name, latex_name=latex_name)
1607
+
1608
+ # checking argument 'domain'
1609
+ t_min = domain.lower_bound()
1610
+ t_max = domain.upper_bound()
1611
+ if t_min == -Infinity or t_max == +Infinity:
1612
+ raise ValueError("both boundaries of the interval " +
1613
+ "defining the domain of a Homset of " +
1614
+ "integrated geodesics need to be finite")
1615
+
1616
+ if name is None:
1617
+ self._name = "Hom_geodesic"
1618
+ self._name += "({},{})".format(domain._name, codomain._name)
1619
+ else:
1620
+ self._name = name
1621
+ if latex_name is None:
1622
+ self._latex_name = r"\mathrm{{Hom}_{geodesic}}"
1623
+ self._latex_name += r"\left({},{}\right)".format(
1624
+ domain._latex_name, codomain._latex_name)
1625
+ else:
1626
+ self._latex_name = latex_name
1627
+
1628
+ #### Parent methods ####
1629
+
1630
+ def _repr_(self):
1631
+ """
1632
+ TESTS::
1633
+
1634
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedGeodesicSet
1635
+ sage: M = Manifold(3, 'M')
1636
+ sage: X.<x,y,z> = M.chart()
1637
+ sage: R.<t> = manifolds.RealLine()
1638
+ sage: I = R.open_interval(-1, 2)
1639
+ sage: H = IntegratedGeodesicSet(I, M) ; H
1640
+ Set of Morphisms from Real interval (-1, 2) to 3-dimensional
1641
+ differentiable manifold M in Category of homsets of topological
1642
+ spaces which actually are integrated geodesics with respect to a
1643
+ certain metric
1644
+ """
1645
+ description = "Set of Morphisms "
1646
+ description += "from {} to {} in {} ".format(self._domain,
1647
+ self._codomain, self.category())
1648
+ description += "which actually are integrated geodesics "
1649
+ description += "with respect to a certain metric"
1650
+ return description
1651
+
1652
+ def _element_constructor_(self, metric, curve_parameter,
1653
+ initial_tangent_vector, chart=None, name=None,
1654
+ latex_name=None, verbose=False, across_charts=False):
1655
+ r"""
1656
+ Construct an element of ``self``, i.e. an integrated geodesic
1657
+ `I \to M`, where `I` is a real interval and
1658
+ `M` some differentiable manifold.
1659
+
1660
+ OUTPUT: :class:`~sage.manifolds.differentiable.integrated_curve.IntegratedGeodesic`
1661
+
1662
+ EXAMPLES::
1663
+
1664
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedGeodesicSet
1665
+ sage: M = Manifold(2, 'M')
1666
+ sage: X.<x,y> = M.chart()
1667
+ sage: R.<t> = manifolds.RealLine()
1668
+ sage: I = R.open_interval(-1, 2)
1669
+ sage: H = IntegratedGeodesicSet(I, M)
1670
+ sage: g = M.metric('g')
1671
+ sage: g[0,0], g[1,1], g[0,1] = 1, 1, 2
1672
+ sage: t = var('t')
1673
+ sage: p = M.point((3,4))
1674
+ sage: Tp = M.tangent_space(p)
1675
+ sage: v = Tp((1,2))
1676
+ sage: c = H(g, t, v, name='c') ; c
1677
+ Integrated geodesic c in the 2-dimensional differentiable
1678
+ manifold M
1679
+ """
1680
+ # Standard construction
1681
+ return self.element_class(self, metric, curve_parameter,
1682
+ initial_tangent_vector, chart=chart, name=name,
1683
+ latex_name=latex_name, verbose=verbose, across_charts=across_charts)
1684
+
1685
+ def _an_element_(self):
1686
+ r"""
1687
+ Construct some element of ``self``.
1688
+
1689
+ OUTPUT: :class:`~sage.manifolds.differentiable.integrated_curve.IntegratedGeodesic`
1690
+
1691
+ EXAMPLES::
1692
+
1693
+ sage: # needs scipy
1694
+ sage: from sage.manifolds.differentiable.manifold_homset import IntegratedGeodesicSet
1695
+ sage: M = Manifold(4, 'M', start_index=1)
1696
+ sage: X.<w,x,y,z> = M.chart()
1697
+ sage: R.<t> = manifolds.RealLine()
1698
+ sage: [a,b] = var('a b')
1699
+ sage: J = R.open_interval(a, b)
1700
+ sage: H = IntegratedGeodesicSet(J, M)
1701
+ sage: c = H._an_element_() ; c
1702
+ Integrated geodesic in the 4-dimensional differentiable
1703
+ manifold M
1704
+ sage: sys = c.system(verbose=True)
1705
+ Geodesic in the 4-dimensional differentiable manifold M
1706
+ equipped with Riemannian metric g on the 4-dimensional
1707
+ differentiable manifold M, and integrated over the Real
1708
+ interval (a, b) as a solution to the following geodesic
1709
+ equations, written with respect to Chart (M, (w, x, y, z)):
1710
+ <BLANKLINE>
1711
+ Initial point: Point on the 4-dimensional differentiable
1712
+ manifold M with coordinates [0, 0, 0, 0] with respect to
1713
+ Chart (M, (w, x, y, z))
1714
+ Initial tangent vector: Tangent vector at Point on the
1715
+ 4-dimensional differentiable manifold M with components
1716
+ [-(e^(1/2) - 1)/(a - b), 0, 0, 0] with respect to
1717
+ Chart (M, (w, x, y, z))
1718
+ <BLANKLINE>
1719
+ d(w)/dt = Dw
1720
+ d(x)/dt = Dx
1721
+ d(y)/dt = Dy
1722
+ d(z)/dt = Dz
1723
+ d(Dw)/dt = -Dw^2
1724
+ d(Dx)/dt = 0
1725
+ d(Dy)/dt = 0
1726
+ d(Dz)/dt = 0
1727
+ <BLANKLINE>
1728
+ sage: sol = c.solve(parameters_values={a:1,b:6})
1729
+ sage: interp = c.interpolate()
1730
+ sage: p = c(3) ; p
1731
+ Point on the 4-dimensional differentiable manifold M
1732
+ sage: p.coordinates() # abs tol 1e-12
1733
+ (0.23070569283209164, 0.0, 0.0, 0.0)
1734
+ sage: I = R.open_interval(-1, 2)
1735
+ sage: H = IntegratedGeodesicSet(I, I)
1736
+ sage: c = H._an_element_() ; c
1737
+ Integrated geodesic in the Real interval (-1, 2)
1738
+ sage: sys = c.system(verbose=True)
1739
+ Geodesic in the Real interval (-1, 2) equipped with
1740
+ Riemannian metric g on the Real interval (-1, 2), and
1741
+ integrated over the Real interval (-1, 2) as a solution to
1742
+ the following geodesic equations, written with respect to
1743
+ Chart ((-1, 2), (t,)):
1744
+ <BLANKLINE>
1745
+ Initial point: Point on the Real number line ℝ with
1746
+ coordinates [1/2] with respect to Chart ((-1, 2), (t,))
1747
+ Initial tangent vector: Tangent vector at Point on the Real
1748
+ number line ℝ with components [1/3*e^(3/4) - 1/3]
1749
+ with respect to Chart ((-1, 2), (t,))
1750
+ <BLANKLINE>
1751
+ d(t)/ds = Dt
1752
+ d(Dt)/ds = -Dt^2
1753
+ <BLANKLINE>
1754
+ sage: sol = c.solve()
1755
+ sage: interp = c.interpolate()
1756
+ sage: p = c(1) ; p
1757
+ Point on the Real number line ℝ
1758
+ sage: p.coordinates() # abs tol 1e-12
1759
+ (1.0565635217644918,)
1760
+ """
1761
+
1762
+ from sage.categories.homset import Hom
1763
+ from sage.functions.log import exp
1764
+ from sage.symbolic.ring import var
1765
+
1766
+ dom = self.domain()
1767
+ t = dom.canonical_coordinate()
1768
+ t_min = dom.lower_bound() # this is either an expression or a
1769
+ # finite value thanks to tests in '__init__'
1770
+ t_max = dom.upper_bound() # idem
1771
+
1772
+ codom = self.codomain()
1773
+ dim = codom.dim()
1774
+ i0 = codom.start_index()
1775
+ chart2 = codom.default_chart()
1776
+ x = chart2[:][0]
1777
+ # In case the codomain coincides with the domain,
1778
+ # it is important to distinguish between the canonical
1779
+ # coordinate, and the curve parameter since, in such a
1780
+ # situation, the coordinate should not be used to denote the
1781
+ # curve parameter, since it actually becomes a function of the
1782
+ # curve parameter, and such a function is an unknown of the
1783
+ # system defining the curve.
1784
+ # In other cases, it might still happen for a coordinate of the
1785
+ # codomain to be denoted the same as the canonical coordinate of
1786
+ # the domain (for instance, the codomain could be another
1787
+ # real interval, different from the domain, and yet with same
1788
+ # letter denoting its canonical coordinate).
1789
+ # In such case, an error is raised from method 'init'
1790
+ # of class IntegratedCurve; to solve it, the user is
1791
+ # free to change the name of the codomain coordinate in the
1792
+ # chart used on the codomain.
1793
+ if dom == codom:
1794
+ param = var('s')
1795
+ else:
1796
+ param = t
1797
+
1798
+ # An analytical curve is used to find a region of the codomain
1799
+ # where a certain integrated autoparallel curve may be defined:
1800
+ H = Hom(dom, codom)
1801
+ c = H.an_element()
1802
+ x_A = c.expr()[0].substitute({t:1})
1803
+ x_B = c.expr()[0].substitute({t:0}) # necessarily, x_A < x_B
1804
+
1805
+ g = codom.metric('g')
1806
+ g[i0,i0] = exp(2*x)
1807
+ if dim > 1:
1808
+ for i in range(1,dim):
1809
+ g[i0+i,i0+i] = 1
1810
+
1811
+ # The initial point:
1812
+ p_coords = [x_A] + list(c.expr()[1:dim])
1813
+ p = codom.point(p_coords)
1814
+
1815
+ # The initial tangent vector:
1816
+ x_dot_A = (exp(x_B - x_A) - 1)/(t_max - t_min)
1817
+ v_comps = [x_dot_A] + [0 for i in range(dim-1)]
1818
+ v = codom.tangent_space(p)(v_comps)
1819
+
1820
+ return self.element_class(self, g, param, v)
1821
+ # the geodesic returned will correspond to the following
1822
+ # analytical solution:
1823
+ # all coordinates other than the first one are constant, and
1824
+ # x(t) = ln( x_dot_A*(t-t_min) + 1 ) + x_A, which is such that
1825
+ # x(t_min) = x_A and x(t_max) = x_B due to x_dot_A set to the
1826
+ # value above