passagemath-symbolics 10.6.40__cp314-cp314t-macosx_13_0_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 (172) hide show
  1. passagemath_symbolics/.dylibs/libgmp.10.dylib +0 -0
  2. passagemath_symbolics/__init__.py +3 -0
  3. passagemath_symbolics-10.6.40.dist-info/METADATA +187 -0
  4. passagemath_symbolics-10.6.40.dist-info/RECORD +172 -0
  5. passagemath_symbolics-10.6.40.dist-info/WHEEL +6 -0
  6. passagemath_symbolics-10.6.40.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 +2826 -0
  10. sage/calculus/desolvers.py +1866 -0
  11. sage/calculus/predefined.py +51 -0
  12. sage/calculus/tests.py +225 -0
  13. sage/calculus/var.cpython-314t-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-314t-darwin.so +0 -0
  19. sage/dynamics/complex_dynamics/mandel_julia_helper.pyx +1035 -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 +743 -0
  34. sage/geometry/hyperbolic_space/hyperbolic_constants.py +5 -0
  35. sage/geometry/hyperbolic_space/hyperbolic_geodesic.py +2409 -0
  36. sage/geometry/hyperbolic_space/hyperbolic_interface.py +206 -0
  37. sage/geometry/hyperbolic_space/hyperbolic_isometry.py +1082 -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 +3017 -0
  45. sage/interfaces/magma_free.py +92 -0
  46. sage/interfaces/maple.py +1397 -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 +555 -0
  55. sage/manifolds/catalog.py +437 -0
  56. sage/manifolds/chart.py +4019 -0
  57. sage/manifolds/chart_func.py +3419 -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 +1671 -0
  71. sage/manifolds/differentiable/diff_form.py +1658 -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 +1520 -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 +910 -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 +1728 -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 +2764 -0
  119. sage/manifolds/subsets/all.py +1 -0
  120. sage/manifolds/subsets/closure.py +131 -0
  121. sage/manifolds/subsets/pullback.py +885 -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 +1342 -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-314t-darwin.so +0 -0
  130. sage/matrix/matrix_symbolic_dense.pxd +6 -0
  131. sage/matrix/matrix_symbolic_dense.pyx +1022 -0
  132. sage/matrix/matrix_symbolic_sparse.cpython-314t-darwin.so +0 -0
  133. sage/matrix/matrix_symbolic_sparse.pxd +6 -0
  134. sage/matrix/matrix_symbolic_sparse.pyx +1029 -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 +4153 -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 +5237 -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 +985 -0
  151. sage/symbolic/benchmark.py +93 -0
  152. sage/symbolic/callable.py +459 -0
  153. sage/symbolic/complexity_measures.py +35 -0
  154. sage/symbolic/constants.py +1287 -0
  155. sage/symbolic/expression_conversion_algebraic.py +310 -0
  156. sage/symbolic/expression_conversion_sympy.py +317 -0
  157. sage/symbolic/expression_conversions.py +1713 -0
  158. sage/symbolic/function_factory.py +355 -0
  159. sage/symbolic/integration/all.py +1 -0
  160. sage/symbolic/integration/external.py +270 -0
  161. sage/symbolic/integration/integral.py +1115 -0
  162. sage/symbolic/maxima_wrapper.py +162 -0
  163. sage/symbolic/operators.py +267 -0
  164. sage/symbolic/random_tests.py +462 -0
  165. sage/symbolic/relation.py +1907 -0
  166. sage/symbolic/ring.cpython-314t-darwin.so +0 -0
  167. sage/symbolic/ring.pxd +5 -0
  168. sage/symbolic/ring.pyx +1396 -0
  169. sage/symbolic/subring.py +1025 -0
  170. sage/symbolic/symengine.py +19 -0
  171. sage/symbolic/tests.py +40 -0
  172. sage/symbolic/units.py +1470 -0
