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 @@
1
+ # sage_setup: distribution = sagemath-symbolics
@@ -0,0 +1,105 @@
1
+ # sage_setup: distribution = sagemath-symbolics
2
+ """
3
+ Vectors over callable symbolic rings
4
+
5
+ AUTHOR:
6
+
7
+ - Jason Grout (2010)
8
+
9
+ EXAMPLES::
10
+
11
+ sage: f(r, theta, z) = (r*cos(theta), r*sin(theta), z)
12
+ sage: f.parent()
13
+ Vector space of dimension 3 over Callable function ring with arguments (r, theta, z)
14
+ sage: f
15
+ (r, theta, z) |--> (r*cos(theta), r*sin(theta), z)
16
+ sage: f[0]
17
+ (r, theta, z) |--> r*cos(theta)
18
+ sage: f+f
19
+ (r, theta, z) |--> (2*r*cos(theta), 2*r*sin(theta), 2*z)
20
+ sage: 3*f
21
+ (r, theta, z) |--> (3*r*cos(theta), 3*r*sin(theta), 3*z)
22
+ sage: f*f # dot product
23
+ (r, theta, z) |--> r^2*cos(theta)^2 + r^2*sin(theta)^2 + z^2
24
+ sage: f.diff()(0,1,2) # the matrix derivative
25
+ [cos(1) 0 0]
26
+ [sin(1) 0 0]
27
+ [ 0 0 1]
28
+
29
+
30
+ TESTS::
31
+
32
+ sage: f(u,v,w) = (2*u+v,u-w,w^2+u)
33
+ sage: loads(dumps(f)) == f
34
+ True
35
+ """
36
+
37
+ # ****************************************************************************
38
+ # Copyright (C) 2010 Jason Grout <jason-sage@creativetrax.com>
39
+ #
40
+ # Distributed under the terms of the GNU General Public License (GPL)
41
+ #
42
+ # This code is distributed in the hope that it will be useful,
43
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
44
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
45
+ # General Public License for more details.
46
+ #
47
+ # The full text of the GPL is available at:
48
+ #
49
+ # https://www.gnu.org/licenses/
50
+ # ****************************************************************************
51
+
52
+ from sage.modules import free_module_element
53
+ from sage.symbolic.ring import SR
54
+
55
+
56
+ class Vector_callable_symbolic_dense(free_module_element.FreeModuleElement_generic_dense):
57
+ def _repr_(self):
58
+ """
59
+ Return the string representation of the vector.
60
+
61
+ EXAMPLES::
62
+
63
+ sage: f(u,v,w) = (2*u+v,u-w,w^2+u)
64
+ sage: f
65
+ (u, v, w) |--> (2*u + v, u - w, w^2 + u)
66
+ sage: r(t) = (cos(t), sin(t))
67
+ sage: r
68
+ t |--> (cos(t), sin(t))
69
+ """
70
+ ring = self.coordinate_ring()
71
+ args = ring.arguments()
72
+ repr_x = self.change_ring(SR)._repr_()
73
+ if len(args) == 1:
74
+ return "%s |--> %s" % (args[0], repr_x)
75
+ else:
76
+ args = ", ".join(map(str, args))
77
+ return "(%s) |--> %s" % (args, repr_x)
78
+
79
+ def _latex_(self):
80
+ r"""
81
+ Return the latex representation of the vector.
82
+
83
+ EXAMPLES::
84
+
85
+ sage: f(u,v,w) = (2*u+v,u-w,w^2+u)
86
+ sage: f
87
+ (u, v, w) |--> (2*u + v, u - w, w^2 + u)
88
+ sage: latex(f)
89
+ \left( u, v, w \right) \ {\mapsto} \ \left(2 \, u + v,\,u - w,\,w^{2} + u\right)
90
+ sage: r(t) = (cos(t), sin(t))
91
+ sage: r
92
+ t |--> (cos(t), sin(t))
93
+ sage: latex(r)
94
+ t \ {\mapsto}\ \left(\cos\left(t\right),\,\sin\left(t\right)\right)
95
+ """
96
+ from sage.misc.latex import latex
97
+ ring = self.coordinate_ring()
98
+ args = ring.arguments()
99
+ args = [latex(arg) for arg in args]
100
+ latex_x = self.change_ring(SR)._latex_()
101
+ if len(args) == 1:
102
+ return r"%s \ {\mapsto}\ %s" % (args[0], latex_x)
103
+ else:
104
+ vars = ", ".join(args)
105
+ return r"\left( %s \right) \ {\mapsto} \ %s" % (vars, latex_x)
@@ -0,0 +1,116 @@
1
+ # sage_setup: distribution = sagemath-symbolics
2
+ """
3
+ Dense vectors over the symbolic ring
4
+
5
+ Implements dense vectors over the symbolic ring.
6
+
7
+ AUTHORS:
8
+
9
+ - Robert Bradshaw (2011-05-25): Added more element-wise simplification methods
10
+
11
+ - Joris Vankerschaver (2011-05-15): Initial version
12
+
13
+ EXAMPLES::
14
+
15
+ sage: x, y = var('x, y')
16
+ sage: u = vector([sin(x)^2 + cos(x)^2, log(2*y) + log(3*y)]); u
17
+ (cos(x)^2 + sin(x)^2, log(3*y) + log(2*y))
18
+ sage: type(u)
19
+ <class 'sage.modules.free_module.FreeModule_ambient_field_with_category.element_class'>
20
+ sage: u.simplify_full()
21
+ (1, log(3*y) + log(2*y))
22
+
23
+ TESTS:
24
+
25
+ Check that the outcome of arithmetic with symbolic vectors is again
26
+ a symbolic vector (:issue:`11549`)::
27
+
28
+ sage: v = vector(SR, [1, 2])
29
+ sage: w = vector(SR, [sin(x), 0])
30
+ sage: type(v)
31
+ <class 'sage.modules.free_module.FreeModule_ambient_field_with_category.element_class'>
32
+ sage: type(w)
33
+ <class 'sage.modules.free_module.FreeModule_ambient_field_with_category.element_class'>
34
+ sage: type(v + w)
35
+ <class 'sage.modules.free_module.FreeModule_ambient_field_with_category.element_class'>
36
+ sage: type(-v)
37
+ <class 'sage.modules.free_module.FreeModule_ambient_field_with_category.element_class'>
38
+ sage: type(5*w)
39
+ <class 'sage.modules.free_module.FreeModule_ambient_field_with_category.element_class'>
40
+
41
+ Test pickling/unpickling::
42
+
43
+ sage: u = vector(SR, [sin(x^2)])
44
+ sage: loads(dumps(u)) == u
45
+ True
46
+ """
47
+
48
+ # ****************************************************************************
49
+ # Copyright (C) 2011 Joris Vankerschaver (jv@caltech.edu)
50
+ #
51
+ # Distributed under the terms of the GNU General Public License (GPL)
52
+ # as published by the Free Software Foundation; either version 2 of
53
+ # the License, or (at your option) any later version.
54
+ # https://www.gnu.org/licenses/
55
+ # ****************************************************************************
56
+
57
+ from sage.modules import free_module_element
58
+ from sage.symbolic.expression import Expression
59
+
60
+
61
+ def apply_map(phi):
62
+ """
63
+ Return a function that applies ``phi`` to its argument.
64
+
65
+ EXAMPLES::
66
+
67
+ sage: from sage.modules.vector_symbolic_dense import apply_map
68
+ sage: v = vector([1,2,3])
69
+ sage: f = apply_map(lambda x: x+1)
70
+ sage: f(v)
71
+ (2, 3, 4)
72
+ """
73
+ def apply(self, *args, **kwds):
74
+ """
75
+ Generic function used to implement common symbolic operations
76
+ elementwise as methods of a vector.
77
+
78
+ EXAMPLES::
79
+
80
+ sage: var('x,y')
81
+ (x, y)
82
+ sage: v = vector([sin(x)^2 + cos(x)^2, log(x*y), sin(x/(x^2 + x)), factorial(x+1)/factorial(x)])
83
+ sage: v.simplify_trig()
84
+ (1, log(x*y), sin(1/(x + 1)), factorial(x + 1)/factorial(x))
85
+ sage: v.canonicalize_radical()
86
+ (cos(x)^2 + sin(x)^2, log(x) + log(y), sin(1/(x + 1)), factorial(x + 1)/factorial(x))
87
+ sage: v.simplify_rational()
88
+ (cos(x)^2 + sin(x)^2, log(x*y), sin(1/(x + 1)), factorial(x + 1)/factorial(x))
89
+ sage: v.simplify_factorial()
90
+ (cos(x)^2 + sin(x)^2, log(x*y), sin(x/(x^2 + x)), x + 1)
91
+ sage: v.simplify_full()
92
+ (1, log(x*y), sin(1/(x + 1)), x + 1)
93
+
94
+ sage: v = vector([sin(2*x), sin(3*x)])
95
+ sage: v.simplify_trig()
96
+ (2*cos(x)*sin(x), (4*cos(x)^2 - 1)*sin(x))
97
+ sage: v.simplify_trig(False)
98
+ (sin(2*x), sin(3*x))
99
+ sage: v.simplify_trig(expand=False)
100
+ (sin(2*x), sin(3*x))
101
+ """
102
+ return self.apply_map(lambda x: phi(x, *args, **kwds))
103
+ apply.__doc__ += "\nSee Expression." + phi.__name__ + "() for optional arguments."
104
+ return apply
105
+
106
+
107
+ class Vector_symbolic_dense(free_module_element.FreeModuleElement_generic_dense):
108
+ pass
109
+
110
+
111
+ # Add elementwise methods.
112
+ for method in ['simplify', 'simplify_factorial',
113
+ 'simplify_log', 'simplify_rational',
114
+ 'simplify_trig', 'simplify_full', 'trig_expand',
115
+ 'canonicalize_radical', 'trig_reduce']:
116
+ setattr(Vector_symbolic_dense, method, apply_map(getattr(Expression, method)))
@@ -0,0 +1,118 @@
1
+ # sage_setup: distribution = sagemath-symbolics
2
+ """
3
+ Sparse vectors over the symbolic ring
4
+
5
+ Implements vectors over the symbolic ring.
6
+
7
+ AUTHORS:
8
+
9
+ - Robert Bradshaw (2011-05-25): Added more element-wise simplification methods
10
+
11
+ - Joris Vankerschaver (2011-05-15): Initial version
12
+
13
+ - Dima Pasechnik (2023-06-04): cloning from the dense case
14
+
15
+ EXAMPLES::
16
+
17
+ sage: x, y = var('x, y')
18
+ sage: u = vector([sin(x)^2 + cos(x)^2, log(2*y) + log(3*y)], sparse=True); u
19
+ (cos(x)^2 + sin(x)^2, log(3*y) + log(2*y))
20
+ sage: type(u)
21
+ <class 'sage.modules.free_module.FreeModule_ambient_field_with_category.element_class'>
22
+ sage: u.simplify_full()
23
+ (1, log(3*y) + log(2*y))
24
+
25
+ TESTS:
26
+
27
+ Check that the outcome of arithmetic with symbolic vectors is again
28
+ a symbolic vector (:issue:`11549`)::
29
+
30
+ sage: v = vector(SR, [1, 2], sparse=True)
31
+ sage: w = vector(SR, [sin(x), 0], sparse=True)
32
+ sage: type(v)
33
+ <class 'sage.modules.free_module.FreeModule_ambient_field_with_category.element_class'>
34
+ sage: type(w)
35
+ <class 'sage.modules.free_module.FreeModule_ambient_field_with_category.element_class'>
36
+ sage: type(v + w)
37
+ <class 'sage.modules.free_module.FreeModule_ambient_field_with_category.element_class'>
38
+ sage: type(-v)
39
+ <class 'sage.modules.free_module.FreeModule_ambient_field_with_category.element_class'>
40
+ sage: type(5*w)
41
+ <class 'sage.modules.free_module.FreeModule_ambient_field_with_category.element_class'>
42
+
43
+ Test pickling/unpickling::
44
+
45
+ sage: u = vector(SR, [sin(x^2)], sparse=True)
46
+ sage: loads(dumps(u)) == u
47
+ True
48
+ """
49
+
50
+ # ****************************************************************************
51
+ # Copyright (C) 2011 Joris Vankerschaver (jv@caltech.edu)
52
+ #
53
+ # Distributed under the terms of the GNU General Public License (GPL)
54
+ # as published by the Free Software Foundation; either version 2 of
55
+ # the License, or (at your option) any later version.
56
+ # https://www.gnu.org/licenses/
57
+ # ****************************************************************************
58
+
59
+ from sage.modules import free_module_element
60
+ from sage.symbolic.expression import Expression
61
+
62
+
63
+ def apply_map(phi):
64
+ """
65
+ Return a function that applies ``phi`` to its argument.
66
+
67
+ EXAMPLES::
68
+
69
+ sage: from sage.modules.vector_symbolic_sparse import apply_map
70
+ sage: v = vector([1,2,3], sparse=True)
71
+ sage: f = apply_map(lambda x: x+1)
72
+ sage: f(v)
73
+ (2, 3, 4)
74
+ """
75
+ def apply(self, *args, **kwds):
76
+ """
77
+ Generic function used to implement common symbolic operations
78
+ elementwise as methods of a vector.
79
+
80
+ EXAMPLES::
81
+
82
+ sage: var('x,y')
83
+ (x, y)
84
+ sage: v = vector([sin(x)^2 + cos(x)^2, log(x*y), sin(x/(x^2 + x)), factorial(x+1)/factorial(x)], sparse=True)
85
+ sage: v.simplify_trig()
86
+ (1, log(x*y), sin(1/(x + 1)), factorial(x + 1)/factorial(x))
87
+ sage: v.canonicalize_radical()
88
+ (cos(x)^2 + sin(x)^2, log(x) + log(y), sin(1/(x + 1)), factorial(x + 1)/factorial(x))
89
+ sage: v.simplify_rational()
90
+ (cos(x)^2 + sin(x)^2, log(x*y), sin(1/(x + 1)), factorial(x + 1)/factorial(x))
91
+ sage: v.simplify_factorial()
92
+ (cos(x)^2 + sin(x)^2, log(x*y), sin(x/(x^2 + x)), x + 1)
93
+ sage: v.simplify_full()
94
+ (1, log(x*y), sin(1/(x + 1)), x + 1)
95
+
96
+ sage: v = vector([sin(2*x), sin(3*x)], sparse=True)
97
+ sage: v.simplify_trig()
98
+ (2*cos(x)*sin(x), (4*cos(x)^2 - 1)*sin(x))
99
+ sage: v.simplify_trig(False)
100
+ (sin(2*x), sin(3*x))
101
+ sage: v.simplify_trig(expand=False)
102
+ (sin(2*x), sin(3*x))
103
+ """
104
+ return self.apply_map(lambda x: phi(x, *args, **kwds))
105
+ apply.__doc__ += "\nSee Expression." + phi.__name__ + "() for optional arguments."
106
+ return apply
107
+
108
+
109
+ class Vector_symbolic_sparse(free_module_element.FreeModuleElement_generic_sparse):
110
+ pass
111
+
112
+
113
+ # Add elementwise methods.
114
+ for method in ['simplify', 'simplify_factorial',
115
+ 'simplify_log', 'simplify_rational',
116
+ 'simplify_trig', 'simplify_full', 'trig_expand',
117
+ 'canonicalize_radical', 'trig_reduce']:
118
+ setattr(Vector_symbolic_sparse, method, apply_map(getattr(Expression, method)))
@@ -0,0 +1,4 @@
1
+ # sage_setup: distribution = sagemath-symbolics
2
+ from sage.rings.all__sagemath_modules import *
3
+
4
+ from sage.rings.asymptotic.all import *
@@ -0,0 +1,6 @@
1
+ # sage_setup: distribution = sagemath-symbolics
2
+ from sage.misc.lazy_import import lazy_import
3
+ lazy_import('sage.rings.asymptotic.asymptotic_ring', 'AsymptoticRing')
4
+ lazy_import('sage.rings.asymptotic.asymptotic_expansion_generators',
5
+ 'asymptotic_expansions')
6
+ del lazy_import