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,541 @@
1
+ # sage_setup: distribution = sagemath-symbolics
2
+ r"""
3
+ De Rham Cohomology
4
+
5
+ Let `M` and `N` be differentiable manifolds and `\varphi\colon M \to N` be
6
+ a differentiable map. Then the associated de Rham complex is given by
7
+
8
+ .. MATH::
9
+
10
+ 0 \rightarrow \Omega^0(M,\varphi) \xrightarrow{\mathrm{d}_0}
11
+ \Omega^1(M,\varphi) \xrightarrow{\mathrm{d}_1} \dots
12
+ \xrightarrow{\mathrm{d}_{n-1}} \Omega^n(M,\varphi)
13
+ \xrightarrow{\mathrm{d}_{n}} 0,
14
+
15
+ where `\Omega^k(M,\varphi)` is the module of differential forms of degree `k`,
16
+ and `d_k` is the associated exterior derivative. Then the `k`-*th de Rham
17
+ cohomology group* is given by
18
+
19
+ .. MATH::
20
+
21
+ H^k_{\mathrm{dR}}(M, \varphi) =
22
+ \left. \mathrm{ker}(\mathrm{d}_k) \middle/
23
+ \mathrm{im}(\mathrm{d}_{k-1}) \right. ,
24
+
25
+ and the corresponding ring is obtained by
26
+
27
+ .. MATH::
28
+
29
+ H^*_{\mathrm{dR}}(M, \varphi) = \bigoplus^n_{k=0} H^k_{\mathrm{dR}}(M, \varphi).
30
+
31
+ The de Rham cohomology ring is implemented via :class:`DeRhamCohomologyRing`.
32
+ Its elements, the cohomology classes, are represented by
33
+ :class:`DeRhamCohomologyClass`.
34
+
35
+ AUTHORS:
36
+
37
+ - Michael Jung (2021) : initial version
38
+ """
39
+
40
+ #******************************************************************************
41
+ # Copyright (C) 2021 Michael Jung <m.jung@vu.nl>
42
+ #
43
+ # Distributed under the terms of the GNU General Public License (GPL)
44
+ # as published by the Free Software Foundation; either version 2 of
45
+ # the License, or (at your option) any later version.
46
+ # https://www.gnu.org/licenses/
47
+ #******************************************************************************
48
+
49
+ from sage.categories.algebras import Algebras
50
+ from sage.manifolds.differentiable.characteristic_cohomology_class import (
51
+ CharacteristicCohomologyClassRing,
52
+ CharacteristicCohomologyClassRingElement,
53
+ )
54
+ from sage.misc.cachefunc import cached_method
55
+ from sage.structure.element import AlgebraElement
56
+ from sage.structure.parent import Parent
57
+ from sage.structure.unique_representation import UniqueRepresentation
58
+
59
+
60
+ class DeRhamCohomologyClass(AlgebraElement):
61
+ r"""
62
+ Define a cohomology class in the de Rham cohomology ring.
63
+
64
+ INPUT:
65
+
66
+ - ``parent`` -- de Rham cohomology ring represented by an instance of
67
+ :class:`DeRhamCohomologyRing`
68
+ - ``representative`` -- a closed (mixed) differential form representing the
69
+ cohomology class
70
+
71
+ .. NOTE::
72
+
73
+ The current implementation only provides basic features. Comparison via
74
+ exact forms are not supported at the time being.
75
+
76
+ EXAMPLES::
77
+
78
+ sage: M = Manifold(2, 'M')
79
+ sage: X.<x,y> = M.chart()
80
+ sage: C = M.de_rham_complex()
81
+ sage: H = C.cohomology()
82
+ sage: omega = M.diff_form(1, [1,1], name='omega')
83
+ sage: u = H(omega); u
84
+ [omega]
85
+
86
+ Cohomology classes can be lifted to the algebra of mixed differential
87
+ forms::
88
+
89
+ sage: u.lift()
90
+ Mixed differential form omega on the 2-dimensional differentiable
91
+ manifold M
92
+
93
+ However, comparison of two cohomology classes is limited the time being::
94
+
95
+ sage: eta = M.diff_form(1, [1,1], name='eta')
96
+ sage: H(eta) == u
97
+ True
98
+ sage: H.one() == u
99
+ Traceback (most recent call last):
100
+ ...
101
+ NotImplementedError: comparison via exact forms is currently not supported
102
+ """
103
+ def __init__(self, parent, representative):
104
+ r"""
105
+ Construct an element of the de Rham cohomology ring.
106
+
107
+ TESTS::
108
+
109
+ sage: M = Manifold(2, 'M')
110
+ sage: X.<x,y> = M.chart()
111
+ sage: C = M.de_rham_complex()
112
+ sage: H = C.cohomology()
113
+ sage: omega = M.diff_form(1, [1,1], name='omega', latex_name=r'\omega')
114
+ sage: u = H(omega)
115
+ sage: TestSuite(u).run(skip=['_test_eq', '_test_nonzero_equal']) # equality not fully supported yet
116
+ """
117
+ super().__init__(parent=parent)
118
+ self._representative = representative
119
+
120
+ def _repr_(self):
121
+ r"""
122
+ Return a string representation of the object.
123
+
124
+ TESTS::
125
+
126
+ sage: M = Manifold(2, 'M')
127
+ sage: C = M.de_rham_complex()
128
+ sage: H = C.cohomology()
129
+ sage: H.an_element() # indirect doctest
130
+ [one]
131
+ sage: H.an_element()._repr_()
132
+ '[one]'
133
+ """
134
+ name = self._representative._name
135
+ if name is None:
136
+ name = 'unnamed form'
137
+ return f"[{name}]"
138
+
139
+ def _latex_(self):
140
+ r"""
141
+ Return a LaTeX representation of the object.
142
+
143
+ TESTS::
144
+
145
+ sage: M = Manifold(2, 'M', latex_name=r'\mathcal{M}')
146
+ sage: X.<x,y> = M.chart()
147
+ sage: C = M.de_rham_complex()
148
+ sage: H = C.cohomology()
149
+ sage: omega = M.diff_form(1, [1,1], name='omega', latex_name=r'\omega')
150
+ sage: u = H(omega)
151
+ sage: latex(u) # indirect doctest
152
+ \left[\omega\right]
153
+ sage: u._latex_()
154
+ '\\left[\\omega\\right]'
155
+ """
156
+ latex_name = self._representative._latex_name
157
+ if latex_name is None:
158
+ latex_name = r'\mathrm{unnamed form}'
159
+ return rf"\left[{latex_name}\right]"
160
+
161
+ def representative(self):
162
+ r"""
163
+ Return a representative of ``self`` in the associated de Rham
164
+ complex.
165
+
166
+ EXAMPLES::
167
+
168
+ sage: M = Manifold(2, 'M')
169
+ sage: X.<x,y> = M.chart()
170
+ sage: C = M.de_rham_complex()
171
+ sage: H = C.cohomology()
172
+ sage: omega = M.diff_form(2, name='omega')
173
+ sage: omega[0,1] = x
174
+ sage: omega.display()
175
+ omega = x dx∧dy
176
+ sage: u = H(omega); u
177
+ [omega]
178
+ sage: u.representative()
179
+ Mixed differential form omega on the 2-dimensional differentiable
180
+ manifold M
181
+ """
182
+ return self._representative
183
+
184
+ lift = representative
185
+
186
+ def _add_(self, other):
187
+ r"""
188
+ Addition of two cohomology classes.
189
+
190
+ TESTS::
191
+
192
+ sage: M = Manifold(2, 'M')
193
+ sage: X.<x,y> = M.chart()
194
+ sage: C = M.de_rham_complex()
195
+ sage: H = C.cohomology()
196
+ sage: omega = M.diff_form(1, [1,1], name='omega')
197
+ sage: eta = M.diff_form(1, [1,-1], name='eta')
198
+ sage: H(omega) + H(eta)
199
+ [omega+eta]
200
+ """
201
+ return self.parent()(self.representative() + other.representative())
202
+
203
+ def cup(self, other):
204
+ r"""
205
+ Cup product of two cohomology classes.
206
+
207
+ INPUT:
208
+
209
+ - ``other`` -- another cohomology class in the de Rham cohomology
210
+
211
+ EXAMPLES::
212
+
213
+ sage: M = Manifold(2, 'M')
214
+ sage: X.<x,y> = M.chart()
215
+ sage: C = M.de_rham_complex()
216
+ sage: H = C.cohomology()
217
+ sage: omega = M.diff_form(1, [1,1], name='omega')
218
+ sage: eta = M.diff_form(1, [1,-1], name='eta')
219
+ sage: H(omega).cup(H(eta))
220
+ [omega∧eta]
221
+ """
222
+ return self * other
223
+
224
+ def _mul_(self, other):
225
+ r"""
226
+ Cup product of two cohomology classes.
227
+
228
+ TESTS::
229
+
230
+ sage: M = Manifold(2, 'M')
231
+ sage: X.<x,y> = M.chart()
232
+ sage: C = M.de_rham_complex()
233
+ sage: H = C.cohomology()
234
+ sage: omega = M.diff_form(1, [1,1], name='omega')
235
+ sage: eta = M.diff_form(1, [1,-1], name='eta')
236
+ sage: H(omega) * H(eta)
237
+ [omega∧eta]
238
+ """
239
+ return self.parent()(self.representative().wedge(other.representative()))
240
+
241
+ def _rmul_(self, scalar):
242
+ r"""
243
+ Multiplication with a scalar.
244
+
245
+ TESTS::
246
+
247
+ sage: M = Manifold(2, 'M')
248
+ sage: X.<x,y> = M.chart()
249
+ sage: C = M.de_rham_complex()
250
+ sage: H = C.cohomology()
251
+ sage: omega = M.diff_form(1, [1,1], name='omega')
252
+ sage: 1/2*H(omega)
253
+ [1/2∧omega]
254
+ """
255
+ return self.parent(scalar * self.representative())
256
+
257
+ def _sub_(self, other):
258
+ r"""
259
+ Subtraction of two cohomology classes.
260
+
261
+ TESTS::
262
+
263
+ sage: M = Manifold(2, 'M')
264
+ sage: X.<x,y> = M.chart()
265
+ sage: C = M.de_rham_complex()
266
+ sage: H = C.cohomology()
267
+ sage: omega = M.diff_form(1, [1,1], name='omega')
268
+ sage: eta = M.diff_form(1, [1,-1], name='eta')
269
+ sage: H(omega) - H(eta)
270
+ [omega-eta]
271
+ """
272
+ return self.parent()(self.representative() - other.representative())
273
+
274
+ def __eq__(self, other):
275
+ r"""
276
+ Comparison (equality) operator.
277
+
278
+ .. WARNING::
279
+
280
+ At current stage, the equality operator only checks whether the
281
+ representatives are equal. No further checks are supported so far.
282
+
283
+ TESTS::
284
+
285
+ sage: M = Manifold(2, 'M')
286
+ sage: X.<x,y> = M.chart()
287
+ sage: C = M.de_rham_complex()
288
+ sage: H = C.cohomology()
289
+ sage: omega = M.diff_form(1, [1,1], name='omega')
290
+ sage: eta = M.diff_form(1, [1,1], name='eta')
291
+ sage: H(omega) == H(eta)
292
+ True
293
+ sage: H(omega) == H.one()
294
+ Traceback (most recent call last):
295
+ ...
296
+ NotImplementedError: comparison via exact forms is currently not supported
297
+ """
298
+ if self is other:
299
+ return True
300
+ if isinstance(other, type(self)):
301
+ if self.representative() == other.representative():
302
+ return True
303
+ raise NotImplementedError('comparison via exact forms is currently not supported')
304
+
305
+
306
+ class DeRhamCohomologyRing(Parent, UniqueRepresentation):
307
+ r"""
308
+ The de Rham cohomology ring of a de Rham complex.
309
+
310
+ This ring is naturally endowed with a multiplication induced by the wedge
311
+ product, called *cup product*, see :meth:`DeRhamCohomologyClass.cup`.
312
+
313
+ .. NOTE::
314
+
315
+ The current implementation only provides basic features. Comparison via
316
+ exact forms are not supported at the time being.
317
+
318
+ INPUT:
319
+
320
+ - ``de_rham_complex`` -- a de Rham complex, typically an instance of
321
+ :class:`~sage.manifolds.differentiable.mixed_form_algebra.MixedFormAlgebra`
322
+
323
+ EXAMPLES:
324
+
325
+ We define the de Rham cohomology ring on a parallelizable manifold `M`::
326
+
327
+ sage: M = Manifold(2, 'M')
328
+ sage: X.<x,y> = M.chart()
329
+ sage: C = M.de_rham_complex()
330
+ sage: H = C.cohomology(); H
331
+ De Rham cohomology ring on the 2-dimensional differentiable manifold M
332
+
333
+ Its elements are induced by closed differential forms on `M`::
334
+
335
+ sage: beta = M.diff_form(1, [1,0], name='beta')
336
+ sage: beta.display()
337
+ beta = dx
338
+ sage: d1 = C.differential(1)
339
+ sage: d1(beta).display()
340
+ dbeta = 0
341
+ sage: b = H(beta); b
342
+ [beta]
343
+
344
+ Cohomology classes can be lifted to the algebra of mixed differential
345
+ forms::
346
+
347
+ sage: b.representative()
348
+ Mixed differential form beta on the 2-dimensional differentiable
349
+ manifold M
350
+
351
+ The ring admits a zero and unit element::
352
+
353
+ sage: H.zero()
354
+ [zero]
355
+ sage: H.one()
356
+ [one]
357
+ """
358
+ def __init__(self, de_rham_complex):
359
+ r"""
360
+ Construct the de Rham cohomology ring.
361
+
362
+ TESTS::
363
+
364
+ sage: M = Manifold(2, 'M')
365
+ sage: X.<x,y> = M.chart()
366
+ sage: C = M.de_rham_complex()
367
+ sage: H = C.cohomology(); H
368
+ De Rham cohomology ring on the 2-dimensional differentiable
369
+ manifold M
370
+ sage: TestSuite(H).run(skip=['_test_elements',
371
+ ....: '_test_elements_eq_symmetric',
372
+ ....: '_test_elements_eq_transitive',
373
+ ....: '_test_elements_neq']) # equality not fully supported yet
374
+ """
375
+ base_field = de_rham_complex.base_ring()
376
+ Parent.__init__(self, base=base_field, category=Algebras(base_field))
377
+ self._de_rham_complex = self._module = de_rham_complex
378
+ self._manifold = de_rham_complex._domain
379
+
380
+ Element = DeRhamCohomologyClass
381
+
382
+ def _element_constructor_(self, x):
383
+ r"""
384
+ Construct an element of ``self``.
385
+
386
+ TESTS::
387
+
388
+ sage: M = Manifold(2, 'M')
389
+ sage: X.<x,y> = M.chart()
390
+ sage: C = M.de_rham_complex()
391
+ sage: H = C.cohomology()
392
+ sage: H._element_constructor_(C.one())
393
+ [one]
394
+
395
+ Non-cycle element::
396
+
397
+ sage: omega = M.diff_form(1, name='omega')
398
+ sage: omega[0] = y
399
+ sage: omega.display()
400
+ omega = y dx
401
+ sage: H(omega)
402
+ Traceback (most recent call last):
403
+ ...
404
+ ValueError: Mixed differential form omega on the 2-dimensional
405
+ differentiable manifold M must be a closed form
406
+ """
407
+ if isinstance(x, CharacteristicCohomologyClassRingElement):
408
+ x = x.representative()
409
+ elif x not in self._module:
410
+ raise TypeError(f"{x} must be an element of {self._module}")
411
+ x = self._module(x)
412
+ if x.derivative() != 0:
413
+ raise ValueError(f"{x} must be a closed form")
414
+ return self.element_class(self, x)
415
+
416
+ def _coerce_map_from_(self, other):
417
+ r"""
418
+ Determine whether coercion to ``self`` exists from other parent.
419
+
420
+ TESTS::
421
+
422
+ sage: M = Manifold(2, 'M')
423
+ sage: C = M.de_rham_complex()
424
+ sage: H = C.cohomology()
425
+ sage: H.has_coerce_map_from(QQ)
426
+ True
427
+
428
+ ::
429
+
430
+ sage: M = Manifold(4, 'M')
431
+ sage: C = M.de_rham_complex()
432
+ sage: H = C.cohomology()
433
+ sage: TM = M.tangent_bundle()
434
+ sage: C = TM.characteristic_cohomology_class_ring(); C
435
+ Algebra of characteristic cohomology classes of the Tangent bundle
436
+ TM over the 4-dimensional differentiable manifold M
437
+ sage: H.has_coerce_map_from(C)
438
+ True
439
+ """
440
+ if isinstance(other, CharacteristicCohomologyClassRing):
441
+ # TODO: we need to be careful if manifolds have boundary!
442
+ return other._vbundle._base_space == self._manifold
443
+ return super()._coerce_map_from_(other)
444
+
445
+ def _repr_(self):
446
+ r"""
447
+ Return a string representation of the object.
448
+
449
+ TESTS::
450
+
451
+ sage: M = Manifold(2, 'M')
452
+ sage: C = M.de_rham_complex()
453
+ sage: H = C.cohomology(); H
454
+ De Rham cohomology ring on the 2-dimensional differentiable
455
+ manifold M
456
+ """
457
+ desc = "De Rham cohomology ring "
458
+ if self._module._dest_map is self._manifold.identity_map():
459
+ desc += "on the {}".format(self._manifold)
460
+ else:
461
+ desc += "along the {} mapped ".format(self._manifold)
462
+ desc += "into the {} ".format(self._module._ambient_domain)
463
+ if self._module._dest_map._name is None:
464
+ dm_name = "unnamed map"
465
+ else:
466
+ dm_name = self._module._dest_map._name
467
+ desc += "via " + dm_name
468
+ return desc
469
+
470
+ def _latex_(self):
471
+ r"""
472
+ Return a LaTeX representation of the object.
473
+
474
+ TESTS::
475
+
476
+ sage: M = Manifold(3, 'M', latex_name=r'\mathcal{M}')
477
+ sage: C = M.de_rham_complex()
478
+ sage: H = C.cohomology()
479
+ sage: H._latex_()
480
+ 'H^*_{\\mathrm{dR}}\\left(\\mathcal{M}\\right)'
481
+ sage: latex(H) # indirect doctest
482
+ H^*_{\mathrm{dR}}\left(\mathcal{M}\right)
483
+ """
484
+ latex_name = r"H^*_{\mathrm{dR}}\left(" + self._manifold._latex_name
485
+ if self._module._dest_map is not self._manifold.identity_map():
486
+ dm_latex_name = self._module._dest_map._latex_name
487
+ if dm_latex_name is None:
488
+ dm_latex_name = r"\mathrm{unnamed\; map}"
489
+ latex_name += "," + dm_latex_name
490
+ latex_name += r"\right)"
491
+ return latex_name
492
+
493
+ def _an_element_(self):
494
+ r"""
495
+ Return an element of ``self``.
496
+
497
+ TESTS::
498
+
499
+ sage: M = Manifold(2, 'M')
500
+ sage: C = M.de_rham_complex()
501
+ sage: H = C.cohomology()
502
+ sage: H.an_element()
503
+ [one]
504
+ """
505
+ return self.one()
506
+
507
+ @cached_method
508
+ def zero(self):
509
+ r"""
510
+ Return the zero element of ``self``.
511
+
512
+ EXAMPLES::
513
+
514
+ sage: M = Manifold(2, 'M')
515
+ sage: C = M.de_rham_complex()
516
+ sage: H = C.cohomology()
517
+ sage: H.zero()
518
+ [zero]
519
+ sage: H.zero().representative()
520
+ Mixed differential form zero on the 2-dimensional differentiable
521
+ manifold M
522
+ """
523
+ return self.element_class(self, self._module.zero())
524
+
525
+ @cached_method
526
+ def one(self):
527
+ r"""
528
+ Return the one element of ``self``.
529
+
530
+ EXAMPLES::
531
+
532
+ sage: M = Manifold(2, 'M')
533
+ sage: C = M.de_rham_complex()
534
+ sage: H = C.cohomology()
535
+ sage: H.one()
536
+ [one]
537
+ sage: H.one().representative()
538
+ Mixed differential form one on the 2-dimensional differentiable
539
+ manifold M
540
+ """
541
+ return self.element_class(self, self._module.one())