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,629 @@
1
+ # sage_setup: distribution = sagemath-symbolics
2
+ r"""
3
+ Algebra of Scalar Fields
4
+
5
+ The class :class:`ScalarFieldAlgebra` implements the commutative algebra
6
+ `C^0(M)` of scalar fields on a topological manifold `M` over a topological
7
+ field `K`. By *scalar field*, it
8
+ is meant a continuous function `M \to K`. The set
9
+ `C^0(M)` is an algebra over `K`, whose ring product is the pointwise
10
+ multiplication of `K`-valued functions, which is clearly commutative.
11
+
12
+ AUTHORS:
13
+
14
+ - Eric Gourgoulhon, Michal Bejger (2014-2015): initial version
15
+ - Travis Scrimshaw (2016): review tweaks
16
+
17
+ REFERENCES:
18
+
19
+ - [Lee2011]_
20
+ - [KN1963]_
21
+ """
22
+
23
+ #******************************************************************************
24
+ # Copyright (C) 2015 Eric Gourgoulhon <eric.gourgoulhon@obspm.fr>
25
+ # Copyright (C) 2015 Michal Bejger <bejger@camk.edu.pl>
26
+ # Copyright (C) 2016 Travis Scrimshaw <tscrimsh@umn.edu>
27
+ #
28
+ # Distributed under the terms of the GNU General Public License (GPL)
29
+ # as published by the Free Software Foundation; either version 2 of
30
+ # the License, or (at your option) any later version.
31
+ # http://www.gnu.org/licenses/
32
+ #******************************************************************************
33
+
34
+ from sage.categories.commutative_algebras import CommutativeAlgebras
35
+ from sage.categories.topological_spaces import TopologicalSpaces
36
+ from sage.manifolds.scalarfield import ScalarField
37
+ from sage.misc.cachefunc import cached_method
38
+ from sage.structure.parent import Parent
39
+ from sage.structure.unique_representation import UniqueRepresentation
40
+ from sage.symbolic.ring import SR, SymbolicRing
41
+
42
+
43
+ class ScalarFieldAlgebra(UniqueRepresentation, Parent):
44
+ r"""
45
+ Commutative algebra of scalar fields on a topological manifold.
46
+
47
+ If `M` is a topological manifold over a topological field `K`, the
48
+ commutative algebra of scalar fields on `M` is the set `C^0(M)` of all
49
+ continuous maps `M \to K`. The set `C^0(M)` is an algebra over `K`,
50
+ whose ring product is the pointwise multiplication of `K`-valued
51
+ functions, which is clearly commutative.
52
+
53
+ If `K = \RR` or `K = \CC`, the field `K` over which the
54
+ algebra `C^0(M)` is constructed is represented by the :class:`Symbolic
55
+ Ring <sage.symbolic.ring.SymbolicRing>` ``SR``, since there is no exact
56
+ representation of `\RR` nor `\CC`.
57
+
58
+ INPUT:
59
+
60
+ - ``domain`` -- the topological manifold `M` on which the scalar fields
61
+ are defined
62
+
63
+ EXAMPLES:
64
+
65
+ Algebras of scalar fields on the sphere `S^2` and on some open
66
+ subsets of it::
67
+
68
+ sage: M = Manifold(2, 'M', structure='topological') # the 2-dimensional sphere S^2
69
+ sage: U = M.open_subset('U') # complement of the North pole
70
+ sage: c_xy.<x,y> = U.chart() # stereographic coordinates from the North pole
71
+ sage: V = M.open_subset('V') # complement of the South pole
72
+ sage: c_uv.<u,v> = V.chart() # stereographic coordinates from the South pole
73
+ sage: M.declare_union(U,V) # S^2 is the union of U and V
74
+ sage: xy_to_uv = c_xy.transition_map(c_uv, (x/(x^2+y^2), y/(x^2+y^2)),
75
+ ....: intersection_name='W',
76
+ ....: restrictions1= x^2+y^2!=0,
77
+ ....: restrictions2= u^2+v^2!=0)
78
+ sage: uv_to_xy = xy_to_uv.inverse()
79
+ sage: CM = M.scalar_field_algebra(); CM
80
+ Algebra of scalar fields on the 2-dimensional topological manifold M
81
+ sage: W = U.intersection(V) # S^2 minus the two poles
82
+ sage: CW = W.scalar_field_algebra(); CW
83
+ Algebra of scalar fields on the Open subset W of the
84
+ 2-dimensional topological manifold M
85
+
86
+ `C^0(M)` and `C^0(W)` belong to the category of commutative
87
+ algebras over `\RR` (represented here by
88
+ :class:`~sage.symbolic.ring.SymbolicRing`)::
89
+
90
+ sage: CM.category()
91
+ Join of Category of commutative algebras over Symbolic Ring and Category of homsets of topological spaces
92
+ sage: CM.base_ring()
93
+ Symbolic Ring
94
+ sage: CW.category()
95
+ Join of Category of commutative algebras over Symbolic Ring and Category of homsets of topological spaces
96
+ sage: CW.base_ring()
97
+ Symbolic Ring
98
+
99
+ The elements of `C^0(M)` are scalar fields on `M`::
100
+
101
+ sage: CM.an_element()
102
+ Scalar field on the 2-dimensional topological manifold M
103
+ sage: CM.an_element().display() # this sample element is a constant field
104
+ M → ℝ
105
+ on U: (x, y) ↦ 2
106
+ on V: (u, v) ↦ 2
107
+
108
+ Those of `C^0(W)` are scalar fields on `W`::
109
+
110
+ sage: CW.an_element()
111
+ Scalar field on the Open subset W of the 2-dimensional topological
112
+ manifold M
113
+ sage: CW.an_element().display() # this sample element is a constant field
114
+ W → ℝ
115
+ (x, y) ↦ 2
116
+ (u, v) ↦ 2
117
+
118
+ The zero element::
119
+
120
+ sage: CM.zero()
121
+ Scalar field zero on the 2-dimensional topological manifold M
122
+ sage: CM.zero().display()
123
+ zero: M → ℝ
124
+ on U: (x, y) ↦ 0
125
+ on V: (u, v) ↦ 0
126
+
127
+ ::
128
+
129
+ sage: CW.zero()
130
+ Scalar field zero on the Open subset W of the 2-dimensional
131
+ topological manifold M
132
+ sage: CW.zero().display()
133
+ zero: W → ℝ
134
+ (x, y) ↦ 0
135
+ (u, v) ↦ 0
136
+
137
+ The unit element::
138
+
139
+ sage: CM.one()
140
+ Scalar field 1 on the 2-dimensional topological manifold M
141
+ sage: CM.one().display()
142
+ 1: M → ℝ
143
+ on U: (x, y) ↦ 1
144
+ on V: (u, v) ↦ 1
145
+
146
+ ::
147
+
148
+ sage: CW.one()
149
+ Scalar field 1 on the Open subset W of the 2-dimensional topological
150
+ manifold M
151
+ sage: CW.one().display()
152
+ 1: W → ℝ
153
+ (x, y) ↦ 1
154
+ (u, v) ↦ 1
155
+
156
+ A generic element can be constructed by using a dictionary of
157
+ the coordinate expressions defining the scalar field::
158
+
159
+ sage: f = CM({c_xy: atan(x^2+y^2), c_uv: pi/2 - atan(u^2+v^2)}); f
160
+ Scalar field on the 2-dimensional topological manifold M
161
+ sage: f.display()
162
+ M → ℝ
163
+ on U: (x, y) ↦ arctan(x^2 + y^2)
164
+ on V: (u, v) ↦ 1/2*pi - arctan(u^2 + v^2)
165
+ sage: f.parent()
166
+ Algebra of scalar fields on the 2-dimensional topological manifold M
167
+
168
+ Specific elements can also be constructed in this way::
169
+
170
+ sage: CM(0) == CM.zero()
171
+ True
172
+ sage: CM(1) == CM.one()
173
+ True
174
+
175
+ Note that the zero scalar field is cached::
176
+
177
+ sage: CM(0) is CM.zero()
178
+ True
179
+
180
+ Elements can also be constructed by means of the method
181
+ :meth:`~sage.manifolds.manifold.TopologicalManifold.scalar_field` acting
182
+ on the domain (this allows one to set the name of the scalar field at the
183
+ construction)::
184
+
185
+ sage: f1 = M.scalar_field({c_xy: atan(x^2+y^2), c_uv: pi/2 - atan(u^2+v^2)},
186
+ ....: name='f')
187
+ sage: f1.parent()
188
+ Algebra of scalar fields on the 2-dimensional topological manifold M
189
+ sage: f1 == f
190
+ True
191
+ sage: M.scalar_field(0, chart='all') == CM.zero()
192
+ True
193
+
194
+ The algebra `C^0(M)` coerces to `C^0(W)` since `W` is an open
195
+ subset of `M`::
196
+
197
+ sage: CW.has_coerce_map_from(CM)
198
+ True
199
+
200
+ The reverse is of course false::
201
+
202
+ sage: CM.has_coerce_map_from(CW)
203
+ False
204
+
205
+ The coercion map is nothing but the restriction to `W` of scalar fields
206
+ on `M`::
207
+
208
+ sage: fW = CW(f) ; fW
209
+ Scalar field on the Open subset W of the
210
+ 2-dimensional topological manifold M
211
+ sage: fW.display()
212
+ W → ℝ
213
+ (x, y) ↦ arctan(x^2 + y^2)
214
+ (u, v) ↦ 1/2*pi - arctan(u^2 + v^2)
215
+
216
+ ::
217
+
218
+ sage: CW(CM.one()) == CW.one()
219
+ True
220
+
221
+ The coercion map allows for the addition of elements of `C^0(W)`
222
+ with elements of `C^0(M)`, the result being an element of
223
+ `C^0(W)`::
224
+
225
+ sage: s = fW + f
226
+ sage: s.parent()
227
+ Algebra of scalar fields on the Open subset W of the
228
+ 2-dimensional topological manifold M
229
+ sage: s.display()
230
+ W → ℝ
231
+ (x, y) ↦ 2*arctan(x^2 + y^2)
232
+ (u, v) ↦ pi - 2*arctan(u^2 + v^2)
233
+
234
+ Another coercion is that from the Symbolic Ring.
235
+ Since the Symbolic Ring is the base ring for the algebra ``CM``, the
236
+ coercion of a symbolic expression ``s`` is performed by the operation
237
+ ``s*CM.one()``, which invokes the (reflected) multiplication operator.
238
+ If the symbolic expression does not involve any chart coordinate,
239
+ the outcome is a constant scalar field::
240
+
241
+ sage: h = CM(pi*sqrt(2)) ; h
242
+ Scalar field on the 2-dimensional topological manifold M
243
+ sage: h.display()
244
+ M → ℝ
245
+ on U: (x, y) ↦ sqrt(2)*pi
246
+ on V: (u, v) ↦ sqrt(2)*pi
247
+ sage: a = var('a')
248
+ sage: h = CM(a); h.display()
249
+ M → ℝ
250
+ on U: (x, y) ↦ a
251
+ on V: (u, v) ↦ a
252
+
253
+ If the symbolic expression involves some coordinate of one of the
254
+ manifold's charts, the outcome is initialized only on the chart domain::
255
+
256
+ sage: h = CM(a+x); h.display()
257
+ M → ℝ
258
+ on U: (x, y) ↦ a + x
259
+ on W: (u, v) ↦ (a*u^2 + a*v^2 + u)/(u^2 + v^2)
260
+ sage: h = CM(a+u); h.display()
261
+ M → ℝ
262
+ on W: (x, y) ↦ (a*x^2 + a*y^2 + x)/(x^2 + y^2)
263
+ on V: (u, v) ↦ a + u
264
+
265
+ If the symbolic expression involves coordinates of different charts,
266
+ the scalar field is created as a Python object, but is not initialized,
267
+ in order to avoid any ambiguity::
268
+
269
+ sage: h = CM(x+u); h.display()
270
+ M → ℝ
271
+
272
+ TESTS:
273
+
274
+ Ring laws::
275
+
276
+ sage: h = CM(pi*sqrt(2))
277
+ sage: s = f + h ; s
278
+ Scalar field on the 2-dimensional topological manifold M
279
+ sage: s.display()
280
+ M → ℝ
281
+ on U: (x, y) ↦ sqrt(2)*pi + arctan(x^2 + y^2)
282
+ on V: (u, v) ↦ 1/2*pi*(2*sqrt(2) + 1) - arctan(u^2 + v^2)
283
+
284
+ ::
285
+
286
+ sage: s = f - h ; s
287
+ Scalar field on the 2-dimensional topological manifold M
288
+ sage: s.display()
289
+ M → ℝ
290
+ on U: (x, y) ↦ -sqrt(2)*pi + arctan(x^2 + y^2)
291
+ on V: (u, v) ↦ -1/2*pi*(2*sqrt(2) - 1) - arctan(u^2 + v^2)
292
+
293
+ ::
294
+
295
+ sage: s = f*h ; s
296
+ Scalar field on the 2-dimensional topological manifold M
297
+ sage: s.display()
298
+ M → ℝ
299
+ on U: (x, y) ↦ sqrt(2)*pi*arctan(x^2 + y^2)
300
+ on V: (u, v) ↦ 1/2*sqrt(2)*(pi^2 - 2*pi*arctan(u^2 + v^2))
301
+
302
+ ::
303
+
304
+ sage: s = f/h ; s
305
+ Scalar field on the 2-dimensional topological manifold M
306
+ sage: s.display()
307
+ M → ℝ
308
+ on U: (x, y) ↦ 1/2*sqrt(2)*arctan(x^2 + y^2)/pi
309
+ on V: (u, v) ↦ 1/4*sqrt(2)*(pi - 2*arctan(u^2 + v^2))/pi
310
+
311
+ ::
312
+
313
+ sage: f*(h+f) == f*h + f*f
314
+ True
315
+
316
+ Ring laws with coercion::
317
+
318
+ sage: f - fW == CW.zero()
319
+ True
320
+ sage: f/fW == CW.one()
321
+ True
322
+ sage: s = f*fW ; s
323
+ Scalar field on the Open subset W of the 2-dimensional topological
324
+ manifold M
325
+ sage: s.display()
326
+ W → ℝ
327
+ (x, y) ↦ arctan(x^2 + y^2)^2
328
+ (u, v) ↦ 1/4*pi^2 - pi*arctan(u^2 + v^2) + arctan(u^2 + v^2)^2
329
+ sage: s/f == fW
330
+ True
331
+
332
+ Multiplication by a real number::
333
+
334
+ sage: s = 2*f ; s
335
+ Scalar field on the 2-dimensional topological manifold M
336
+ sage: s.display()
337
+ M → ℝ
338
+ on U: (x, y) ↦ 2*arctan(x^2 + y^2)
339
+ on V: (u, v) ↦ pi - 2*arctan(u^2 + v^2)
340
+
341
+ ::
342
+
343
+ sage: 0*f == CM.zero()
344
+ True
345
+ sage: 1*f == f
346
+ True
347
+ sage: 2*(f/2) == f
348
+ True
349
+ sage: (f+2*f)/3 == f
350
+ True
351
+ sage: 1/3*(f+2*f) == f
352
+ True
353
+
354
+ The Sage test suite for algebras is passed::
355
+
356
+ sage: TestSuite(CM).run()
357
+
358
+ It is passed also for `C^0(W)`::
359
+
360
+ sage: TestSuite(CW).run()
361
+ """
362
+
363
+ Element = ScalarField
364
+
365
+ def __init__(self, domain):
366
+ r"""
367
+ Construct an algebra of scalar fields.
368
+
369
+ TESTS::
370
+
371
+ sage: M = Manifold(2, 'M', structure='topological')
372
+ sage: X.<x,y> = M.chart()
373
+ sage: CM = M.scalar_field_algebra(); CM
374
+ Algebra of scalar fields on the 2-dimensional topological
375
+ manifold M
376
+ sage: type(CM)
377
+ <class 'sage.manifolds.scalarfield_algebra.ScalarFieldAlgebra_with_category'>
378
+ sage: type(CM).__base__
379
+ <class 'sage.manifolds.scalarfield_algebra.ScalarFieldAlgebra'>
380
+ sage: TestSuite(CM).run()
381
+ """
382
+ base_field = domain.base_field()
383
+ if domain.base_field_type() in ['real', 'complex']:
384
+ base_field = SR
385
+ Parent.__init__(self, base=base_field,
386
+ category=CommutativeAlgebras(base_field) & TopologicalSpaces().Homsets())
387
+ self._domain = domain
388
+ self._populate_coercion_lists_()
389
+
390
+ #### Methods required for any Parent
391
+ def _element_constructor_(self, coord_expression=None, chart=None,
392
+ name=None, latex_name=None):
393
+ r"""
394
+ Construct a scalar field.
395
+
396
+ INPUT:
397
+
398
+ - ``coord_expression`` -- (default: ``None``) element(s) to construct
399
+ the scalar field; this can be either
400
+
401
+ - a scalar field defined on a domain that encompass ``self._domain``;
402
+ then ``_element_constructor_`` return the restriction of
403
+ the scalar field to ``self._domain``
404
+ - a dictionary of coordinate expressions in various charts on the
405
+ domain, with the charts as keys
406
+ - a single coordinate expression; if the argument ``chart`` is
407
+ ``'all'``, this expression is set to all the charts defined
408
+ on the open set; otherwise, the expression is set in the
409
+ specific chart provided by the argument ``chart``
410
+
411
+ - ``chart`` -- (default: ``None``) chart defining the coordinates used
412
+ in ``coord_expression`` when the latter is a single coordinate
413
+ expression; if none is provided (default), the default chart of the
414
+ open set is assumed. If ``chart=='all'``, ``coord_expression`` is
415
+ assumed to be independent of the chart (constant scalar field).
416
+
417
+ - ``name`` -- (default: ``None``) string; name (symbol) given to the
418
+ scalar field
419
+
420
+ - ``latex_name`` -- (default: ``None``) string; LaTeX symbol to denote
421
+ the scalar field; if none is provided, the LaTeX symbol is set to
422
+ ``name``
423
+
424
+ If ``coord_expression`` is ``None`` or incomplete, coordinate
425
+ expressions can be added after the creation of the object, by means
426
+ of the methods :meth:`add_expr`, :meth:`add_expr_by_continuation` and
427
+ :meth:`set_expr`
428
+
429
+ TESTS::
430
+
431
+ sage: M = Manifold(2, 'M', structure='topological')
432
+ sage: X.<x,y> = M.chart()
433
+ sage: CM = M.scalar_field_algebra()
434
+ sage: f = CM({X: x+y^2}); f
435
+ Scalar field on the 2-dimensional topological manifold M
436
+ sage: f.display()
437
+ M → ℝ
438
+ (x, y) ↦ y^2 + x
439
+ sage: f = CM({X: x+y^2}, name='f'); f
440
+ Scalar field f on the 2-dimensional topological manifold M
441
+ sage: f.display()
442
+ f: M → ℝ
443
+ (x, y) ↦ y^2 + x
444
+ sage: U = M.open_subset('U', coord_def={X: x>0})
445
+ sage: CU = U.scalar_field_algebra()
446
+ sage: fU = CU(f); fU
447
+ Scalar field f on the Open subset U of the 2-dimensional topological
448
+ manifold M
449
+ sage: fU.display()
450
+ f: U → ℝ
451
+ (x, y) ↦ y^2 + x
452
+ """
453
+ try:
454
+ if coord_expression.is_trivial_zero():
455
+ return self.zero()
456
+ elif (coord_expression - 1).is_trivial_zero():
457
+ return self.one()
458
+ except AttributeError:
459
+ if coord_expression == 0:
460
+ return self.zero()
461
+ if coord_expression == 1:
462
+ return self.one()
463
+ if isinstance(coord_expression, ScalarField):
464
+ if self._domain.is_subset(coord_expression._domain):
465
+ # restriction of the scalar field to self._domain:
466
+ return coord_expression.restrict(self._domain)
467
+ else:
468
+ # Anything going wrong here should produce a readable error:
469
+ try:
470
+ # generic constructor:
471
+ resu = self.element_class(self,
472
+ coord_expression=coord_expression,
473
+ name=name, latex_name=latex_name,
474
+ chart=chart)
475
+ except TypeError:
476
+ raise TypeError("cannot convert " +
477
+ "{} to a scalar ".format(coord_expression) +
478
+ "field on {}".format(self._domain))
479
+ return resu
480
+
481
+ def _an_element_(self):
482
+ r"""
483
+ Construct some element of the algebra.
484
+
485
+ TESTS::
486
+
487
+ sage: M = Manifold(2, 'M', structure='topological')
488
+ sage: X.<x,y> = M.chart()
489
+ sage: CM = M.scalar_field_algebra()
490
+ sage: f = CM._an_element_(); f
491
+ Scalar field on the 2-dimensional topological manifold M
492
+ sage: f.display()
493
+ M → ℝ
494
+ (x, y) ↦ 2
495
+ """
496
+ return self.element_class(self, coord_expression=2, chart='all')
497
+
498
+ def _coerce_map_from_(self, other):
499
+ r"""
500
+ Determine whether coercion to ``self`` exists from ``other``.
501
+
502
+ TESTS::
503
+
504
+ sage: M = Manifold(2, 'M', structure='topological')
505
+ sage: X.<x,y> = M.chart()
506
+ sage: CM = M.scalar_field_algebra()
507
+ sage: CM._coerce_map_from_(SR)
508
+ True
509
+ sage: SCR = SR.subring(no_variables=True); SCR
510
+ Symbolic Constants Subring
511
+ sage: CM._coerce_map_from_(SCR)
512
+ True
513
+ sage: CM._coerce_map_from_(X.function_ring())
514
+ True
515
+ sage: U = M.open_subset('U', coord_def={X: x>0})
516
+ sage: CU = U.scalar_field_algebra()
517
+ sage: CM._coerce_map_from_(CU)
518
+ False
519
+ sage: CU._coerce_map_from_(CM)
520
+ True
521
+ """
522
+ from sage.manifolds.chart_func import ChartFunctionRing
523
+ if isinstance(other, SymbolicRing):
524
+ return True # coercion from the base ring (multiplication by the
525
+ # algebra unit, i.e. self.one())
526
+ # cf. ScalarField._lmul_() for the implementation of
527
+ # the coercion map
528
+ elif isinstance(other, ScalarFieldAlgebra):
529
+ return self._domain.is_subset(other._domain)
530
+ elif isinstance(other, ChartFunctionRing):
531
+ return self._domain.is_subset(other._chart.domain())
532
+ else:
533
+ return False
534
+
535
+ #### End of methods required for any Parent
536
+
537
+ def _repr_(self):
538
+ r"""
539
+ String representation of ``self``.
540
+
541
+ TESTS::
542
+
543
+ sage: M = Manifold(2, 'M', structure='topological')
544
+ sage: CM = M.scalar_field_algebra()
545
+ sage: CM._repr_()
546
+ 'Algebra of scalar fields on the 2-dimensional topological manifold M'
547
+ sage: CM
548
+ Algebra of scalar fields on the 2-dimensional topological manifold M
549
+ """
550
+ return "Algebra of scalar fields on the {}".format(self._domain)
551
+
552
+ def _latex_(self):
553
+ r"""
554
+ LaTeX representation of the object.
555
+
556
+ TESTS::
557
+
558
+ sage: M = Manifold(2, 'M', structure='topological')
559
+ sage: CM = M.scalar_field_algebra()
560
+ sage: CM._latex_()
561
+ 'C^0 \\left(M\\right)'
562
+ sage: latex(CM)
563
+ C^0 \left(M\right)
564
+ """
565
+ return r"C^0 \left(" + self._domain._latex_() + r"\right)"
566
+
567
+ @cached_method
568
+ def zero(self):
569
+ r"""
570
+ Return the zero element of the algebra.
571
+
572
+ This is nothing but the constant scalar field `0` on the manifold,
573
+ where `0` is the zero element of the base field.
574
+
575
+ EXAMPLES::
576
+
577
+ sage: M = Manifold(2, 'M', structure='topological')
578
+ sage: X.<x,y> = M.chart()
579
+ sage: CM = M.scalar_field_algebra()
580
+ sage: z = CM.zero(); z
581
+ Scalar field zero on the 2-dimensional topological manifold M
582
+ sage: z.display()
583
+ zero: M → ℝ
584
+ (x, y) ↦ 0
585
+
586
+ The result is cached::
587
+
588
+ sage: CM.zero() is z
589
+ True
590
+ """
591
+ coord_express = {chart: chart.zero_function()
592
+ for chart in self._domain.atlas()}
593
+ zero = self.element_class(self,
594
+ coord_expression=coord_express,
595
+ name='zero', latex_name='0')
596
+ zero._is_zero = True
597
+ zero.set_immutable()
598
+ return zero
599
+
600
+ @cached_method
601
+ def one(self):
602
+ r"""
603
+ Return the unit element of the algebra.
604
+
605
+ This is nothing but the constant scalar field `1` on the manifold,
606
+ where `1` is the unit element of the base field.
607
+
608
+ EXAMPLES::
609
+
610
+ sage: M = Manifold(2, 'M', structure='topological')
611
+ sage: X.<x,y> = M.chart()
612
+ sage: CM = M.scalar_field_algebra()
613
+ sage: h = CM.one(); h
614
+ Scalar field 1 on the 2-dimensional topological manifold M
615
+ sage: h.display()
616
+ 1: M → ℝ
617
+ (x, y) ↦ 1
618
+
619
+ The result is cached::
620
+
621
+ sage: CM.one() is h
622
+ True
623
+ """
624
+ coord_express = {chart: chart.one_function()
625
+ for chart in self._domain.atlas()}
626
+ one = self.element_class(self, coord_expression=coord_express,
627
+ name='1', latex_name='1')
628
+ one.set_immutable()
629
+ return one