passagemath-symbolics 10.8.1a1__cp314-cp314t-musllinux_1_2_aarch64.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.
Files changed (181) hide show
  1. passagemath_symbolics/__init__.py +3 -0
  2. passagemath_symbolics-10.8.1a1.dist-info/METADATA +186 -0
  3. passagemath_symbolics-10.8.1a1.dist-info/RECORD +181 -0
  4. passagemath_symbolics-10.8.1a1.dist-info/WHEEL +5 -0
  5. passagemath_symbolics-10.8.1a1.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 +2838 -0
  9. sage/calculus/desolvers.py +1864 -0
  10. sage/calculus/predefined.py +51 -0
  11. sage/calculus/tests.py +225 -0
  12. sage/calculus/var.cpython-314t-aarch64-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-aarch64-linux-musl.so +0 -0
  18. sage/dynamics/complex_dynamics/mandel_julia_helper.pyx +1034 -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 +755 -0
  33. sage/geometry/hyperbolic_space/hyperbolic_constants.py +5 -0
  34. sage/geometry/hyperbolic_space/hyperbolic_geodesic.py +2419 -0
  35. sage/geometry/hyperbolic_space/hyperbolic_interface.py +206 -0
  36. sage/geometry/hyperbolic_space/hyperbolic_isometry.py +1083 -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 +2991 -0
  44. sage/interfaces/magma_free.py +90 -0
  45. sage/interfaces/maple.py +1402 -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 +553 -0
  54. sage/manifolds/catalog.py +437 -0
  55. sage/manifolds/chart.py +4010 -0
  56. sage/manifolds/chart_func.py +3416 -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 +1668 -0
  70. sage/manifolds/differentiable/diff_form.py +1660 -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 +1522 -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 +912 -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 +1725 -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 +2721 -0
  118. sage/manifolds/subsets/all.py +1 -0
  119. sage/manifolds/subsets/closure.py +131 -0
  120. sage/manifolds/subsets/pullback.py +883 -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 +1347 -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-aarch64-linux-musl.so +0 -0
  129. sage/matrix/matrix_symbolic_dense.pxd +6 -0
  130. sage/matrix/matrix_symbolic_dense.pyx +1030 -0
  131. sage/matrix/matrix_symbolic_sparse.cpython-314t-aarch64-linux-musl.so +0 -0
  132. sage/matrix/matrix_symbolic_sparse.pxd +6 -0
  133. sage/matrix/matrix_symbolic_sparse.pyx +1038 -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 +4106 -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 +5205 -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 +987 -0
  150. sage/symbolic/benchmark.py +93 -0
  151. sage/symbolic/callable.py +456 -0
  152. sage/symbolic/callable.pyi +66 -0
  153. sage/symbolic/comparison_impl.pyi +38 -0
  154. sage/symbolic/complexity_measures.py +35 -0
  155. sage/symbolic/constants.py +1286 -0
  156. sage/symbolic/constants_c_impl.pyi +10 -0
  157. sage/symbolic/expression_conversion_algebraic.py +310 -0
  158. sage/symbolic/expression_conversion_sympy.py +317 -0
  159. sage/symbolic/expression_conversions.py +1727 -0
  160. sage/symbolic/function_factory.py +355 -0
  161. sage/symbolic/function_factory.pyi +41 -0
  162. sage/symbolic/getitem_impl.pyi +24 -0
  163. sage/symbolic/integration/all.py +1 -0
  164. sage/symbolic/integration/external.py +271 -0
  165. sage/symbolic/integration/integral.py +1075 -0
  166. sage/symbolic/maxima_wrapper.py +162 -0
  167. sage/symbolic/operators.py +267 -0
  168. sage/symbolic/operators.pyi +61 -0
  169. sage/symbolic/pynac_constant_impl.pyi +13 -0
  170. sage/symbolic/pynac_function_impl.pyi +8 -0
  171. sage/symbolic/random_tests.py +461 -0
  172. sage/symbolic/relation.py +2062 -0
  173. sage/symbolic/ring.cpython-314t-aarch64-linux-musl.so +0 -0
  174. sage/symbolic/ring.pxd +5 -0
  175. sage/symbolic/ring.pyi +110 -0
  176. sage/symbolic/ring.pyx +1393 -0
  177. sage/symbolic/series_impl.pyi +10 -0
  178. sage/symbolic/subring.py +1025 -0
  179. sage/symbolic/symengine.py +19 -0
  180. sage/symbolic/tests.py +40 -0
  181. sage/symbolic/units.py +1468 -0