@@ -0,0 +1,910 @@
1
+ # sage_setup: distribution = sagemath-symbolics
2
+ r"""
3
+ Symplectic structures
4
+
5
+ The class :class:`SymplecticForm` implements symplectic structures
6
+ on differentiable manifolds over `\RR`. The derived class
7
+ :class:`SymplecticFormParal` is devoted to symplectic forms on a
8
+ parallelizable manifold.
9
+
10
+ AUTHORS:
11
+
12
+ - Tobias Diez (2021) : initial version
13
+
14
+ REFERENCES:
15
+
16
+ - [AM1990]_
17
+ - [RS2012]_
18
+ """
19
+ # *****************************************************************************
20
+ # Distributed under the terms of the GNU General Public License (GPL)
21
+ # as published by the Free Software Foundation; either version 2 of
22
+ # the License, or (at your option) any later version.
23
+ # https://www.gnu.org/licenses/
24
+ # *****************************************************************************
25
+ from __future__ import annotations
26
+
27
+ from typing import Optional, Union
28
+
29
+ from sage.manifolds.differentiable.diff_form import DiffForm, DiffFormParal
30
+ from sage.manifolds.differentiable.diff_map import DiffMap
31
+ from sage.manifolds.differentiable.manifold import DifferentiableManifold
32
+ from sage.manifolds.differentiable.poisson_tensor import PoissonTensorField
33
+ from sage.manifolds.differentiable.scalarfield import DiffScalarField
34
+ from sage.manifolds.differentiable.tensorfield import TensorField
35
+ from sage.manifolds.differentiable.tensorfield_paral import TensorFieldParal
36
+ from sage.manifolds.differentiable.vectorfield import VectorField
37
+ from sage.manifolds.differentiable.vectorfield_module import VectorFieldModule
38
+ from sage.symbolic.expression import Expression
39
+
40
+
41
+ class SymplecticForm(DiffForm):
42
+ r"""
43
+ A symplectic form on a differentiable manifold.
44
+
45
+ An instance of this class is a closed nondegenerate differential `2`-form `\omega`
46
+ on a differentiable manifold `M` over `\RR`.
47
+
48
+ In particular, at each point `m \in M`, `\omega_m` is a bilinear map of the type:
49
+
50
+ .. MATH::
51
+
52
+ \omega_m:\ T_m M \times T_m M \to \RR,
53
+
54
+ where `T_m M` stands for the tangent space to the
55
+ manifold `M` at the point `m`, such that `\omega_m` is skew-symmetric:
56
+ `\forall u,v \in T_m M, \ \omega_m(v,u) = - \omega_m(u,v)`
57
+ and nondegenerate:
58
+ `(\forall v \in T_m M,\ \ \omega_m(u,v) = 0) \Longrightarrow u=0`.
59
+
60
+ .. NOTE::
61
+
62
+ If `M` is parallelizable, the class :class:`SymplecticFormParal`
63
+ should be used instead.
64
+
65
+ INPUT:
66
+
67
+ - ``manifold`` -- module `\mathfrak{X}(M)` of vector fields on the
68
+ manifold `M`, or the manifold `M` itself
69
+ - ``name`` -- (default: ``omega``) name given to the symplectic form
70
+ - ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the
71
+ symplectic form; if ``None``, it is formed from ``name``
72
+
73
+ EXAMPLES:
74
+
75
+ A symplectic form on the 2-sphere::
76
+
77
+ sage: M.<x,y> = manifolds.Sphere(2, coordinates='stereographic')
78
+ sage: stereoN = M.stereographic_coordinates(pole='north')
79
+ sage: stereoS = M.stereographic_coordinates(pole='south')
80
+ sage: omega = M.symplectic_form(name='omega', latex_name=r'\omega')
81
+ sage: omega
82
+ Symplectic form omega on the 2-sphere S^2 of radius 1 smoothly embedded
83
+ in the Euclidean space E^3
84
+
85
+ ``omega`` is initialized by providing its single nonvanishing component
86
+ w.r.t. the vector frame associated to ``stereoN``, which is the default
87
+ frame on ``M``::
88
+
89
+ sage: omega[1, 2] = 1/(1 + x^2 + y^2)^2
90
+
91
+ The components w.r.t. the vector frame associated to ``stereoS`` are
92
+ obtained thanks to the method
93
+ :meth:`~sage.manifolds.differentiable.tensorfield.TensorField.add_comp_by_continuation`::
94
+
95
+ sage: omega.add_comp_by_continuation(stereoS.frame(),
96
+ ....: stereoS.domain().intersection(stereoN.domain()))
97
+ sage: omega.display()
98
+ omega = (x^2 + y^2 + 1)^(-2) dx∧dy
99
+ sage: omega.display(stereoS)
100
+ omega = -1/(xp^4 + yp^4 + 2*(xp^2 + 1)*yp^2 + 2*xp^2 + 1) dxp∧dyp
101
+
102
+ ``omega`` is an exact 2-form (this is trivial here, since ``M`` is
103
+ 2-dimensional)::
104
+
105
+ sage: diff(omega).display()
106
+ domega = 0
107
+ """
108
+
109
+ _name: str
110
+ _latex_name: str
111
+ _dim_half: int
112
+ _poisson: Optional[PoissonTensorField]
113
+ _vol_form: Optional[DiffForm]
114
+ _restrictions: dict[DifferentiableManifold, SymplecticForm]
115
+
116
+ def __init__(
117
+ self,
118
+ manifold: Union[DifferentiableManifold, VectorFieldModule],
119
+ name: Optional[str] = None,
120
+ latex_name: Optional[str] = None,
121
+ ):
122
+ r"""
123
+ Construct a symplectic form.
124
+
125
+ TESTS::
126
+
127
+ sage: from sage.manifolds.differentiable.symplectic_form import SymplecticForm
128
+ sage: M = manifolds.Sphere(2, coordinates='stereographic')
129
+ sage: omega = SymplecticForm(M, name='omega', latex_name=r'\omega')
130
+ sage: omega
131
+ Symplectic form omega on the 2-sphere S^2 of radius 1 smoothly
132
+ embedded in the Euclidean space E^3
133
+ """
134
+ try:
135
+ vector_field_module = manifold.vector_field_module()
136
+ except AttributeError:
137
+ vector_field_module = manifold
138
+
139
+ if name is None:
140
+ name = "omega"
141
+ if latex_name is None:
142
+ latex_name = r"\omega"
143
+
144
+ if latex_name is None:
145
+ latex_name = name
146
+
147
+ DiffForm.__init__(
148
+ self, vector_field_module, 2, name=name, latex_name=latex_name
149
+ )
150
+
151
+ # Check that manifold is even dimensional
152
+ dim = self._ambient_domain.dimension()
153
+ if dim % 2 == 1:
154
+ raise ValueError(
155
+ f"the dimension of the manifold must be even but it is {dim}"
156
+ )
157
+ self._dim_half = dim // 2
158
+
159
+ # Initialization of derived quantities
160
+ SymplecticForm._init_derived(self)
161
+
162
+ def _repr_(self):
163
+ r"""
164
+ String representation of the object.
165
+
166
+ TESTS::
167
+
168
+ sage: M.<q, p> = EuclideanSpace(2)
169
+ sage: omega = M.symplectic_form('omega', r'\omega'); omega
170
+ Symplectic form omega on the Euclidean plane E^2
171
+ """
172
+ return self._final_repr(f"Symplectic form {self._name} ")
173
+
174
+ def _new_instance(self):
175
+ r"""
176
+ Create an instance of the same class as ``self``.
177
+
178
+ TESTS::
179
+
180
+ sage: M.<q, p> = EuclideanSpace(2)
181
+ sage: omega = M.symplectic_form('omega', r'\omega')._new_instance(); omega
182
+ Symplectic form unnamed symplectic form on the Euclidean plane E^2
183
+ """
184
+ return type(self)(
185
+ self._vmodule,
186
+ "unnamed symplectic form",
187
+ latex_name=r"\text{unnamed symplectic form}",
188
+ )
189
+
190
+ def _init_derived(self):
191
+ r"""
192
+ Initialize the derived quantities.
193
+
194
+ TESTS::
195
+
196
+ sage: M.<q, p> = EuclideanSpace(2)
197
+ sage: omega = M.symplectic_form('omega', r'\omega')._init_derived()
198
+ """
199
+ # Initialization of quantities pertaining to the mother class
200
+ DiffForm._init_derived(self)
201
+
202
+ self._poisson = None
203
+ self._vol_form = None
204
+
205
+ def _del_derived(self):
206
+ r"""
207
+ Delete the derived quantities.
208
+
209
+ TESTS::
210
+
211
+ sage: M.<q, p> = EuclideanSpace(2)
212
+ sage: omega = M.symplectic_form('omega', r'\omega')._del_derived()
213
+ """
214
+ # Delete the derived quantities from the mother class
215
+ DiffForm._del_derived(self)
216
+
217
+ # Clear the Poisson tensor
218
+ if self._poisson is not None:
219
+ self._poisson._restrictions.clear()
220
+ self._poisson._del_derived()
221
+ self._poisson = None
222
+
223
+ # Delete the volume form
224
+ if self._vol_form is not None:
225
+ self._vol_form._restrictions.clear()
226
+ self._vol_form._del_derived()
227
+ self._vol_form = None
228
+
229
+ def restrict(
230
+ self, subdomain: DifferentiableManifold, dest_map: Optional[DiffMap] = None
231
+ ) -> DiffForm:
232
+ r"""
233
+ Return the restriction of the symplectic form to some subdomain.
234
+
235
+ If the restriction has not been defined yet, it is constructed here.
236
+
237
+ INPUT:
238
+
239
+ - ``subdomain`` -- open subset `U` of the symplectic form's domain
240
+ - ``dest_map`` -- (default: ``None``) smooth destination map
241
+ `\Phi:\ U \to V`, where `V` is a subdomain of the symplectic form's domain
242
+ If ``None``, the restriction of the initial vector field module is used.
243
+
244
+ OUTPUT: the restricted symplectic form
245
+
246
+ EXAMPLES::
247
+
248
+ sage: M = Manifold(6, 'M')
249
+ sage: omega = M.symplectic_form()
250
+ sage: U = M.open_subset('U')
251
+ sage: omega.restrict(U)
252
+ 2-form omega on the Open subset U of the 6-dimensional differentiable manifold M
253
+ """
254
+ if subdomain == self._domain:
255
+ return self
256
+
257
+ if subdomain not in self._restrictions:
258
+ # Construct the restriction at the tensor field level
259
+ restriction = DiffForm.restrict(self, subdomain, dest_map=dest_map)
260
+
261
+ # Restrictions of derived quantities
262
+ if self._poisson is not None:
263
+ restriction._poisson = self._poisson.restrict(subdomain)
264
+ if self._vol_form is not None:
265
+ restriction._vol_form = self._vol_form.restrict(subdomain)
266
+
267
+ # The restriction is ready
268
+ self._restrictions[subdomain] = restriction
269
+ return restriction
270
+ else:
271
+ return self._restrictions[subdomain]
272
+
273
+ @staticmethod
274
+ def wrap(
275
+ form: DiffForm, name: Optional[str] = None, latex_name: Optional[str] = None
276
+ ) -> SymplecticForm:
277
+ r"""
278
+ Define the symplectic form from a differential form.
279
+
280
+ INPUT:
281
+
282
+ - ``form`` -- differential `2`-form
283
+
284
+ EXAMPLES:
285
+
286
+ Volume form on the sphere as a symplectic form::
287
+
288
+ sage: from sage.manifolds.differentiable.symplectic_form import SymplecticForm
289
+ sage: M = manifolds.Sphere(2, coordinates='stereographic')
290
+ sage: vol_form = M.induced_metric().volume_form() # long time
291
+ sage: omega = SymplecticForm.wrap(vol_form, 'omega', r'\omega') # long time
292
+ sage: omega.display() # long time
293
+ omega = -4/(y1^4 + y2^4 + 2*(y1^2 + 1)*y2^2 + 2*y1^2 + 1) dy1∧dy2
294
+ """
295
+ if form.degree() != 2:
296
+ raise TypeError("the argument must be a form of degree 2")
297
+
298
+ if name is None:
299
+ name = form._name
300
+ if latex_name is None:
301
+ latex_name = form._latex_name
302
+
303
+ symplectic_form = form.base_module().symplectic_form(name, latex_name)
304
+
305
+ for dom, rst in form._restrictions.items():
306
+ symplectic_form._restrictions[dom] = SymplecticForm.wrap(
307
+ rst, name, latex_name
308
+ )
309
+
310
+ if isinstance(form, DiffFormParal):
311
+ for frame in form._components:
312
+ symplectic_form._components[frame] = form._components[frame].copy()
313
+
314
+ return symplectic_form
315
+
316
+ def poisson(
317
+ self, expansion_symbol: Optional[Expression] = None, order: int = 1
318
+ ) -> PoissonTensorField:
319
+ r"""
320
+ Return the Poisson tensor associated with the symplectic form.
321
+
322
+ INPUT:
323
+
324
+ - ``expansion_symbol`` -- (default: ``None``) symbolic variable; if
325
+ specified, the inverse will be expanded in power series with respect
326
+ to this variable (around its zero value)
327
+ - ``order`` -- integer (default: 1); the order of the expansion
328
+ if ``expansion_symbol`` is not ``None``; the *order* is defined as
329
+ the degree of the polynomial representing the truncated power series
330
+ in ``expansion_symbol``; currently only first order inverse is
331
+ supported
332
+
333
+ If ``expansion_symbol`` is set, then the zeroth order symplectic form must be
334
+ invertible. Moreover, subsequent calls to this method will return
335
+ a cached value, even when called with the default value (to enable
336
+ computation of derived quantities). To reset, use :meth:`_del_derived`.
337
+
338
+ OUTPUT:
339
+
340
+ - the Poisson tensor, as an instance of
341
+ :meth:`~sage.manifolds.differentiable.poisson_tensor.PoissonTensorField`
342
+
343
+ EXAMPLES:
344
+
345
+ Poisson tensor of `2`-dimensional symplectic vector space::
346
+
347
+ sage: M = manifolds.StandardSymplecticSpace(2)
348
+ sage: omega = M.symplectic_form()
349
+ sage: poisson = omega.poisson(); poisson
350
+ 2-vector field poisson_omega on the Standard symplectic space R2
351
+ sage: poisson.display()
352
+ poisson_omega = -e_q∧e_p
353
+ """
354
+ if self._poisson is None:
355
+ # Initialize the Poisson tensor
356
+ poisson_name = f"poisson_{self._name}"
357
+ poisson_latex_name = f"{self._latex_name}^{{-1}}"
358
+ self._poisson = self._vmodule.poisson_tensor(
359
+ poisson_name, poisson_latex_name
360
+ )
361
+
362
+ # Update the Poisson tensor
363
+ # TODO: Should this be done instead when a new restriction is added?
364
+ for domain, restriction in self._restrictions.items():
365
+ # Forces the update of the restriction
366
+ self._poisson._restrictions[domain] = restriction.poisson(
367
+ expansion_symbol=expansion_symbol, order=order
368
+ )
369
+ return self._poisson
370
+
371
+ def hamiltonian_vector_field(self, function: DiffScalarField) -> VectorField:
372
+ r"""
373
+ The Hamiltonian vector field `X_f` generated by a function `f: M \to \RR`.
374
+
375
+ The Hamiltonian vector field is defined by
376
+
377
+ .. MATH::
378
+
379
+ X_f \lrcorner \omega + df = 0.
380
+
381
+ INPUT:
382
+
383
+ - ``function`` -- the function generating the Hamiltonian vector field
384
+
385
+ EXAMPLES::
386
+
387
+ sage: M = manifolds.StandardSymplecticSpace(2)
388
+ sage: omega = M.symplectic_form()
389
+ sage: f = M.scalar_field({ chart: function('f')(*chart[:]) for chart in M.atlas() }, name='f')
390
+ sage: f.display()
391
+ f: R2 → ℝ
392
+ (q, p) ↦ f(q, p)
393
+ sage: Xf = omega.hamiltonian_vector_field(f)
394
+ sage: Xf.display()
395
+ Xf = d(f)/dp e_q - d(f)/dq e_p
396
+ """
397
+ return self.poisson().hamiltonian_vector_field(function)
398
+
399
+ def flat(self, vector_field: VectorField) -> DiffForm:
400
+ r"""
401
+ Return the image of the given differential form under the
402
+ map `\omega^\flat: T M \to T^*M` defined by
403
+
404
+ .. MATH::
405
+
406
+ <\omega^\flat(X), Y> = \omega_m (X, Y)
407
+
408
+ for all `X, Y \in T_m M`.
409
+
410
+ In indices, `X_i = \omega_{ji} X^j`.
411
+
412
+ INPUT:
413
+
414
+ - ``vector_field`` -- the vector field to calculate its flat of
415
+
416
+ EXAMPLES::
417
+
418
+ sage: M = manifolds.StandardSymplecticSpace(2)
419
+ sage: omega = M.symplectic_form()
420
+ sage: X = M.vector_field_module().an_element()
421
+ sage: X.set_name('X')
422
+ sage: X.display()
423
+ X = 2 e_q + 2 e_p
424
+ sage: omega.flat(X).display()
425
+ X_flat = 2 dq - 2 dp
426
+ """
427
+ form = vector_field.down(self)
428
+ form.set_name(
429
+ vector_field._name + "_flat", vector_field._latex_name + "^\\flat"
430
+ )
431
+ return form
432
+
433
+ def sharp(self, form: DiffForm) -> VectorField:
434
+ r"""
435
+ Return the image of the given differential form under the map
436
+ `\omega^\sharp: T^* M \to TM` defined by
437
+
438
+ .. MATH::
439
+
440
+ \omega (\omega^\sharp(\alpha), X) = \alpha(X)
441
+
442
+ for all `X \in T_m M` and `\alpha \in T^*_m M`.
443
+ The sharp map is inverse to the flat map.
444
+
445
+ In indices, `\alpha^i = \varpi^{ij} \alpha_j`, where `\varpi` is
446
+ the Poisson tensor associated with the symplectic form.
447
+
448
+ INPUT:
449
+
450
+ - ``form`` -- the differential form to calculate its sharp of
451
+
452
+ EXAMPLES::
453
+
454
+ sage: M = manifolds.StandardSymplecticSpace(2)
455
+ sage: omega = M.symplectic_form()
456
+ sage: X = M.vector_field_module().an_element()
457
+ sage: alpha = omega.flat(X)
458
+ sage: alpha.set_name('alpha')
459
+ sage: alpha.display()
460
+ alpha = 2 dq - 2 dp
461
+ sage: omega.sharp(alpha).display()
462
+ alpha_sharp = 2 e_q + 2 e_p
463
+ """
464
+ return self.poisson().sharp(form)
465
+
466
+ def poisson_bracket(
467
+ self, f: DiffScalarField, g: DiffScalarField
468
+ ) -> DiffScalarField:
469
+ r"""
470
+ Return the Poisson bracket
471
+
472
+ .. MATH::
473
+
474
+ \{f, g\} = \omega(X_f, X_g)
475
+
476
+ of the given functions.
477
+
478
+ INPUT:
479
+
480
+ - ``f`` -- function inserted in the first slot
481
+ - ``g`` -- function inserted in the second slot
482
+
483
+ EXAMPLES::
484
+
485
+ sage: M.<q, p> = EuclideanSpace(2)
486
+ sage: poisson = M.poisson_tensor('varpi')
487
+ sage: poisson.set_comp()[1,2] = -1
488
+ sage: f = M.scalar_field({ chart: function('f')(*chart[:]) for chart in M.atlas() }, name='f')
489
+ sage: g = M.scalar_field({ chart: function('g')(*chart[:]) for chart in M.atlas() }, name='g')
490
+ sage: poisson.poisson_bracket(f, g).display()
491
+ poisson(f, g): E^2 → ℝ
492
+ (q, p) ↦ d(f)/dp*d(g)/dq - d(f)/dq*d(g)/dp
493
+ """
494
+ return self.poisson().poisson_bracket(f, g)
495
+
496
+ def volume_form(self, contra: int = 0) -> TensorField:
497
+ r"""
498
+ Liouville volume form `\frac{1}{n!}\omega^n` associated with the
499
+ symplectic form `\omega`, where `2n` is the dimension of the manifold.
500
+
501
+ INPUT:
502
+
503
+ - ``contra`` -- (default: 0) number of contravariant indices of the
504
+ returned tensor
505
+
506
+ OUTPUT:
507
+
508
+ - if ``contra = 0``: volume form associated with the symplectic form
509
+ - if ``contra = k``, with `1\leq k \leq n`, the tensor field of type
510
+ (k,n-k) formed from `\epsilon` by raising the first k indices with
511
+ the symplectic form (see method
512
+ :meth:`~sage.manifolds.differentiable.tensorfield.TensorField.up`)
513
+
514
+ EXAMPLES:
515
+
516
+ Volume form on `\RR^4`::
517
+
518
+ sage: M = manifolds.StandardSymplecticSpace(4)
519
+ sage: omega = M.symplectic_form()
520
+ sage: vol = omega.volume_form() ; vol
521
+ 4-form mu_omega on the Standard symplectic space R4
522
+ sage: vol.display()
523
+ mu_omega = dq1∧dp1∧dq2∧dp2
524
+ """
525
+ if self._vol_form is None:
526
+ from sage.functions.other import factorial
527
+
528
+ vol_form = self
529
+ for _ in range(1, self._dim_half):
530
+ vol_form = vol_form.wedge(self)
531
+ vol_form = vol_form / factorial(self._dim_half)
532
+
533
+ volume_name = f"mu_{self._name}"
534
+ volume_latex_name = f"\\mu_{self._latex_name}"
535
+ vol_form.set_name(volume_name, volume_latex_name)
536
+ self._vol_form = vol_form
537
+
538
+ result = self._vol_form
539
+ for k in range(0, contra):
540
+ result = result.up(self, k)
541
+ if contra > 1:
542
+ # restoring the antisymmetry after the up operation:
543
+ result = result.antisymmetrize(*range(contra))
544
+ return result
545
+
546
+ def hodge_star(self, pform: DiffForm) -> DiffForm:
547
+ r"""
548
+ Compute the Hodge dual of a differential form with respect to the
549
+ symplectic form.
550
+
551
+ See :meth:`~sage.manifolds.differentiable.diff_form.DiffForm.hodge_dual`
552
+ for the definition and more details.
553
+
554
+ INPUT:
555
+
556
+ - ``pform`` -- a `p`-form `A`; must be an instance of
557
+ :class:`~sage.manifolds.differentiable.scalarfield.DiffScalarField`
558
+ for `p=0` and of
559
+ :class:`~sage.manifolds.differentiable.diff_form.DiffForm` or
560
+ :class:`~sage.manifolds.differentiable.diff_form.DiffFormParal`
561
+ for `p\geq 1`.
562
+
563
+ OUTPUT:
564
+
565
+ - the `(n-p)`-form `*A`
566
+
567
+ EXAMPLES:
568
+
569
+ Hodge dual of any form on the symplectic vector space `R^2`::
570
+
571
+ sage: M = manifolds.StandardSymplecticSpace(2)
572
+ sage: omega = M.symplectic_form()
573
+ sage: a = M.one_form(1, 0, name='a')
574
+ sage: omega.hodge_star(a).display()
575
+ *a = dq
576
+ sage: b = M.one_form(0, 1, name='b')
577
+ sage: omega.hodge_star(b).display()
578
+ *b = dp
579
+ sage: f = M.scalar_field(1, name='f')
580
+ sage: omega.hodge_star(f).display()
581
+ *f = -dq∧dp
582
+ sage: omega.hodge_star(omega).display()
583
+ *omega: R2 → ℝ
584
+ (q, p) ↦ 1
585
+ """
586
+ return pform.hodge_dual(self)
587
+
588
+ def on_forms(self, first: DiffForm, second: DiffForm) -> DiffScalarField:
589
+ r"""
590
+ Return the contraction of the two forms with respect to the symplectic form.
591
+
592
+ The symplectic form `\omega` gives rise to a bilinear form,
593
+ also denoted by `\omega` on the space of `1`-forms by
594
+
595
+ .. MATH::
596
+ \omega(\alpha, \beta) = \omega(\alpha^\sharp, \beta^\sharp),
597
+
598
+ where `\alpha^\sharp` is the dual of `\alpha` with respect to `\omega`, see
599
+ :meth:`~sage.manifolds.differentiable.tensor_field.TensorField.up`.
600
+ This bilinear form induces a bilinear form on the space of all forms determined
601
+ by its value on decomposable elements as:
602
+
603
+ .. MATH::
604
+ \omega(\alpha_1 \wedge \ldots \wedge\alpha_p, \beta_1 \wedge \ldots \wedge\beta_p)
605
+ = det(\omega(\alpha_i, \beta_j)).
606
+
607
+ INPUT:
608
+
609
+ - ``first`` -- a `p`-form `\alpha`
610
+ - ``second`` -- a `p`-form `\beta`
611
+
612
+ OUTPUT:
613
+
614
+ - the scalar field `\omega(\alpha, \beta)`
615
+
616
+ EXAMPLES:
617
+
618
+ sage: M = manifolds.StandardSymplecticSpace(2)
619
+ sage: omega = M.symplectic_form()
620
+ sage: a = M.one_form(1, 0, name='a')
621
+ sage: b = M.one_form(0, 1, name='b')
622
+ sage: omega.on_forms(a, b).display()
623
+ R2 → ℝ
624
+ (q, p) ↦ -1
625
+ """
626
+ from sage.arith.misc import factorial
627
+
628
+ if first.degree() != second.degree():
629
+ raise ValueError("the two forms must have the same degree")
630
+
631
+ all_positions = range(first.degree())
632
+ return first.contract(
633
+ *all_positions, second.up(self), *all_positions
634
+ ) / factorial(first.degree())
635
+
636
+
637
+ class SymplecticFormParal(SymplecticForm, DiffFormParal):
638
+ r"""
639
+ A symplectic form on a parallelizable manifold.
640
+
641
+ .. NOTE::
642
+
643
+ If `M` is not parallelizable, the class :class:`SymplecticForm`
644
+ should be used instead.
645
+
646
+ INPUT:
647
+
648
+ - ``manifold`` -- module `\mathfrak{X}(M)` of vector fields on the
649
+ manifold `M`, or the manifold `M` itself
650
+ - ``name`` -- (default: ``omega``) name given to the symplectic form
651
+ - ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the
652
+ symplectic form; if ``None``, it is formed from ``name``
653
+
654
+ EXAMPLES:
655
+
656
+ Standard symplectic form on `\RR^2`::
657
+
658
+ sage: M.<q, p> = EuclideanSpace(name='R2', latex_name=r"\mathbb{R}^2")
659
+ sage: omega = M.symplectic_form(name='omega', latex_name=r'\omega')
660
+ sage: omega
661
+ Symplectic form omega on the Euclidean plane R2
662
+ sage: omega.set_comp()[1,2] = -1
663
+ sage: omega.display()
664
+ omega = -dq∧dp
665
+ """
666
+ _poisson: TensorFieldParal
667
+
668
+ def __init__(
669
+ self,
670
+ manifold: Union[VectorFieldModule, DifferentiableManifold],
671
+ name: Optional[str],
672
+ latex_name: Optional[str] = None,
673
+ ):
674
+ r"""
675
+ Construct a symplectic form.
676
+
677
+ TESTS::
678
+
679
+ sage: from sage.manifolds.differentiable.symplectic_form import SymplecticFormParal
680
+ sage: M = EuclideanSpace(2)
681
+ sage: omega = SymplecticFormParal(M, name='omega', latex_name=r'\omega')
682
+ sage: omega
683
+ Symplectic form omega on the Euclidean plane E^2
684
+ """
685
+ try:
686
+ vector_field_module = manifold.vector_field_module()
687
+ except AttributeError:
688
+ vector_field_module = manifold
689
+
690
+ if name is None:
691
+ name = "omega"
692
+
693
+ DiffFormParal.__init__(
694
+ self, vector_field_module, 2, name=name, latex_name=latex_name
695
+ )
696
+
697
+ # Check that manifold is even dimensional
698
+ dim = self._ambient_domain.dimension()
699
+ if dim % 2 == 1:
700
+ raise ValueError(
701
+ f"the dimension of the manifold must be even but it is {dim}"
702
+ )
703
+ self._dim_half = dim // 2
704
+
705
+ # Initialization of derived quantities
706
+ SymplecticFormParal._init_derived(self)
707
+
708
+ def _init_derived(self):
709
+ r"""
710
+ Initialize the derived quantities.
711
+
712
+ TESTS::
713
+
714
+ sage: from sage.manifolds.differentiable.symplectic_form import SymplecticFormParal
715
+ sage: M = EuclideanSpace(2)
716
+ sage: omega = SymplecticFormParal(M, 'omega', r'\omega')
717
+ sage: omega._init_derived()
718
+ """
719
+ # Initialization of quantities pertaining to mother classes
720
+ DiffFormParal._init_derived(self)
721
+ SymplecticForm._init_derived(self)
722
+
723
+ def _del_derived(self, del_restrictions: bool = True):
724
+ r"""
725
+ Delete the derived quantities.
726
+
727
+ INPUT:
728
+
729
+ - ``del_restrictions`` -- boolean (default: ``True``); determines whether the
730
+ restrictions of ``self`` to subdomains are deleted
731
+
732
+ TESTS::
733
+
734
+ sage: from sage.manifolds.differentiable.symplectic_form import SymplecticFormParal
735
+ sage: M.<q, p> = EuclideanSpace(2, "R2", r"\mathbb{R}^2", symbols=r"q:q p:p")
736
+ sage: omega = SymplecticFormParal(M, 'omega', r'\omega')
737
+ sage: omega._del_derived(del_restrictions=False)
738
+ sage: omega._del_derived()
739
+ """
740
+ # Delete derived quantities from mother classes
741
+ DiffFormParal._del_derived(self, del_restrictions=del_restrictions)
742
+
743
+ # Clear the Poisson tensor
744
+ if self._poisson is not None:
745
+ self._poisson._components.clear()
746
+ self._poisson._del_derived()
747
+
748
+ SymplecticForm._del_derived(self)
749
+
750
+ def restrict(
751
+ self, subdomain: DifferentiableManifold, dest_map: Optional[DiffMap] = None
752
+ ) -> SymplecticFormParal:
753
+ r"""
754
+ Return the restriction of the symplectic form to some subdomain.
755
+
756
+ If the restriction has not been defined yet, it is constructed here.
757
+
758
+ INPUT:
759
+
760
+ - ``subdomain`` -- open subset `U` of the symplectic form's domain
761
+ - ``dest_map`` -- (default: ``None``) smooth destination map
762
+ `\Phi:\ U \rightarrow V`, where `V` is a subdomain of the symplectic form's domain.
763
+ If ``None``, the restriction of the initial vector field module is used.
764
+
765
+ OUTPUT: the restricted symplectic form
766
+
767
+ EXAMPLES:
768
+
769
+ Restriction of the standard symplectic form on `\RR^2` to the upper half plane::
770
+
771
+ sage: from sage.manifolds.differentiable.symplectic_form import SymplecticFormParal
772
+ sage: M = EuclideanSpace(2, "R2", r"\mathbb{R}^2", symbols=r"q:q p:p")
773
+ sage: X.<q, p> = M.chart()
774
+ sage: omega = SymplecticFormParal(M, 'omega', r'\omega')
775
+ sage: omega[1,2] = -1
776
+ sage: U = M.open_subset('U', coord_def={X: q>0})
777
+ sage: omegaU = omega.restrict(U); omegaU
778
+ Symplectic form omega on the Open subset U of the Euclidean plane R2
779
+ sage: omegaU.display()
780
+ omega = -dq∧dp
781
+ """
782
+ if subdomain == self._domain:
783
+ return self
784
+ if subdomain not in self._restrictions:
785
+ # Construct the restriction at the tensor field level:
786
+ resu = DiffFormParal.restrict(self, subdomain, dest_map=dest_map)
787
+
788
+ self._restrictions[subdomain] = SymplecticFormParal.wrap(resu)
789
+ return self._restrictions[subdomain]
790
+
791
+ def poisson(
792
+ self, expansion_symbol: Optional[Expression] = None, order: int = 1
793
+ ) -> TensorFieldParal:
794
+ r"""
795
+ Return the Poisson tensor associated with the symplectic form.
796
+
797
+ INPUT:
798
+
799
+ - ``expansion_symbol`` -- (default: ``None``) symbolic variable; if
800
+ specified, the inverse will be expanded in power series with respect
801
+ to this variable (around its zero value)
802
+ - ``order`` -- integer (default: 1); the order of the expansion
803
+ if ``expansion_symbol`` is not ``None``; the *order* is defined as
804
+ the degree of the polynomial representing the truncated power series
805
+ in ``expansion_symbol``; currently only first order inverse is
806
+ supported
807
+
808
+ If ``expansion_symbol`` is set, then the zeroth order symplectic form must be
809
+ invertible. Moreover, subsequent calls to this method will return
810
+ a cached value, even when called with the default value (to enable
811
+ computation of derived quantities). To reset, use :meth:`_del_derived`.
812
+
813
+ OUTPUT:
814
+
815
+ - the Poisson tensor, , as an instance of
816
+ :meth:`~sage.manifolds.differentiable.poisson_tensor.PoissonTensorFieldParal`
817
+
818
+ EXAMPLES:
819
+
820
+ Poisson tensor of `2`-dimensional symplectic vector space::
821
+
822
+ sage: from sage.manifolds.differentiable.symplectic_form import SymplecticFormParal
823
+ sage: M.<q, p> = EuclideanSpace(2, "R2", r"\mathbb{R}^2", symbols=r"q:q p:p")
824
+ sage: omega = SymplecticFormParal(M, 'omega', r'\omega')
825
+ sage: omega[1,2] = -1
826
+ sage: poisson = omega.poisson(); poisson
827
+ 2-vector field poisson_omega on the Euclidean plane R2
828
+ sage: poisson.display()
829
+ poisson_omega = -e_q∧e_p
830
+ """
831
+ super().poisson()
832
+
833
+ if expansion_symbol is not None:
834
+ if (
835
+ self._poisson is not None
836
+ and bool(self._poisson._components)
837
+ and list(self._poisson._components.values())[0][0, 0]._expansion_symbol
838
+ == expansion_symbol
839
+ and list(self._poisson._components.values())[0][0, 0]._order == order
840
+ ):
841
+ return self._poisson
842
+
843
+ if order != 1:
844
+ raise NotImplementedError("only first order inverse is implemented")
845
+ decompo = self.series_expansion(expansion_symbol, order)
846
+ g0 = decompo[0]
847
+ g1 = decompo[1]
848
+
849
+ g0m = self._new_instance() # needed because only metrics have
850
+ g0m.set_comp()[:] = g0[:] # an "inverse" method.
851
+
852
+ contraction = g1.contract(0, g0m.inverse(), 0)
853
+ contraction = contraction.contract(1, g0m.inverse(), 1)
854
+ self._poisson = -(g0m.inverse() - expansion_symbol * contraction)
855
+ self._poisson.set_calc_order(expansion_symbol, order)
856
+ return self._poisson
857
+
858
+ from sage.matrix.constructor import matrix
859
+ from sage.tensor.modules.comp import CompFullyAntiSym
860
+
861
+ # Is the inverse metric up to date ?
862
+ for frame in self._components:
863
+ if frame not in self._poisson._components:
864
+ # the computation is necessary
865
+ fmodule = self._fmodule
866
+ si = fmodule._sindex
867
+ nsi = fmodule.rank() + si
868
+ dom = self._domain
869
+ comp_poisson = CompFullyAntiSym(
870
+ fmodule._ring,
871
+ frame,
872
+ 2,
873
+ start_index=si,
874
+ output_formatter=fmodule._output_formatter,
875
+ )
876
+ comp_poisson_scal = (
877
+ {}
878
+ ) # dict. of scalars representing the components of the poisson tensor (keys: comp. indices)
879
+ for i in fmodule.irange():
880
+ for j in range(i, nsi): # symmetry taken into account
881
+ comp_poisson_scal[(i, j)] = dom.scalar_field()
882
+ for chart in dom.top_charts():
883
+ # TODO: do the computation without the 'SR' enforcement
884
+ try:
885
+ self_matrix = matrix(
886
+ [
887
+ [
888
+ self.comp(frame)[i, j, chart].expr(method='SR')
889
+ for j in fmodule.irange()
890
+ ]
891
+ for i in fmodule.irange()
892
+ ]
893
+ )
894
+ self_matrix_inv = self_matrix.inverse()
895
+ except (KeyError, ValueError):
896
+ continue
897
+ for i in fmodule.irange():
898
+ for j in range(i, nsi):
899
+ val = chart.simplify(
900
+ -self_matrix_inv[i - si, j - si], method="SR"
901
+ )
902
+ comp_poisson_scal[(i, j)].add_expr(val, chart=chart)
903
+ for i in range(si, nsi):
904
+ for j in range(i, nsi):
905
+ comp_poisson[i, j] = comp_poisson_scal[(i, j)]
906
+ self._poisson._components[frame] = comp_poisson
907
+ return self._poisson
908
+
909
+
910
+ # ****************************************************************************************