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,1241 @@
1
+ # sage_setup: distribution = sagemath-symbolics
2
+ r"""
3
+ Coordinate Charts on Differentiable Manifolds
4
+
5
+ The class :class:`DiffChart` implements coordinate charts on a differentiable
6
+ manifold over a topological field `K` (in most applications, `K = \RR` or
7
+ `K = \CC`).
8
+
9
+ The subclass :class:`RealDiffChart` is devoted
10
+ to the case `K=\RR`, for which the concept of coordinate range is meaningful.
11
+ Moreover, :class:`RealDiffChart` is endowed with some plotting
12
+ capabilities (cf. method :meth:`~sage.manifolds.chart.RealChart.plot`).
13
+
14
+ Transition maps between charts are implemented via the class
15
+ :class:`DiffCoordChange`.
16
+
17
+ AUTHORS:
18
+
19
+ - Eric Gourgoulhon, Michal Bejger (2013-2015) : initial version
20
+
21
+ REFERENCES:
22
+
23
+ - Chap. 1 of [Lee2013]_
24
+ """
25
+ # ****************************************************************************
26
+ # Copyright (C) 2015 Eric Gourgoulhon <eric.gourgoulhon@obspm.fr>
27
+ # Copyright (C) 2015 Michal Bejger <bejger@camk.edu.pl>
28
+ #
29
+ # Distributed under the terms of the GNU General Public License (GPL)
30
+ # as published by the Free Software Foundation; either version 2 of
31
+ # the License, or (at your option) any later version.
32
+ # https://www.gnu.org/licenses/
33
+ # ****************************************************************************
34
+
35
+ from sage.manifolds.chart import Chart, CoordChange, RealChart
36
+ from sage.manifolds.differentiable.vectorframe import CoordFrame
37
+ from sage.misc.cachefunc import cached_method
38
+
39
+
40
+ class DiffChart(Chart):
41
+ r"""
42
+ Chart on a differentiable manifold.
43
+
44
+ Given a differentiable manifold `M` of dimension `n` over a topological
45
+ field `K`, a *chart* is a member `(U,\varphi)` of the manifold's
46
+ differentiable atlas; `U` is then an open subset of `M` and
47
+ `\varphi: U \rightarrow V \subset K^n` is a homeomorphism from
48
+ `U` to an open subset `V` of `K^n`.
49
+
50
+ The components `(x^1,\ldots,x^n)` of `\varphi`, defined by
51
+ `\varphi(p) = (x^1(p),\ldots,x^n(p))\in K^n` for any point `p\in U`, are
52
+ called the *coordinates* of the chart `(U,\varphi)`.
53
+
54
+ INPUT:
55
+
56
+ - ``domain`` -- open subset `U` on which the chart is defined
57
+ - ``coordinates`` -- (default: '' (empty string)) single string defining
58
+ the coordinate symbols, with ``' '`` (whitespace) as a separator; each
59
+ item has at most three fields, separated by a colon (``:``):
60
+
61
+ 1. the coordinate symbol (a letter or a few letters)
62
+ 2. (optional) the period of the coordinate if the coordinate is
63
+ periodic; the period field must be written as ``period=T``, where
64
+ ``T`` is the period (see examples below)
65
+ 3. (optional) the LaTeX spelling of the coordinate; if not provided the
66
+ coordinate symbol given in the first field will be used
67
+
68
+ The order of fields 2 and 3 does not matter and each of them can be
69
+ omitted. If it contains any LaTeX expression, the string ``coordinates``
70
+ must be declared with the prefix 'r' (for "raw") to allow for a proper
71
+ treatment of LaTeX's backslash character (see examples below).
72
+ If no period and no LaTeX spelling are to be set for any coordinate, the
73
+ argument ``coordinates`` can be omitted when the shortcut operator
74
+ ``<,>`` is used to declare the chart (see examples below).
75
+ - ``calc_method`` -- (default: ``None``) string defining the calculus
76
+ method for computations involving coordinates of the chart; must be
77
+ one of
78
+
79
+ - ``'SR'`` -- Sage's default symbolic engine (Symbolic Ring)
80
+ - ``'sympy'`` -- SymPy
81
+ - ``None`` -- the default of :class:`~sage.manifolds.calculus_method.CalculusMethod`
82
+ will be used
83
+ - ``names`` -- (default: ``None``) unused argument, except if
84
+ ``coordinates`` is not provided; it must then be a tuple containing
85
+ the coordinate symbols (this is guaranteed if the shortcut operator
86
+ ``<,>`` is used).
87
+ - ``coord_restrictions`` -- additional restrictions on the coordinates.
88
+ A restriction can be any symbolic equality or inequality involving
89
+ the coordinates, such as ``x > y`` or ``x^2 + y^2 != 0``. The items
90
+ of the list (or set or frozenset) ``coord_restrictions`` are combined
91
+ with the ``and`` operator; if some restrictions are to be combined with
92
+ the ``or`` operator instead, they have to be passed as a tuple in some
93
+ single item of the list (or set or frozenset) ``coord_restrictions``.
94
+ For example::
95
+
96
+ coord_restrictions=[x > y, (x != 0, y != 0), z^2 < x]
97
+
98
+ means ``(x > y) and ((x != 0) or (y != 0)) and (z^2 < x)``.
99
+ If the list ``coord_restrictions`` contains only one item, this
100
+ item can be passed as such, i.e. writing ``x > y`` instead
101
+ of the single element list ``[x > y]``. If the chart variables have
102
+ not been declared as variables yet, ``coord_restrictions`` must
103
+ be ``lambda``-quoted.
104
+
105
+ EXAMPLES:
106
+
107
+ A chart on a complex 2-dimensional differentiable manifold::
108
+
109
+ sage: M = Manifold(2, 'M', field='complex')
110
+ sage: X = M.chart('x y'); X
111
+ Chart (M, (x, y))
112
+ sage: latex(X)
113
+ \left(M,(x, y)\right)
114
+ sage: type(X)
115
+ <class 'sage.manifolds.differentiable.chart.DiffChart'>
116
+
117
+ To manipulate the coordinates `(x,y)` as global variables, one has to set::
118
+
119
+ sage: x,y = X[:]
120
+
121
+ However, a shortcut is to use the declarator ``<x,y>`` in the left-hand
122
+ side of the chart declaration (there is then no need to pass the string
123
+ ``'x y'`` to ``chart()``)::
124
+
125
+ sage: M = Manifold(2, 'M', field='complex')
126
+ sage: X.<x,y> = M.chart(); X
127
+ Chart (M, (x, y))
128
+
129
+ The coordinates are then immediately accessible::
130
+
131
+ sage: y
132
+ y
133
+ sage: x is X[0] and y is X[1]
134
+ True
135
+
136
+ The trick is performed by Sage preparser::
137
+
138
+ sage: preparse("X.<x,y> = M.chart()")
139
+ "X = M.chart(names=('x', 'y',)); (x, y,) = X._first_ngens(2)"
140
+
141
+ Note that ``x`` and ``y`` declared in ``<x,y>`` are mere Python variable
142
+ names and do not have to coincide with the coordinate symbols;
143
+ for instance, one may write::
144
+
145
+ sage: M = Manifold(2, 'M', field='complex')
146
+ sage: X.<x1,y1> = M.chart('x y'); X
147
+ Chart (M, (x, y))
148
+
149
+ Then ``y`` is not known as a global Python variable and the
150
+ coordinate `y` is accessible only through the global variable ``y1``::
151
+
152
+ sage: y1
153
+ y
154
+ sage: latex(y1)
155
+ y
156
+ sage: y1 is X[1]
157
+ True
158
+
159
+ However, having the name of the Python variable coincide with the
160
+ coordinate symbol is quite convenient; so it is recommended to declare::
161
+
162
+ sage: M = Manifold(2, 'M', field='complex')
163
+ sage: X.<x,y> = M.chart()
164
+
165
+ In the above example, the chart X covers entirely the manifold M::
166
+
167
+ sage: X.domain()
168
+ 2-dimensional complex manifold M
169
+
170
+ Of course, one may declare a chart only on an open subset of M::
171
+
172
+ sage: U = M.open_subset('U')
173
+ sage: Y.<z1, z2> = U.chart(r'z1:\zeta_1 z2:\zeta_2'); Y
174
+ Chart (U, (z1, z2))
175
+ sage: Y.domain()
176
+ Open subset U of the 2-dimensional complex manifold M
177
+
178
+ In the above declaration, we have also specified some LaTeX writing
179
+ of the coordinates different from the text one::
180
+
181
+ sage: latex(z1)
182
+ {\zeta_1}
183
+
184
+ Note the prefix ``r`` in front of the string ``r'z1:\zeta_1 z2:\zeta_2'``;
185
+ it makes sure that the backslash character is treated as an ordinary
186
+ character, to be passed to the LaTeX interpreter.
187
+
188
+ Periodic coordinates are declared through the keyword ``period=`` in the
189
+ coordinate field::
190
+
191
+ sage: N = Manifold(2, 'N', field='complex')
192
+ sage: XN.<Z1,Z2> = N.chart('Z1:period=1+2*I Z2')
193
+ sage: XN.periods()
194
+ (2*I + 1, None)
195
+
196
+ Coordinates are Sage symbolic variables (see
197
+ :mod:`sage.symbolic.expression`)::
198
+
199
+ sage: type(z1)
200
+ <class 'sage.symbolic.expression.Expression'>
201
+
202
+ In addition to the Python variable name provided in the operator ``<.,.>``,
203
+ the coordinates are accessible by their indices::
204
+
205
+ sage: Y[0], Y[1]
206
+ (z1, z2)
207
+
208
+ The index range is that declared during the creation of the manifold. By
209
+ default, it starts at 0, but this can be changed via the parameter
210
+ ``start_index``::
211
+
212
+ sage: M1 = Manifold(2, 'M_1', field='complex', start_index=1)
213
+ sage: Z.<u,v> = M1.chart()
214
+ sage: Z[1], Z[2]
215
+ (u, v)
216
+
217
+ The full set of coordinates is obtained by means of the operator
218
+ ``[:]``::
219
+
220
+ sage: Y[:]
221
+ (z1, z2)
222
+
223
+ Each constructed chart is automatically added to the manifold's user
224
+ atlas::
225
+
226
+ sage: M.atlas()
227
+ [Chart (M, (x, y)), Chart (U, (z1, z2))]
228
+
229
+ and to the atlas of the chart's domain::
230
+
231
+ sage: U.atlas()
232
+ [Chart (U, (z1, z2))]
233
+
234
+ Manifold subsets have a *default chart*, which, unless changed via the
235
+ method
236
+ :meth:`~sage.manifolds.manifold.TopologicalManifold.set_default_chart`,
237
+ is the first defined chart on the subset (or on a open subset of it)::
238
+
239
+ sage: M.default_chart()
240
+ Chart (M, (x, y))
241
+ sage: U.default_chart()
242
+ Chart (U, (z1, z2))
243
+
244
+ The default charts are not privileged charts on the manifold, but rather
245
+ charts whose name can be skipped in the argument list of functions having
246
+ an optional ``chart=`` argument.
247
+
248
+ The action of the chart map `\varphi` on a point is obtained by means of
249
+ the call operator, i.e. the operator ``()``::
250
+
251
+ sage: p = M.point((1+i, 2), chart=X); p
252
+ Point on the 2-dimensional complex manifold M
253
+ sage: X(p)
254
+ (I + 1, 2)
255
+ sage: X(p) == p.coord(X)
256
+ True
257
+
258
+ A vector frame is naturally associated to each chart::
259
+
260
+ sage: X.frame()
261
+ Coordinate frame (M, (∂/∂x,∂/∂y))
262
+ sage: Y.frame()
263
+ Coordinate frame (U, (∂/∂z1,∂/∂z2))
264
+
265
+ as well as a dual frame (basis of 1-forms)::
266
+
267
+ sage: X.coframe()
268
+ Coordinate coframe (M, (dx,dy))
269
+ sage: Y.coframe()
270
+ Coordinate coframe (U, (dz1,dz2))
271
+
272
+ .. SEEALSO::
273
+
274
+ :class:`~sage.manifolds.differentiable.chart.RealDiffChart` for charts
275
+ on differentiable manifolds over `\RR`.
276
+ """
277
+ def __init__(self, domain, coordinates, calc_method=None, periods=None, coord_restrictions=None):
278
+ r"""
279
+ Construct a chart.
280
+
281
+ TESTS::
282
+
283
+ sage: M = Manifold(2, 'M', field='complex')
284
+ sage: X.<x,y> = M.chart()
285
+ sage: X
286
+ Chart (M, (x, y))
287
+ sage: type(X)
288
+ <class 'sage.manifolds.differentiable.chart.DiffChart'>
289
+ sage: assumptions() # no assumptions on x,y set by X._init_coordinates
290
+ []
291
+ sage: TestSuite(X).run()
292
+ """
293
+ super().__init__(domain, coordinates, calc_method=calc_method,
294
+ periods=periods, coord_restrictions=coord_restrictions)
295
+ # Construction of the coordinate frame associated to the chart:
296
+ self._frame = CoordFrame(self)
297
+ self._coframe = self._frame._coframe
298
+
299
+ def transition_map(self, other, transformations, intersection_name=None,
300
+ restrictions1=None, restrictions2=None):
301
+ r"""
302
+ Construct the transition map between the current chart,
303
+ `(U,\varphi)` say, and another one, `(V,\psi)` say.
304
+
305
+ If `n` is the manifold's dimension, the *transition map* is the
306
+ map
307
+
308
+ .. MATH::
309
+
310
+ \psi\circ\varphi^{-1}: \varphi(U\cap V) \subset K^n
311
+ \rightarrow \psi(U\cap V) \subset K^n,
312
+
313
+ where `K` is the manifold's base field. In other words, the
314
+ transition map expresses the coordinates `(y^1,\ldots,y^n)` of
315
+ `(V,\psi)` in terms of the coordinates `(x^1,\ldots,x^n)` of
316
+ `(U,\varphi)` on the open subset where the two charts intersect, i.e.
317
+ on `U\cap V`.
318
+
319
+ By definition, the transition map `\psi\circ\varphi^{-1}` must be
320
+ of class `C^k`, where `k` is the degree of differentiability of the
321
+ manifold (cf.
322
+ :meth:`~sage.manifolds.differentiable.manifold.DifferentiableManifold.diff_degree`).
323
+
324
+ INPUT:
325
+
326
+ - ``other`` -- the chart `(V,\psi)`
327
+ - ``transformations`` -- tuple (or list) `(Y_1,\ldots,Y_2)`, where
328
+ `Y_i` is the symbolic expression of the coordinate `y^i` in terms
329
+ of the coordinates `(x^1,\ldots,x^n)`
330
+ - ``intersection_name`` -- (default: ``None``) name to be given to the
331
+ subset `U\cap V` if the latter differs from `U` or `V`
332
+ - ``restrictions1`` -- (default: ``None``) list of conditions on the
333
+ coordinates of the current chart that define `U\cap V` if the
334
+ latter differs from `U`. ``restrictions1`` must be a list of
335
+ of symbolic equalities or inequalities involving the
336
+ coordinates, such as x>y or x^2+y^2 != 0. The items of the list
337
+ ``restrictions1`` are combined with the ``and`` operator; if some
338
+ restrictions are to be combined with the ``or`` operator instead,
339
+ they have to be passed as a tuple in some single item of the list
340
+ ``restrictions1``. For example, ``restrictions1`` = [x>y,
341
+ (x!=0, y!=0), z^2<x] means (x>y) and ((x!=0) or (y!=0)) and (z^2<x).
342
+ If the list ``restrictions1`` contains only one item, this item can
343
+ be passed as such, i.e. writing x>y instead of the single-element
344
+ list [x>y].
345
+ - ``restrictions2`` -- (default: ``None``) list of conditions on the
346
+ coordinates of the chart `(V,\psi)` that define `U\cap V` if the
347
+ latter differs from `V` (see ``restrictions1`` for the syntax)
348
+
349
+ OUTPUT:
350
+
351
+ - The transition map `\psi\circ\varphi^{-1}` defined on `U\cap V`, as an
352
+ instance of :class:`DiffCoordChange`.
353
+
354
+ EXAMPLES:
355
+
356
+ Transition map between two stereographic charts on the circle `S^1`::
357
+
358
+ sage: M = Manifold(1, 'S^1')
359
+ sage: U = M.open_subset('U') # Complement of the North pole
360
+ sage: cU.<x> = U.chart() # Stereographic chart from the North pole
361
+ sage: V = M.open_subset('V') # Complement of the South pole
362
+ sage: cV.<y> = V.chart() # Stereographic chart from the South pole
363
+ sage: M.declare_union(U,V) # S^1 is the union of U and V
364
+ sage: trans = cU.transition_map(cV, 1/x, intersection_name='W',
365
+ ....: restrictions1= x!=0, restrictions2 = y!=0)
366
+ sage: trans
367
+ Change of coordinates from Chart (W, (x,)) to Chart (W, (y,))
368
+ sage: trans.display()
369
+ y = 1/x
370
+
371
+ The subset `W`, intersection of `U` and `V`, has been created by
372
+ ``transition_map()``::
373
+
374
+ sage: F = M.subset_family(); F
375
+ Set {S^1, U, V, W} of open subsets of the 1-dimensional differentiable manifold S^1
376
+ sage: W = F['W']
377
+ sage: W is U.intersection(V)
378
+ True
379
+ sage: M.atlas()
380
+ [Chart (U, (x,)), Chart (V, (y,)), Chart (W, (x,)), Chart (W, (y,))]
381
+
382
+ Transition map between the polar chart and the Cartesian one on
383
+ `\RR^2`::
384
+
385
+ sage: M = Manifold(2, 'R^2')
386
+ sage: c_cart.<x,y> = M.chart()
387
+ sage: U = M.open_subset('U') # the complement of the half line {y=0, x >= 0}
388
+ sage: c_spher.<r,phi> = U.chart(r'r:(0,+oo) phi:(0,2*pi):\phi')
389
+ sage: trans = c_spher.transition_map(c_cart, (r*cos(phi), r*sin(phi)),
390
+ ....: restrictions2=(y!=0, x<0))
391
+ sage: trans
392
+ Change of coordinates from Chart (U, (r, phi)) to Chart (U, (x, y))
393
+ sage: trans.display()
394
+ x = r*cos(phi)
395
+ y = r*sin(phi)
396
+
397
+ In this case, no new subset has been created since `U\cap M = U`::
398
+
399
+ sage: M.subset_family()
400
+ Set {R^2, U} of open subsets of the 2-dimensional differentiable manifold R^2
401
+
402
+ but a new chart has been created: `(U, (x, y))`::
403
+
404
+ sage: M.atlas()
405
+ [Chart (R^2, (x, y)), Chart (U, (r, phi)), Chart (U, (x, y))]
406
+ """
407
+ dom1 = self.domain()
408
+ dom2 = other.domain()
409
+ dom = dom1.intersection(dom2, name=intersection_name)
410
+ if dom is dom1:
411
+ chart1 = self
412
+ else:
413
+ chart1 = self.restrict(dom, restrictions1)
414
+ if dom is dom2:
415
+ chart2 = other
416
+ else:
417
+ chart2 = other.restrict(dom, restrictions2)
418
+ if not isinstance(transformations, (tuple, list)):
419
+ transformations = [transformations]
420
+ return DiffCoordChange(chart1, chart2, *transformations)
421
+
422
+ def frame(self):
423
+ r"""
424
+ Return the vector frame (coordinate frame) associated with ``self``.
425
+
426
+ OUTPUT:
427
+
428
+ - a :class:`~sage.manifolds.differentiable.vectorframe.CoordFrame`
429
+ representing the coordinate frame
430
+
431
+ EXAMPLES:
432
+
433
+ Coordinate frame associated with some chart on a 2-dimensional
434
+ manifold::
435
+
436
+ sage: M = Manifold(2, 'M')
437
+ sage: c_xy.<x,y> = M.chart()
438
+ sage: c_xy.frame()
439
+ Coordinate frame (M, (∂/∂x,∂/∂y))
440
+ sage: type(c_xy.frame())
441
+ <class 'sage.manifolds.differentiable.vectorframe.CoordFrame_with_category'>
442
+
443
+ Check that ``c_xy.frame()`` is indeed the coordinate frame associated
444
+ with the coordinates `(x,y)`::
445
+
446
+ sage: ex = c_xy.frame()[0] ; ex
447
+ Vector field ∂/∂x on the 2-dimensional differentiable manifold M
448
+ sage: ey = c_xy.frame()[1] ; ey
449
+ Vector field ∂/∂y on the 2-dimensional differentiable manifold M
450
+ sage: ex(M.scalar_field(x)).display()
451
+ 1: M → ℝ
452
+ (x, y) ↦ 1
453
+ sage: ex(M.scalar_field(y)).display()
454
+ zero: M → ℝ
455
+ (x, y) ↦ 0
456
+ sage: ey(M.scalar_field(x)).display()
457
+ zero: M → ℝ
458
+ (x, y) ↦ 0
459
+ sage: ey(M.scalar_field(y)).display()
460
+ 1: M → ℝ
461
+ (x, y) ↦ 1
462
+ """
463
+ return self._frame
464
+
465
+ def coframe(self):
466
+ r"""
467
+ Return the coframe (basis of coordinate differentials) associated
468
+ with ``self``.
469
+
470
+ OUTPUT:
471
+
472
+ - a :class:`~sage.manifolds.differentiable.vectorframe.CoordCoFrame`
473
+ representing the coframe
474
+
475
+ EXAMPLES:
476
+
477
+ Coordinate coframe associated with some chart on a 2-dimensional
478
+ manifold::
479
+
480
+ sage: M = Manifold(2, 'M')
481
+ sage: c_xy.<x,y> = M.chart()
482
+ sage: c_xy.coframe()
483
+ Coordinate coframe (M, (dx,dy))
484
+ sage: type(c_xy.coframe())
485
+ <class 'sage.manifolds.differentiable.vectorframe.CoordCoFrame_with_category'>
486
+
487
+ Check that ``c_xy.coframe()`` is indeed the coordinate coframe
488
+ associated with the coordinates `(x, y)`::
489
+
490
+ sage: dx = c_xy.coframe()[0] ; dx
491
+ 1-form dx on the 2-dimensional differentiable manifold M
492
+ sage: dy = c_xy.coframe()[1] ; dy
493
+ 1-form dy on the 2-dimensional differentiable manifold M
494
+ sage: ex = c_xy.frame()[0] ; ex
495
+ Vector field ∂/∂x on the 2-dimensional differentiable manifold M
496
+ sage: ey = c_xy.frame()[1] ; ey
497
+ Vector field ∂/∂y on the 2-dimensional differentiable manifold M
498
+ sage: dx(ex).display()
499
+ dx(∂/∂x): M → ℝ
500
+ (x, y) ↦ 1
501
+ sage: dx(ey).display()
502
+ dx(∂/∂y): M → ℝ
503
+ (x, y) ↦ 0
504
+ sage: dy(ex).display()
505
+ dy(∂/∂x): M → ℝ
506
+ (x, y) ↦ 0
507
+ sage: dy(ey).display()
508
+ dy(∂/∂y): M → ℝ
509
+ (x, y) ↦ 1
510
+ """
511
+ return self._coframe
512
+
513
+ def restrict(self, subset, restrictions=None):
514
+ r"""
515
+ Return the restriction of ``self`` to some subset.
516
+
517
+ If the current chart is `(U, \varphi)`, a *restriction* (or
518
+ *subchart*) is a chart `(V, \psi)` such that `V \subset U`
519
+ and `\psi = \varphi |_V`.
520
+
521
+ If such subchart has not been defined yet, it is constructed here.
522
+
523
+ The coordinates of the subchart bare the same names as the
524
+ coordinates of the original chart.
525
+
526
+ INPUT:
527
+
528
+ - ``subset`` -- open subset `V` of the chart domain `U`
529
+ - ``restrictions`` -- (default: ``None``) list of coordinate
530
+ restrictions defining the subset `V`
531
+
532
+ A restriction can be any symbolic equality or inequality involving
533
+ the coordinates, such as ``x > y`` or ``x^2 + y^2 != 0``. The items
534
+ of the list ``restrictions`` are combined with the ``and`` operator;
535
+ if some restrictions are to be combined with the ``or`` operator
536
+ instead, they have to be passed as a tuple in some single item
537
+ of the list ``restrictions``. For example::
538
+
539
+ restrictions = [x > y, (x != 0, y != 0), z^2 < x]
540
+
541
+ means ``(x > y) and ((x != 0) or (y != 0)) and (z^2 < x)``.
542
+ If the list ``restrictions`` contains only one item, this
543
+ item can be passed as such, i.e. writing ``x > y`` instead
544
+ of the single element list ``[x > y]``.
545
+
546
+ OUTPUT:
547
+
548
+ - a :class:`DiffChart` `(V, \psi)`
549
+
550
+ EXAMPLES:
551
+
552
+ Coordinates on the unit open ball of `\CC^2` as a subchart
553
+ of the global coordinates of `\CC^2`::
554
+
555
+ sage: M = Manifold(2, 'C^2', field='complex')
556
+ sage: X.<z1, z2> = M.chart()
557
+ sage: B = M.open_subset('B')
558
+ sage: X_B = X.restrict(B, abs(z1)^2 + abs(z2)^2 < 1); X_B
559
+ Chart (B, (z1, z2))
560
+ """
561
+ if subset == self.domain():
562
+ return self
563
+ if subset not in self._dom_restrict:
564
+ resu = Chart.restrict(self, subset, restrictions=restrictions)
565
+ # Update of superframes and subframes:
566
+ resu._frame._superframes.update(self._frame._superframes)
567
+ for sframe in self._frame._superframes:
568
+ sframe._subframes.add(resu._frame)
569
+ sframe._restrictions[subset] = resu._frame
570
+ # The subchart frame is not a "top frame" in the supersets
571
+ # (including self.domain()):
572
+ for dom in self.domain().open_supersets():
573
+ if resu._frame in dom._top_frames:
574
+ # it was added by the Chart constructor invoked in
575
+ # Chart.restrict above
576
+ dom._top_frames.remove(resu._frame)
577
+ return self._dom_restrict[subset]
578
+
579
+ def symbolic_velocities(self, left='D', right=None):
580
+ r"""
581
+ Return a list of symbolic variables ready to be used by the
582
+ user as the derivatives of the coordinate functions with respect
583
+ to a curve parameter (i.e. the velocities along the curve).
584
+ It may actually serve to denote anything else than velocities,
585
+ with a name including the coordinate functions.
586
+ The choice of strings provided as 'left' and 'right' arguments
587
+ is not entirely free since it must comply with Python
588
+ prescriptions.
589
+
590
+ INPUT:
591
+
592
+ - ``left`` -- (default: ``D``) string to concatenate to the left
593
+ of each coordinate functions of the chart
594
+ - ``right`` -- (default: ``None``) string to concatenate to the
595
+ right of each coordinate functions of the chart
596
+
597
+ OUTPUT: list of symbolic expressions with the desired names
598
+
599
+ EXAMPLES:
600
+
601
+ Symbolic derivatives of the Cartesian coordinates of the
602
+ 3-dimensional Euclidean space::
603
+
604
+ sage: R3 = Manifold(3, 'R3', start_index=1)
605
+ sage: cart.<X,Y,Z> = R3.chart()
606
+ sage: D = cart.symbolic_velocities(); D
607
+ [DX, DY, DZ]
608
+ sage: D = cart.symbolic_velocities(left='d', right='/dt'); D
609
+ Traceback (most recent call last):
610
+ ...
611
+ ValueError: The name "dX/dt" is not a valid Python
612
+ identifier.
613
+ sage: D = cart.symbolic_velocities(left='d', right='_dt'); D
614
+ [dX_dt, dY_dt, dZ_dt]
615
+ sage: D = cart.symbolic_velocities(left='', right="'"); D
616
+ Traceback (most recent call last):
617
+ ...
618
+ ValueError: The name "X'" is not a valid Python
619
+ identifier.
620
+ sage: D = cart.symbolic_velocities(left='', right='_dot'); D
621
+ [X_dot, Y_dot, Z_dot]
622
+ sage: R.<t> = manifolds.RealLine()
623
+ sage: canon_chart = R.default_chart()
624
+ sage: D = canon_chart.symbolic_velocities() ; D
625
+ [Dt]
626
+ """
627
+
628
+ from sage.symbolic.ring import var
629
+
630
+ # The case len(self[:]) = 1 is treated apart due to the
631
+ # following fact.
632
+ # In the case of several coordinates, the argument of 'var' (as
633
+ # implemented below after the case len(self[:]) = 1) is a list
634
+ # of strings of the form ['Dx1', 'Dx2', ...] and not a unique
635
+ # string of the form 'Dx1 Dx2 ...'.
636
+ # Although 'var' is supposed to accept both syntaxes, the first
637
+ # one causes an error when it contains only one argument, due to
638
+ # line 784 of sage/symbolic/ring.pyx :
639
+ # "return self.symbol(name, latex_name=formatted_latex_name, domain=domain)"
640
+ # In this line, the first argument 'name' of 'symbol' is a list
641
+ # and not a string if the argument of 'var' is a list of one
642
+ # string (of the type ['Dt']), which causes error in 'symbol'.
643
+ # This might be corrected.
644
+ if len(self[:]) == 1:
645
+ string_vel = left + format(self[:][0]) # will raise an error
646
+ # in case left is not a string
647
+ if right is not None:
648
+ string_vel += right # will raise an error in case right
649
+ # is not a string
650
+
651
+ # If the argument of 'var' contains only one word, for
652
+ # instance::
653
+ # var('Dt')
654
+ # then 'var' does not return a tuple containing one symbolic
655
+ # expression, but the symbolic expression itself.
656
+ # This is taken into account below in order to return a list
657
+ # containing one symbolic expression.
658
+ return [var(string_vel)]
659
+
660
+ list_strings_velocities = [left + format(coord_func)
661
+ for coord_func in self[:]] # will
662
+ # raise an error in case left is not a string
663
+
664
+ if right is not None:
665
+ list_strings_velocities = [str_vel + right for str_vel
666
+ in list_strings_velocities] # will
667
+ # raise an error in case right is not a string
668
+
669
+ return list(var(list_strings_velocities))
670
+
671
+
672
+ #*****************************************************************************
673
+
674
+ class RealDiffChart(DiffChart, RealChart):
675
+ r"""
676
+ Chart on a differentiable manifold over `\RR`.
677
+
678
+ Given a differentiable manifold `M` of dimension `n` over `\RR`,
679
+ a *chart* is a member `(U,\varphi)` of the manifold's
680
+ differentiable atlas; `U` is then an open subset of `M` and
681
+ `\varphi: U \rightarrow V \subset \RR^n` is a homeomorphism from
682
+ `U` to an open subset `V` of `\RR^n`.
683
+
684
+ The components `(x^1,\ldots,x^n)` of `\varphi`, defined by
685
+ `\varphi(p) = (x^1(p),\ldots,x^n(p))\in \RR^n` for any point `p\in U`, are
686
+ called the *coordinates* of the chart `(U,\varphi)`.
687
+
688
+ INPUT:
689
+
690
+ - ``domain`` -- open subset `U` on which the chart is defined
691
+ - ``coordinates`` -- (default: '' (empty string)) single string defining
692
+ the coordinate symbols, with ``' '`` (whitespace) as a separator; each
693
+ item has at most four fields, separated by a colon (``:``):
694
+
695
+ 1. the coordinate symbol (a letter or a few letters)
696
+ 2. (optional) the interval `I` defining the coordinate range: if not
697
+ provided, the coordinate is assumed to span all `\RR`; otherwise
698
+ `I` must be provided in the form ``(a,b)`` (or equivalently
699
+ ``]a,b[``); the bounds ``a`` and ``b`` can be ``+/-Infinity``,
700
+ ``Inf``, ``infinity``, ``inf`` or ``oo``; for *singular*
701
+ coordinates, non-open intervals such as ``[a,b]`` and ``(a,b]``
702
+ (or equivalently ``]a,b]``) are allowed; note that the interval
703
+ declaration must not contain any whitespace
704
+ 3. (optional) indicator of the periodic character of the coordinate,
705
+ either as ``period=T``, where ``T`` is the period, or as the keyword
706
+ ``periodic`` (the value of the period is then deduced from the
707
+ interval `I` declared in field 2; see examples below)
708
+ 4. (optional) the LaTeX spelling of the coordinate; if not provided the
709
+ coordinate symbol given in the first field will be used
710
+
711
+ The order of fields 2 to 4 does not matter and each of them can be
712
+ omitted. If it contains any LaTeX expression, the string ``coordinates``
713
+ must be declared with the prefix 'r' (for "raw") to allow for a proper
714
+ treatment of LaTeX's backslash character (see examples below).
715
+ If interval range, no period and no LaTeX spelling are to be set for any
716
+ coordinate, the argument ``coordinates`` can be omitted when the shortcut
717
+ operator ``<,>`` is used to declare the chart (see examples below).
718
+ - ``calc_method`` -- (default: ``None``) string defining the calculus
719
+ method for computations involving coordinates of the chart; must be
720
+ one of
721
+
722
+ - ``'SR'`` -- Sage's default symbolic engine (Symbolic Ring)
723
+ - ``'sympy'`` -- SymPy
724
+ - ``None`` -- the default of :class:`~sage.manifolds.calculus_method.CalculusMethod`
725
+ will be used
726
+ - ``names`` -- (default: ``None``) unused argument, except if
727
+ ``coordinates`` is not provided; it must then be a tuple containing
728
+ the coordinate symbols (this is guaranteed if the shortcut operator
729
+ ``<,>`` is used).
730
+ - ``coord_restrictions`` -- additional restrictions on the coordinates.
731
+ A restriction can be any symbolic equality or inequality involving
732
+ the coordinates, such as ``x > y`` or ``x^2 + y^2 != 0``. The items
733
+ of the list (or set or frozenset) ``coord_restrictions`` are combined
734
+ with the ``and`` operator; if some restrictions are to be combined with
735
+ the ``or`` operator instead, they have to be passed as a tuple in some
736
+ single item of the list (or set or frozenset) ``coord_restrictions``.
737
+ For example::
738
+
739
+ coord_restrictions=[x > y, (x != 0, y != 0), z^2 < x]
740
+
741
+ means ``(x > y) and ((x != 0) or (y != 0)) and (z^2 < x)``.
742
+ If the list ``coord_restrictions`` contains only one item, this
743
+ item can be passed as such, i.e. writing ``x > y`` instead
744
+ of the single element list ``[x > y]``. If the chart variables have
745
+ not been declared as variables yet, ``coord_restrictions`` must
746
+ be ``lambda``-quoted.
747
+
748
+ EXAMPLES:
749
+
750
+ Cartesian coordinates on `\RR^3`::
751
+
752
+ sage: M = Manifold(3, 'R^3', r'\RR^3', start_index=1)
753
+ sage: c_cart = M.chart('x y z'); c_cart
754
+ Chart (R^3, (x, y, z))
755
+ sage: type(c_cart)
756
+ <class 'sage.manifolds.differentiable.chart.RealDiffChart'>
757
+
758
+ To have the coordinates accessible as global variables, one has to set::
759
+
760
+ sage: (x,y,z) = c_cart[:]
761
+
762
+ However, a shortcut is to use the declarator ``<x,y,z>`` in the left-hand
763
+ side of the chart declaration (there is then no need to pass the string
764
+ ``'x y z'`` to ``chart()``)::
765
+
766
+ sage: M = Manifold(3, 'R^3', r'\RR^3', start_index=1)
767
+ sage: c_cart.<x,y,z> = M.chart(); c_cart
768
+ Chart (R^3, (x, y, z))
769
+
770
+ The coordinates are then immediately accessible::
771
+
772
+ sage: y
773
+ y
774
+ sage: y is c_cart[2]
775
+ True
776
+
777
+ The trick is performed by Sage preparser::
778
+
779
+ sage: preparse("c_cart.<x,y,z> = M.chart()")
780
+ "c_cart = M.chart(names=('x', 'y', 'z',)); (x, y, z,) = c_cart._first_ngens(3)"
781
+
782
+ Note that ``x, y, z`` declared in ``<x,y,z>`` are mere Python variable
783
+ names and do not have to coincide with the coordinate symbols; for instance,
784
+ one may write::
785
+
786
+ sage: M = Manifold(3, 'R^3', r'\RR^3', start_index=1)
787
+ sage: c_cart.<x1,y1,z1> = M.chart('x y z'); c_cart
788
+ Chart (R^3, (x, y, z))
789
+
790
+ Then ``y`` is not known as a global variable and the coordinate `y`
791
+ is accessible only through the global variable ``y1``::
792
+
793
+ sage: y1
794
+ y
795
+ sage: y1 is c_cart[2]
796
+ True
797
+
798
+ However, having the name of the Python variable coincide with the
799
+ coordinate symbol is quite convenient; so it is recommended to declare::
800
+
801
+ sage: forget() # for doctests only
802
+ sage: M = Manifold(3, 'R^3', r'\RR^3', start_index=1)
803
+ sage: c_cart.<x,y,z> = M.chart()
804
+
805
+ Spherical coordinates on the subset `U` of `\RR^3` that is the
806
+ complement of the half-plane `\{y=0, x\geq 0\}`::
807
+
808
+ sage: U = M.open_subset('U')
809
+ sage: c_spher.<r,th,ph> = U.chart(r'r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi')
810
+ sage: c_spher
811
+ Chart (U, (r, th, ph))
812
+
813
+ Note the prefix 'r' for the string defining the coordinates in the
814
+ arguments of ``chart``.
815
+
816
+ Coordinates are Sage symbolic variables (see
817
+ :mod:`sage.symbolic.expression`)::
818
+
819
+ sage: type(th)
820
+ <class 'sage.symbolic.expression.Expression'>
821
+ sage: latex(th)
822
+ {\theta}
823
+ sage: assumptions(th)
824
+ [th is real, th > 0, th < pi]
825
+
826
+ Coordinate are also accessible by their indices::
827
+
828
+ sage: x1 = c_spher[1]; x2 = c_spher[2]; x3 = c_spher[3]
829
+ sage: [x1, x2, x3]
830
+ [r, th, ph]
831
+ sage: (x1, x2, x3) == (r, th, ph)
832
+ True
833
+
834
+ The full set of coordinates is obtained by means of the operator [:]::
835
+
836
+ sage: c_cart[:]
837
+ (x, y, z)
838
+ sage: c_spher[:]
839
+ (r, th, ph)
840
+
841
+ Let us check that the declared coordinate ranges have been taken into
842
+ account::
843
+
844
+ sage: c_cart.coord_range()
845
+ x: (-oo, +oo); y: (-oo, +oo); z: (-oo, +oo)
846
+ sage: c_spher.coord_range()
847
+ r: (0, +oo); th: (0, pi); ph: (0, 2*pi)
848
+ sage: bool(th>0 and th<pi)
849
+ True
850
+ sage: assumptions() # list all current symbolic assumptions
851
+ [x is real, y is real, z is real, r is real, r > 0, th is real,
852
+ th > 0, th < pi, ph is real, ph > 0, ph < 2*pi]
853
+
854
+ The coordinate ranges are used for simplifications::
855
+
856
+ sage: simplify(abs(r)) # r has been declared to lie in the interval (0,+oo)
857
+ r
858
+ sage: simplify(abs(x)) # no positive range has been declared for x
859
+ abs(x)
860
+
861
+ A coordinate can be declared periodic by adding the keyword ``periodic``
862
+ to its range::
863
+
864
+ sage: V = M.open_subset('V')
865
+ sage: c_spher1.<r,th,ph1> = \
866
+ ....: V.chart(r'r:(0,+oo) th:(0,pi):\theta ph1:(0,2*pi):periodic:\phi_1')
867
+ sage: c_spher1.periods()
868
+ (None, None, 2*pi)
869
+ sage: c_spher1.coord_range()
870
+ r: (0, +oo); th: (0, pi); ph1: [0, 2*pi] (periodic)
871
+
872
+ It is equivalent to give the period as ``period=2*pi``, skipping the
873
+ coordinate range::
874
+
875
+ sage: c_spher2.<r,th,ph2> = \
876
+ ....: V.chart(r'r:(0,+oo) th:(0,pi):\theta ph2:period=2*pi:\phi_2')
877
+ sage: c_spher2.periods()
878
+ (None, None, 2*pi)
879
+ sage: c_spher2.coord_range()
880
+ r: (0, +oo); th: (0, pi); ph2: [0, 2*pi] (periodic)
881
+
882
+ Each constructed chart is automatically added to the manifold's
883
+ user atlas::
884
+
885
+ sage: M.atlas()
886
+ [Chart (R^3, (x, y, z)), Chart (U, (r, th, ph)),
887
+ Chart (V, (r, th, ph1)), Chart (V, (r, th, ph2))]
888
+
889
+ and to the atlas of its domain::
890
+
891
+ sage: U.atlas()
892
+ [Chart (U, (r, th, ph))]
893
+
894
+ Manifold subsets have a *default chart*, which, unless changed via the
895
+ method
896
+ :meth:`~sage.manifolds.manifold.TopologicalManifold.set_default_chart`,
897
+ is the first defined chart on the subset (or on a open subset of it)::
898
+
899
+ sage: M.default_chart()
900
+ Chart (R^3, (x, y, z))
901
+ sage: U.default_chart()
902
+ Chart (U, (r, th, ph))
903
+
904
+ The default charts are not privileged charts on the manifold, but rather
905
+ charts whose name can be skipped in the argument list of functions having
906
+ an optional ``chart=`` argument.
907
+
908
+ The action of the chart map `\varphi` on a point is obtained by means of
909
+ the call operator, i.e. the operator ``()``::
910
+
911
+ sage: p = M.point((1,0,-2)); p
912
+ Point on the 3-dimensional differentiable manifold R^3
913
+ sage: c_cart(p)
914
+ (1, 0, -2)
915
+ sage: c_cart(p) == p.coord(c_cart)
916
+ True
917
+ sage: q = M.point((2,pi/2,pi/3), chart=c_spher) # point defined by its spherical coordinates
918
+ sage: c_spher(q)
919
+ (2, 1/2*pi, 1/3*pi)
920
+ sage: c_spher(q) == q.coord(c_spher)
921
+ True
922
+ sage: a = U.point((1,pi/2,pi)) # the default coordinates on U are the spherical ones
923
+ sage: c_spher(a)
924
+ (1, 1/2*pi, pi)
925
+ sage: c_spher(a) == a.coord(c_spher)
926
+ True
927
+
928
+ Cartesian coordinates on `U` as an example of chart construction with
929
+ coordinate restrictions: since `U` is the complement of the half-plane
930
+ `\{y=0, x\geq 0\}`, we must have `y\not=0` or `x<0` on U. Accordingly,
931
+ we set::
932
+
933
+ sage: c_cartU.<x,y,z> = U.chart(coord_restrictions=lambda x,y,z: (y!=0, x<0))
934
+ ....: # the tuple (y!=0, x<0) means y!=0 or x<0
935
+ ....: # [y!=0, x<0] would have meant y!=0 AND x<0
936
+ sage: U.atlas()
937
+ [Chart (U, (r, th, ph)), Chart (U, (x, y, z))]
938
+ sage: M.atlas()
939
+ [Chart (R^3, (x, y, z)), Chart (U, (r, th, ph)),
940
+ Chart (V, (r, th, ph1)), Chart (V, (r, th, ph2)),
941
+ Chart (U, (x, y, z))]
942
+ sage: c_cartU.valid_coordinates(-1,0,2)
943
+ True
944
+ sage: c_cartU.valid_coordinates(1,0,2)
945
+ False
946
+ sage: c_cart.valid_coordinates(1,0,2)
947
+ True
948
+
949
+ A vector frame is naturally associated to each chart::
950
+
951
+ sage: c_cart.frame()
952
+ Coordinate frame (R^3, (∂/∂x,∂/∂y,∂/∂z))
953
+ sage: c_spher.frame()
954
+ Coordinate frame (U, (∂/∂r,∂/∂th,∂/∂ph))
955
+
956
+ as well as a dual frame (basis of 1-forms)::
957
+
958
+ sage: c_cart.coframe()
959
+ Coordinate coframe (R^3, (dx,dy,dz))
960
+ sage: c_spher.coframe()
961
+ Coordinate coframe (U, (dr,dth,dph))
962
+
963
+ Chart grids can be drawn in 2D or 3D graphics thanks to the method
964
+ :meth:`~sage.manifolds.chart.RealChart.plot`.
965
+ """
966
+ def __init__(self, domain, coordinates, calc_method=None,
967
+ bounds=None, periods=None, coord_restrictions=None):
968
+ r"""
969
+ Construct a chart on a real differentiable manifold.
970
+
971
+ TESTS::
972
+
973
+ sage: forget() # for doctests only
974
+ sage: M = Manifold(2, 'M')
975
+ sage: X.<x,y> = M.chart()
976
+ sage: X
977
+ Chart (M, (x, y))
978
+ sage: type(X)
979
+ <class 'sage.manifolds.differentiable.chart.RealDiffChart'>
980
+ sage: assumptions() # assumptions set in X._init_coordinates
981
+ [x is real, y is real]
982
+ sage: TestSuite(X).run()
983
+ """
984
+ RealChart.__init__(self, domain, coordinates, calc_method=calc_method,
985
+ bounds=bounds, periods=periods, coord_restrictions=coord_restrictions)
986
+ # Construction of the coordinate frame associated to the chart:
987
+ self._frame = CoordFrame(self)
988
+ self._coframe = self._frame._coframe
989
+
990
+ def restrict(self, subset, restrictions=None):
991
+ r"""
992
+ Return the restriction of the chart to some subset.
993
+
994
+ If the current chart is `(U, \varphi)`, a *restriction* (or
995
+ *subchart*) is a chart `(V, \psi)` such that `V \subset U`
996
+ and `\psi = \varphi |_V`.
997
+
998
+ If such subchart has not been defined yet, it is constructed here.
999
+
1000
+ The coordinates of the subchart bare the same names as the
1001
+ coordinates of the original chart.
1002
+
1003
+ INPUT:
1004
+
1005
+ - ``subset`` -- open subset `V` of the chart domain `U`
1006
+ - ``restrictions`` -- (default: ``None``) list of coordinate
1007
+ restrictions defining the subset `V`
1008
+
1009
+ A restriction can be any symbolic equality or inequality involving
1010
+ the coordinates, such as ``x > y`` or ``x^2 + y^2 != 0``. The items
1011
+ of the list ``restrictions`` are combined with the ``and`` operator;
1012
+ if some restrictions are to be combined with the ``or`` operator
1013
+ instead, they have to be passed as a tuple in some single item
1014
+ of the list ``restrictions``. For example::
1015
+
1016
+ restrictions = [x > y, (x != 0, y != 0), z^2 < x]
1017
+
1018
+ means ``(x > y) and ((x != 0) or (y != 0)) and (z^2 < x)``.
1019
+ If the list ``restrictions`` contains only one item, this
1020
+ item can be passed as such, i.e. writing ``x > y`` instead
1021
+ of the single element list ``[x > y]``.
1022
+
1023
+ OUTPUT:
1024
+
1025
+ - a :class:`RealDiffChart` `(V, \psi)`
1026
+
1027
+ EXAMPLES:
1028
+
1029
+ Cartesian coordinates on the unit open disc in `\RR^2` as a subchart
1030
+ of the global Cartesian coordinates::
1031
+
1032
+ sage: M = Manifold(2, 'R^2')
1033
+ sage: c_cart.<x,y> = M.chart() # Cartesian coordinates on R^2
1034
+ sage: D = M.open_subset('D') # the unit open disc
1035
+ sage: c_cart_D = c_cart.restrict(D, x^2+y^2<1)
1036
+ sage: p = M.point((1/2, 0))
1037
+ sage: p in D
1038
+ True
1039
+ sage: q = M.point((1, 2))
1040
+ sage: q in D
1041
+ False
1042
+
1043
+ Cartesian coordinates on the annulus `1 < \sqrt{x^2+y^2} < 2`::
1044
+
1045
+ sage: A = M.open_subset('A')
1046
+ sage: c_cart_A = c_cart.restrict(A, [x^2+y^2>1, x^2+y^2<4])
1047
+ sage: p in A, q in A
1048
+ (False, False)
1049
+ sage: a = M.point((3/2,0))
1050
+ sage: a in A
1051
+ True
1052
+ """
1053
+ if subset == self.domain():
1054
+ return self
1055
+ if subset not in self._dom_restrict:
1056
+ resu = RealChart.restrict(self, subset, restrictions=restrictions)
1057
+ # Update of superframes and subframes:
1058
+ resu._frame._superframes.update(self._frame._superframes)
1059
+ for sframe in self._frame._superframes:
1060
+ sframe._subframes.add(resu._frame)
1061
+ sframe._restrictions[subset] = resu._frame
1062
+ # The subchart frame is not a "top frame" in the supersets
1063
+ # (including self.domain()):
1064
+ for dom in self.domain().open_supersets():
1065
+ if resu._frame in dom._top_frames:
1066
+ # it was added by the Chart constructor invoked in
1067
+ # Chart.restrict above
1068
+ dom._top_frames.remove(resu._frame)
1069
+ return self._dom_restrict[subset]
1070
+
1071
+ #******************************************************************************
1072
+
1073
+
1074
+ class DiffCoordChange(CoordChange):
1075
+ r"""
1076
+ Transition map between two charts of a differentiable manifold.
1077
+
1078
+ Giving two coordinate charts `(U,\varphi)` and `(V,\psi)` on a
1079
+ differentiable manifold `M` of dimension `n` over a topological field `K`,
1080
+ the *transition map from* `(U,\varphi)` *to* `(V,\psi)` is the map
1081
+
1082
+ .. MATH::
1083
+
1084
+ \psi\circ\varphi^{-1}: \varphi(U\cap V) \subset K^n
1085
+ \rightarrow \psi(U\cap V) \subset K^n,
1086
+
1087
+ In other words, the transition map `\psi\circ\varphi^{-1}` expresses the
1088
+ coordinates `(y^1,\ldots,y^n)` of `(V,\psi)` in terms of the coordinates
1089
+ `(x^1,\ldots,x^n)` of `(U,\varphi)` on the open subset where the two
1090
+ charts intersect, i.e. on `U\cap V`.
1091
+
1092
+ By definition, the transition map `\psi\circ\varphi^{-1}` must be
1093
+ of class `C^k`, where `k` is the degree of differentiability of the
1094
+ manifold (cf.
1095
+ :meth:`~sage.manifolds.differentiable.manifold.DifferentiableManifold.diff_degree`).
1096
+
1097
+ INPUT:
1098
+
1099
+ - ``chart1`` -- chart `(U,\varphi)`
1100
+ - ``chart2`` -- chart `(V,\psi)`
1101
+ - ``transformations`` -- tuple (or list) `(Y_1,\ldots,Y_2)`, where
1102
+ `Y_i` is the symbolic expression of the coordinate `y^i` in terms
1103
+ of the coordinates `(x^1,\ldots,x^n)`
1104
+
1105
+ EXAMPLES:
1106
+
1107
+ Transition map on a 2-dimensional differentiable manifold::
1108
+
1109
+ sage: M = Manifold(2, 'M')
1110
+ sage: X.<x,y> = M.chart()
1111
+ sage: Y.<u,v> = M.chart()
1112
+ sage: X_to_Y = X.transition_map(Y, [x+y, x-y])
1113
+ sage: X_to_Y
1114
+ Change of coordinates from Chart (M, (x, y)) to Chart (M, (u, v))
1115
+ sage: type(X_to_Y)
1116
+ <class 'sage.manifolds.differentiable.chart.DiffCoordChange'>
1117
+ sage: X_to_Y.display()
1118
+ u = x + y
1119
+ v = x - y
1120
+ """
1121
+ def __init__(self, chart1, chart2, *transformations):
1122
+ r"""
1123
+ Construct a transition map.
1124
+
1125
+ TESTS::
1126
+
1127
+ sage: M = Manifold(2, 'M')
1128
+ sage: X.<x,y> = M.chart()
1129
+ sage: Y.<u,v> = M.chart()
1130
+ sage: X_to_Y = X.transition_map(Y, [x+y, x-y])
1131
+ sage: X_to_Y
1132
+ Change of coordinates from Chart (M, (x, y)) to Chart (M, (u, v))
1133
+ sage: type(X_to_Y)
1134
+ <class 'sage.manifolds.differentiable.chart.DiffCoordChange'>
1135
+ sage: TestSuite(X_to_Y).run(skip='_test_pickling')
1136
+
1137
+ .. TODO::
1138
+
1139
+ fix _test_pickling
1140
+ """
1141
+ CoordChange.__init__(self, chart1, chart2, *transformations)
1142
+ # Jacobian matrix:
1143
+ self._jacobian = self._transf.jacobian()
1144
+ # If the two charts are on the same open subset, the Jacobian matrix is
1145
+ # added to the dictionary of changes of frame:
1146
+ if chart1.domain() == chart2.domain():
1147
+ domain = chart1.domain()
1148
+ frame1 = chart1._frame
1149
+ frame2 = chart2._frame
1150
+ vf_module = domain.vector_field_module()
1151
+ ch_basis = vf_module.automorphism()
1152
+ ch_basis.add_comp(frame1)[:, chart1] = self._jacobian
1153
+ ch_basis.add_comp(frame2)[:, chart1] = self._jacobian
1154
+ vf_module._basis_changes[(frame2, frame1)] = ch_basis
1155
+ for sdom in domain.open_supersets():
1156
+ sdom._frame_changes[(frame2, frame1)] = ch_basis
1157
+ # The inverse is computed only if it does not exist already
1158
+ # (because if it exists it may have a simpler expression than that
1159
+ # obtained from the matrix inverse)
1160
+ if (frame1, frame2) not in vf_module._basis_changes:
1161
+ ch_basis_inv = ch_basis.inverse()
1162
+ vf_module._basis_changes[(frame1, frame2)] = ch_basis_inv
1163
+ for sdom in domain.open_supersets():
1164
+ sdom._frame_changes[(frame1, frame2)] = ch_basis_inv
1165
+
1166
+ def jacobian(self):
1167
+ r"""
1168
+ Return the Jacobian matrix of ``self``.
1169
+
1170
+ If ``self`` corresponds to the change of coordinates
1171
+
1172
+ .. MATH::
1173
+
1174
+ y^i = Y^i(x^1,\ldots,x^n)\qquad 1\leq i \leq n
1175
+
1176
+ the Jacobian matrix `J` is given by
1177
+
1178
+ .. MATH::
1179
+
1180
+ J_{ij} = \frac{\partial Y^i}{\partial x^j}
1181
+
1182
+ where `i` is the row index and `j` the column one.
1183
+
1184
+ OUTPUT:
1185
+
1186
+ - Jacobian matrix `J`, the elements `J_{ij}` of which being
1187
+ coordinate functions
1188
+ (cf. :class:`~sage.manifolds.chart_func.ChartFunction`)
1189
+
1190
+ EXAMPLES:
1191
+
1192
+ Jacobian matrix of a 2-dimensional transition map::
1193
+
1194
+ sage: M = Manifold(2, 'M')
1195
+ sage: X.<x,y> = M.chart()
1196
+ sage: Y.<u,v> = M.chart()
1197
+ sage: X_to_Y = X.transition_map(Y, [x+y^2, 3*x-y])
1198
+ sage: X_to_Y.jacobian()
1199
+ [ 1 2*y]
1200
+ [ 3 -1]
1201
+
1202
+ Each element of the Jacobian matrix is a coordinate function::
1203
+
1204
+ sage: parent(X_to_Y.jacobian()[0,0])
1205
+ Ring of chart functions on Chart (M, (x, y))
1206
+ """
1207
+ return self._jacobian # has been computed in __init__
1208
+
1209
+ @cached_method
1210
+ def jacobian_det(self):
1211
+ r"""
1212
+ Return the Jacobian determinant of ``self``.
1213
+
1214
+ The Jacobian determinant is the determinant of the Jacobian
1215
+ matrix (see :meth:`jacobian`).
1216
+
1217
+ OUTPUT:
1218
+
1219
+ - determinant of the Jacobian matrix `J` as a coordinate
1220
+ function
1221
+ (cf. :class:`~sage.manifolds.chart_func.ChartFunction`)
1222
+
1223
+ EXAMPLES:
1224
+
1225
+ Jacobian determinant of a 2-dimensional transition map::
1226
+
1227
+ sage: M = Manifold(2, 'M')
1228
+ sage: X.<x,y> = M.chart()
1229
+ sage: Y.<u,v> = M.chart()
1230
+ sage: X_to_Y = X.transition_map(Y, [x+y^2, 3*x-y])
1231
+ sage: X_to_Y.jacobian_det()
1232
+ -6*y - 1
1233
+ sage: X_to_Y.jacobian_det() == det(X_to_Y.jacobian())
1234
+ True
1235
+
1236
+ The Jacobian determinant is a coordinate function::
1237
+
1238
+ sage: parent(X_to_Y.jacobian_det())
1239
+ Ring of chart functions on Chart (M, (x, y))
1240
+ """
1241
+ return self._transf.jacobian_det()