@@ -0,0 +1,616 @@
1
+ # sage_setup: distribution = sagemath-symbolics
2
+ r"""
3
+ Tangent Vectors
4
+
5
+ The class :class:`TangentVector` implements tangent vectors to a differentiable
6
+ manifold.
7
+
8
+ AUTHORS:
9
+
10
+ - Eric Gourgoulhon, Michal Bejger (2014-2015): initial version
11
+ - Travis Scrimshaw (2016): review tweaks
12
+
13
+ REFERENCES:
14
+
15
+ - Chap. 3 of [Lee2013]_
16
+ """
17
+
18
+ # *****************************************************************************
19
+ # Copyright (C) 2015 Eric Gourgoulhon <eric.gourgoulhon@obspm.fr>
20
+ # Copyright (C) 2015 Michal Bejger <bejger@camk.edu.pl>
21
+ #
22
+ # Distributed under the terms of the GNU General Public License (GPL)
23
+ # as published by the Free Software Foundation; either version 2 of
24
+ # the License, or (at your option) any later version.
25
+ # https://www.gnu.org/licenses/
26
+ # *****************************************************************************
27
+
28
+ from sage.manifolds.differentiable.scalarfield import DiffScalarField
29
+ from sage.misc.decorators import options
30
+ from sage.tensor.modules.free_module_alt_form import FreeModuleAltForm
31
+ from sage.tensor.modules.free_module_element import FiniteRankFreeModuleElement
32
+
33
+
34
+ class TangentVector(FiniteRankFreeModuleElement):
35
+ r"""
36
+ Tangent vector to a differentiable manifold at a given point.
37
+
38
+ INPUT:
39
+
40
+ - ``parent`` --
41
+ :class:`~sage.manifolds.differentiable.tangent_space.TangentSpace`;
42
+ the tangent space to which the vector belongs
43
+ - ``name`` -- (default: ``None``) string; symbol given to the vector
44
+ - ``latex_name`` -- (default: ``None``) string; LaTeX symbol to denote
45
+ the vector; if ``None``, ``name`` will be used
46
+
47
+ EXAMPLES:
48
+
49
+ A tangent vector `v` on a 2-dimensional manifold::
50
+
51
+ sage: M = Manifold(2, 'M')
52
+ sage: X.<x,y> = M.chart()
53
+ sage: p = M.point((2,3), name='p')
54
+ sage: Tp = M.tangent_space(p)
55
+ sage: v = Tp((-2,1), name='v') ; v
56
+ Tangent vector v at Point p on the 2-dimensional differentiable
57
+ manifold M
58
+ sage: v.display()
59
+ v = -2 ∂/∂x + ∂/∂y
60
+ sage: v.parent()
61
+ Tangent space at Point p on the 2-dimensional differentiable manifold M
62
+ sage: v in Tp
63
+ True
64
+
65
+ Tangent vectors can also be constructed via the manifold method
66
+ :meth:`~sage.manifolds.differentiable.manifold.DifferentiableManifold.tangent_vector`::
67
+
68
+ sage: v = M.tangent_vector(p, (-2, 1), name='v'); v
69
+ Tangent vector v at Point p on the 2-dimensional differentiable
70
+ manifold M
71
+ sage: v.display()
72
+ v = -2 ∂/∂x + ∂/∂y
73
+
74
+ or via the method
75
+ :meth:`~sage.manifolds.differentiable.tensorfield_paral.TensorFieldParal.at`
76
+ of vector fields::
77
+
78
+ sage: vf = M.vector_field(x - 4*y/3, (x-y)^2, name='v')
79
+ sage: v = vf.at(p); v
80
+ Tangent vector v at Point p on the 2-dimensional differentiable
81
+ manifold M
82
+ sage: v.display()
83
+ v = -2 ∂/∂x + ∂/∂y
84
+
85
+ By definition, a tangent vector at `p\in M` is a *derivation at* `p` on
86
+ the space `C^\infty(M)` of smooth scalar fields on `M`. Indeed let us
87
+ consider a generic scalar field `f`::
88
+
89
+ sage: f = M.scalar_field(function('F')(x,y), name='f')
90
+ sage: f.display()
91
+ f: M → ℝ
92
+ (x, y) ↦ F(x, y)
93
+
94
+ The tangent vector `v` maps `f` to the real number
95
+ `v^i \left. \frac{\partial F}{\partial x^i} \right|_p`::
96
+
97
+ sage: v(f)
98
+ -2*D[0](F)(2, 3) + D[1](F)(2, 3)
99
+ sage: vdf(x, y) = v[0]*diff(f.expr(), x) + v[1]*diff(f.expr(), y)
100
+ sage: X(p)
101
+ (2, 3)
102
+ sage: bool( v(f) == vdf(*X(p)) )
103
+ True
104
+
105
+ and if `g` is a second scalar field on `M`::
106
+
107
+ sage: g = M.scalar_field(function('G')(x,y), name='g')
108
+
109
+ then the product `f g` is also a scalar field on `M`::
110
+
111
+ sage: (f*g).display()
112
+ f*g: M → ℝ
113
+ (x, y) ↦ F(x, y)*G(x, y)
114
+
115
+ and we have the derivation law `v(f g) = v(f) g(p) + f(p) v(g)`::
116
+
117
+ sage: bool( v(f*g) == v(f)*g(p) + f(p)*v(g) )
118
+ True
119
+
120
+ .. SEEALSO::
121
+
122
+ :class:`~sage.tensor.modules.free_module_element.FiniteRankFreeModuleElement`
123
+ for more documentation.
124
+ """
125
+ def __init__(self, parent, name=None, latex_name=None):
126
+ r"""
127
+ Construct a tangent vector.
128
+
129
+ TESTS::
130
+
131
+ sage: M = Manifold(2, 'M')
132
+ sage: X.<x,y> = M.chart()
133
+ sage: p = M.point((1,-2), name='p')
134
+ sage: Tp = M.tangent_space(p)
135
+ sage: v = Tp.element_class(Tp, name='v') ; v
136
+ Tangent vector v at Point p on the 2-dimensional differentiable
137
+ manifold M
138
+ sage: v[:] = 5, -3/2
139
+ sage: TestSuite(v).run()
140
+ """
141
+ FiniteRankFreeModuleElement.__init__(self, parent, name=name,
142
+ latex_name=latex_name)
143
+ # Extra data (with respect to FiniteRankFreeModuleElement):
144
+ self._point = parent._point
145
+
146
+ def _repr_(self):
147
+ r"""
148
+ String representation of ``self``.
149
+
150
+ TESTS::
151
+
152
+ sage: M = Manifold(2, 'M')
153
+ sage: X.<x,y> = M.chart()
154
+ sage: p = M.point((1,-2), name='p')
155
+ sage: Tp = M.tangent_space(p)
156
+ sage: v = Tp([-3,2], name='v')
157
+ sage: v._repr_()
158
+ 'Tangent vector v at Point p on the 2-dimensional differentiable manifold M'
159
+ sage: repr(v) # indirect doctest
160
+ 'Tangent vector v at Point p on the 2-dimensional differentiable manifold M'
161
+ """
162
+ from sage.manifolds.differentiable.examples.euclidean import EuclideanSpace
163
+ if isinstance(self._point.parent(), EuclideanSpace):
164
+ desc = "Vector"
165
+ else:
166
+ desc = "Tangent vector"
167
+ if self._name:
168
+ desc += " " + str(self._name)
169
+ desc += " at " + str(self._point)
170
+ return desc
171
+
172
+ @options(scale=1)
173
+ def plot(self, chart=None, ambient_coords=None, mapping=None,
174
+ color='blue', print_label=True, label=None, label_color=None,
175
+ fontsize=10, label_offset=0.1, parameters=None, **extra_options):
176
+ r"""
177
+ Plot the vector in a Cartesian graph based on the coordinates of some
178
+ ambient chart.
179
+
180
+ The vector is drawn in terms of two (2D graphics) or three (3D graphics)
181
+ coordinates of a given chart, called hereafter the *ambient chart*.
182
+ The vector's base point `p` (or its image `\Phi(p)` by some
183
+ differentiable mapping `\Phi`) must lie in the ambient chart's domain.
184
+ If `\Phi` is different from the identity mapping, the vector
185
+ actually depicted is `\mathrm{d}\Phi_p(v)`, where `v` is the current
186
+ vector (``self``) (see the example of a vector tangent to the
187
+ 2-sphere below, where `\Phi: S^2 \to \RR^3`).
188
+
189
+ INPUT:
190
+
191
+ - ``chart`` -- (default: ``None``) the ambient chart (see above); if
192
+ ``None``, it is set to the default chart of the open set containing
193
+ the point at which the vector (or the vector image via the
194
+ differential `\mathrm{d}\Phi_p` of ``mapping``) is defined
195
+
196
+ - ``ambient_coords`` -- (default: ``None``) tuple containing the 2
197
+ or 3 coordinates of the ambient chart in terms of which the plot
198
+ is performed; if ``None``, all the coordinates of the ambient
199
+ chart are considered
200
+
201
+ - ``mapping`` -- (default: ``None``)
202
+ :class:`~sage.manifolds.differentiable.diff_map.DiffMap`;
203
+ differentiable mapping `\Phi` providing the link between the
204
+ point `p` at which the vector is defined and the ambient chart
205
+ ``chart``: the domain of ``chart`` must contain `\Phi(p)`;
206
+ if ``None``, the identity mapping is assumed
207
+
208
+ - ``scale`` -- (default: 1) value by which the length of the arrow
209
+ representing the vector is multiplied
210
+
211
+ - ``color`` -- (default: ``'blue'``) color of the arrow representing the
212
+ vector
213
+
214
+ - ``print_label`` -- boolean (default: ``True``); determines whether a
215
+ label is printed next to the arrow representing the vector
216
+
217
+ - ``label`` -- (string; default: ``None``) label printed next to the
218
+ arrow representing the vector; if ``None``, the vector's symbol is
219
+ used, if any
220
+
221
+ - ``label_color`` -- (default: ``None``) color to print the label;
222
+ if ``None``, the value of ``color`` is used
223
+
224
+ - ``fontsize`` -- (default: 10) size of the font used to print the
225
+ label
226
+
227
+ - ``label_offset`` -- (default: 0.1) determines the separation between
228
+ the vector arrow and the label
229
+
230
+ - ``parameters`` -- (default: ``None``) dictionary giving the numerical
231
+ values of the parameters that may appear in the coordinate expression
232
+ of ``self`` (see example below)
233
+
234
+ - ``**extra_options`` -- extra options for the arrow plot, like
235
+ ``linestyle``, ``width`` or ``arrowsize`` (see
236
+ :func:`~sage.plot.arrow.arrow2d` and
237
+ :func:`~sage.plot.plot3d.shapes.arrow3d` for details)
238
+
239
+ OUTPUT:
240
+
241
+ - a graphic object, either an instance of
242
+ :class:`~sage.plot.graphics.Graphics` for a 2D plot (i.e. based on
243
+ 2 coordinates of ``chart``) or an instance of
244
+ :class:`~sage.plot.plot3d.base.Graphics3d` for a 3D plot (i.e.
245
+ based on 3 coordinates of ``chart``)
246
+
247
+ EXAMPLES:
248
+
249
+ Vector tangent to a 2-dimensional manifold::
250
+
251
+ sage: M = Manifold(2, 'M')
252
+ sage: X.<x,y> = M.chart()
253
+ sage: p = M((2,2), name='p')
254
+ sage: Tp = M.tangent_space(p)
255
+ sage: v = Tp((2, 1), name='v') ; v
256
+ Tangent vector v at Point p on the 2-dimensional differentiable
257
+ manifold M
258
+
259
+ Plot of the vector alone (arrow + label)::
260
+
261
+ sage: v.plot() # needs sage.plot
262
+ Graphics object consisting of 2 graphics primitives
263
+
264
+ Plot atop of the chart grid::
265
+
266
+ sage: X.plot() + v.plot() # needs sage.plot
267
+ Graphics object consisting of 20 graphics primitives
268
+
269
+ .. PLOT::
270
+
271
+ M = Manifold(2, 'M')
272
+ X = M.chart('x y'); x, y = X[:]
273
+ p = M((2,2), name='p'); Tp = M.tangent_space(p)
274
+ v = Tp((2, 1), name='v')
275
+ g = X.plot() + v.plot()
276
+ sphinx_plot(g)
277
+
278
+ Plots with various options::
279
+
280
+ sage: X.plot() + v.plot(color='green', scale=2, label='V') # needs sage.plot
281
+ Graphics object consisting of 20 graphics primitives
282
+
283
+ .. PLOT::
284
+
285
+ M = Manifold(2, 'M')
286
+ X = M.chart('x y'); x, y = X[:]
287
+ p = M((2,2), name='p'); Tp = M.tangent_space(p)
288
+ v = Tp((2, 1), name='v')
289
+ g = X.plot() + v.plot(color='green', scale=2, label='V')
290
+ sphinx_plot(g)
291
+
292
+ ::
293
+
294
+ sage: X.plot() + v.plot(print_label=False) # needs sage.plot
295
+ Graphics object consisting of 19 graphics primitives
296
+
297
+ .. PLOT::
298
+
299
+ M = Manifold(2, 'M')
300
+ X = M.chart('x y'); x, y = X[:]
301
+ p = M((2,2), name='p'); Tp = M.tangent_space(p)
302
+ v = Tp((2, 1), name='v')
303
+ g = X.plot() + v.plot(print_label=False)
304
+ sphinx_plot(g)
305
+
306
+ ::
307
+
308
+ sage: X.plot() + v.plot(color='green', label_color='black', # needs sage.plot
309
+ ....: fontsize=20, label_offset=0.2)
310
+ Graphics object consisting of 20 graphics primitives
311
+
312
+ .. PLOT::
313
+
314
+ M = Manifold(2, 'M')
315
+ X = M.chart('x y'); x, y = X[:]
316
+ p = M((2,2), name='p'); Tp = M.tangent_space(p)
317
+ v = Tp((2, 1), name='v')
318
+ g = X.plot() + v.plot(color='green', label_color='black', fontsize=20, label_offset=0.2)
319
+ sphinx_plot(g)
320
+
321
+ ::
322
+
323
+ sage: X.plot() + v.plot(linestyle=':', width=4, arrowsize=8, # needs sage.plot
324
+ ....: fontsize=20)
325
+ Graphics object consisting of 20 graphics primitives
326
+
327
+ .. PLOT::
328
+
329
+ M = Manifold(2, 'M')
330
+ X = M.chart('x y'); x, y = X[:]
331
+ p = M((2,2), name='p'); Tp = M.tangent_space(p)
332
+ v = Tp((2, 1), name='v')
333
+ g = X.plot() + v.plot(linestyle=':', width=4, arrowsize=8, fontsize=20)
334
+ sphinx_plot(g)
335
+
336
+ Plot with specific values of some free parameters::
337
+
338
+ sage: var('a b')
339
+ (a, b)
340
+ sage: v = Tp((1+a, -b^2), name='v') ; v.display()
341
+ v = (a + 1) ∂/∂x - b^2 ∂/∂y
342
+ sage: X.plot() + v.plot(parameters={a: -2, b: 3}) # needs sage.plot
343
+ Graphics object consisting of 20 graphics primitives
344
+
345
+ Special case of the zero vector::
346
+
347
+ sage: v = Tp.zero() ; v
348
+ Tangent vector zero at Point p on the 2-dimensional differentiable
349
+ manifold M
350
+ sage: X.plot() + v.plot() # needs sage.plot
351
+ Graphics object consisting of 19 graphics primitives
352
+
353
+ Vector tangent to a 4-dimensional manifold::
354
+
355
+ sage: M = Manifold(4, 'M')
356
+ sage: X.<t,x,y,z> = M.chart()
357
+ sage: p = M((0,1,2,3), name='p')
358
+ sage: Tp = M.tangent_space(p)
359
+ sage: v = Tp((5,4,3,2), name='v') ; v
360
+ Tangent vector v at Point p on the 4-dimensional differentiable
361
+ manifold M
362
+
363
+ We cannot make a 4D plot directly::
364
+
365
+ sage: v.plot() # needs sage.plot
366
+ Traceback (most recent call last):
367
+ ...
368
+ ValueError: the number of coordinates involved in the plot must
369
+ be either 2 or 3, not 4
370
+
371
+ Rather, we have to select some chart coordinates for the plot, via
372
+ the argument ``ambient_coords``. For instance, for a 2-dimensional
373
+ plot in terms of the coordinates `(x, y)`::
374
+
375
+ sage: v.plot(ambient_coords=(x,y)) # needs sage.plot
376
+ Graphics object consisting of 2 graphics primitives
377
+
378
+ .. PLOT::
379
+
380
+ M = Manifold(4, 'M')
381
+ X = M.chart('t x y z'); t,x,y,z = X[:]
382
+ p = M((0,1,2,3), name='p'); Tp = M.tangent_space(p)
383
+ v = Tp((5,4,3,2), name='v')
384
+ g = X.plot(ambient_coords=(x,y)) + v.plot(ambient_coords=(x,y))
385
+ sphinx_plot(g)
386
+
387
+ This plot involves only the components `v^x` and `v^y` of `v`.
388
+ Similarly, for a 3-dimensional plot in terms of the coordinates
389
+ `(t, x, y)`::
390
+
391
+ sage: g = v.plot(ambient_coords=(t,x,z)) # needs sage.plot
392
+ sage: print(g) # needs sage.plot
393
+ Graphics3d Object
394
+
395
+ This plot involves only the components `v^t`, `v^x` and `v^z` of `v`.
396
+ A nice 3D view atop the coordinate grid is obtained via::
397
+
398
+ sage: (X.plot(ambient_coords=(t,x,z)) # long time # needs sage.plot
399
+ ....: + v.plot(ambient_coords=(t,x,z),
400
+ ....: label_offset=0.5, width=6))
401
+ Graphics3d Object
402
+
403
+ .. PLOT::
404
+
405
+ M = Manifold(4, 'M')
406
+ X = M.chart('t x y z'); t,x,y,z = X[:]
407
+ p = M((0,1,2,3), name='p'); Tp = M.tangent_space(p)
408
+ v = Tp((5,4,3,2), name='v')
409
+ g = X.plot(ambient_coords=(t,x,z)) + v.plot(ambient_coords=(t,x,z),
410
+ label_offset=0.5, width=6)
411
+ sphinx_plot(g)
412
+
413
+ An example of plot via a differential mapping: plot of a vector tangent
414
+ to a 2-sphere viewed in `\RR^3`::
415
+
416
+ sage: S2 = Manifold(2, 'S^2')
417
+ sage: U = S2.open_subset('U') # the open set covered by spherical coord.
418
+ sage: XS.<th,ph> = U.chart(r'th:(0,pi):\theta ph:(0,2*pi):\phi')
419
+ sage: R3 = Manifold(3, 'R^3')
420
+ sage: X3.<x,y,z> = R3.chart()
421
+ sage: F = S2.diff_map(R3, {(XS, X3): [sin(th)*cos(ph),
422
+ ....: sin(th)*sin(ph),
423
+ ....: cos(th)]}, name='F')
424
+ sage: F.display() # the standard embedding of S^2 into R^3
425
+ F: S^2 → R^3
426
+ on U: (th, ph) ↦ (x, y, z) = (cos(ph)*sin(th), sin(ph)*sin(th), cos(th))
427
+ sage: p = U.point((pi/4, 7*pi/4), name='p')
428
+ sage: v = XS.frame()[1].at(p) ; v # the coordinate vector ∂/∂phi at p
429
+ Tangent vector ∂/∂ph at Point p on the 2-dimensional differentiable
430
+ manifold S^2
431
+ sage: graph_v = v.plot(mapping=F) # needs sage.plot
432
+ sage: graph_S2 = XS.plot(chart=X3, mapping=F, number_values=9) # long time, needs sage.plot
433
+ sage: graph_v + graph_S2 # long time, needs sage.plot
434
+ Graphics3d Object
435
+
436
+ .. PLOT::
437
+
438
+ S2 = Manifold(2, 'S^2')
439
+ U = S2.open_subset('U')
440
+ XS = U.chart(r'th:(0,pi):\theta ph:(0,2*pi):\phi')
441
+ th, ph = XS[:]
442
+ R3 = Manifold(3, 'R^3')
443
+ X3 = R3.chart('x y z')
444
+ F = S2.diff_map(R3, {(XS, X3): [sin(th)*cos(ph), sin(th)*sin(ph),
445
+ cos(th)]}, name='F')
446
+ p = U.point((pi/4, 7*pi/4), name='p')
447
+ v = XS.frame()[1].at(p)
448
+ graph_v = v.plot(mapping=F)
449
+ graph_S2 = XS.plot(chart=X3, mapping=F, number_values=9)
450
+ sphinx_plot(graph_v + graph_S2)
451
+ """
452
+ from sage.manifolds.differentiable.chart import DiffChart
453
+ from sage.misc.functional import numerical_approx
454
+ from sage.plot.arrow import arrow2d
455
+ from sage.plot.graphics import Graphics
456
+ from sage.plot.plot3d.shapes import arrow3d
457
+ from sage.plot.plot3d.shapes2 import text3d
458
+ from sage.plot.text import text
459
+
460
+ scale = extra_options.pop("scale")
461
+
462
+ #
463
+ # The "effective" vector to be plotted
464
+ #
465
+ if mapping is None:
466
+ eff_vector = self
467
+ base_point = self._point
468
+ else:
469
+ #!# check
470
+ # For efficiency, the method FiniteRankFreeModuleMorphism._call_()
471
+ # is called instead of FiniteRankFreeModuleMorphism.__call__()
472
+ eff_vector = mapping.differential(self._point)._call_(self)
473
+ base_point = mapping(self._point)
474
+ #
475
+ # The chart w.r.t. which the vector is plotted
476
+ #
477
+ if chart is None:
478
+ chart = base_point.parent().default_chart()
479
+ elif not isinstance(chart, DiffChart):
480
+ raise TypeError("{} is not a chart".format(chart))
481
+ #
482
+ # Coordinates of the above chart w.r.t. which the vector is plotted
483
+ #
484
+ if ambient_coords is None:
485
+ ambient_coords = chart[:] # all chart coordinates are used
486
+ n_pc = len(ambient_coords)
487
+ if n_pc != 2 and n_pc != 3:
488
+ raise ValueError("the number of coordinates involved in the " +
489
+ "plot must be either 2 or 3, not {}".format(n_pc))
490
+ # indices coordinates involved in the plot:
491
+ ind_pc = [chart[:].index(pc) for pc in ambient_coords]
492
+ #
493
+ # Components of the vector w.r.t. the chart frame
494
+ #
495
+ basis = chart.frame().at(base_point)
496
+ vcomp = eff_vector.comp(basis=basis)[:]
497
+ xp = base_point.coord(chart=chart)
498
+ #
499
+ # The arrow
500
+ #
501
+ resu = Graphics()
502
+ if parameters is None:
503
+ coord_tail = [numerical_approx(xp[i]) for i in ind_pc]
504
+ coord_head = [numerical_approx(xp[i] + scale*vcomp[i])
505
+ for i in ind_pc]
506
+ else:
507
+ coord_tail = [numerical_approx(xp[i].substitute(parameters))
508
+ for i in ind_pc]
509
+ coord_head = [numerical_approx(
510
+ (xp[i] + scale*vcomp[i]).substitute(parameters))
511
+ for i in ind_pc]
512
+ if coord_head != coord_tail:
513
+ if n_pc == 2:
514
+ resu += arrow2d(tailpoint=coord_tail, headpoint=coord_head,
515
+ color=color, **extra_options)
516
+ else:
517
+ resu += arrow3d(coord_tail, coord_head, color=color,
518
+ **extra_options)
519
+ #
520
+ # The label
521
+ #
522
+ if print_label:
523
+ if label is None:
524
+ if n_pc == 2 and self._latex_name is not None:
525
+ label = r'$' + self._latex_name + r'$'
526
+ if n_pc == 3 and self._name is not None:
527
+ label = self._name
528
+ if label is not None:
529
+ xlab = [xh + label_offset for xh in coord_head]
530
+ if label_color is None:
531
+ label_color = color
532
+ if n_pc == 2:
533
+ resu += text(label, xlab, fontsize=fontsize,
534
+ color=label_color)
535
+ else:
536
+ resu += text3d(label, xlab, fontsize=fontsize,
537
+ color=label_color)
538
+ return resu
539
+
540
+ def __call__(self, f):
541
+ r"""
542
+ Action on a scalar field (as a derivation) or on a linear form.
543
+
544
+ INPUT:
545
+
546
+ - ``f`` -- either a scalar field on the manifold of which ``self`` is
547
+ defined or a linear form in the same tangent space as ``self``
548
+
549
+ OUTPUT:
550
+
551
+ - scalar (element of the manifold base field)
552
+
553
+ EXAMPLES:
554
+
555
+ Let us consider a tangent vector on a 2-dimensional manifold::
556
+
557
+ sage: M = Manifold(2, 'M', start_index=1)
558
+ sage: X.<x,y> = M.chart()
559
+ sage: p = M((2, 3), name='p')
560
+ sage: Tp = M.tangent_space(p)
561
+ sage: v = Tp((-1, 2))
562
+ sage: v.display()
563
+ -∂/∂x + 2 ∂/∂y
564
+
565
+ The action of `v` on a scalar field `f`::
566
+
567
+ sage: f = M.scalar_field(x*y^2, name='f')
568
+ sage: v(f)
569
+ 15
570
+
571
+ Check of the formula `v(f) = v^i \frac{\partial f}{\partial x^i}|_p`::
572
+
573
+ sage: vdf(x, y) = v[1]*diff(f.expr(), x) + v[2]*diff(f.expr(), y)
574
+ sage: vdf
575
+ (x, y) |--> 4*x*y - y^2
576
+ sage: X(p)
577
+ (2, 3)
578
+ sage: bool( v(f) == vdf(*X(p)) )
579
+ True
580
+
581
+ Case of a generic scalar field::
582
+
583
+ sage: f = M.scalar_field(function('F')(x,y), name='f')
584
+ sage: v(f)
585
+ -D[0](F)(2, 3) + 2*D[1](F)(2, 3)
586
+
587
+ Action of a tangent vector on a linear form on the same tangent space::
588
+
589
+ sage: omega = Tp.linear_form()
590
+ sage: omega[:] = 4, 1
591
+ sage: omega.display()
592
+ 4 dx + dy
593
+ sage: v(omega)
594
+ -2
595
+
596
+ Checks of he formula `v(\omega) = v^i \omega_i`::
597
+
598
+ sage: bool( v(omega) == v[1]*omega[1] + v[2]*omega[2] )
599
+ True
600
+
601
+ Another check::
602
+
603
+ sage: bool( v(omega) == omega(v) )
604
+ True
605
+ """
606
+ if isinstance(f, FreeModuleAltForm):
607
+ # Case of self acting on a linear form
608
+ if f.tensor_type() != (0, 1):
609
+ raise TypeError("the argument of __call__ must be a linear form, "
610
+ "not {}".format(f))
611
+ return f(self)
612
+ if not isinstance(f, DiffScalarField):
613
+ raise TypeError("the argument of __call__ must be either a linear "
614
+ "form or a scalar field, not {}".format(f))
615
+ # Case of self acting on a scalar field
616
+ return f.differential().at(self._point)(self)