passagemath-categories 10.6.32__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 (719) hide show
  1. passagemath_categories-10.6.32.dist-info/METADATA +156 -0
  2. passagemath_categories-10.6.32.dist-info/RECORD +719 -0
  3. passagemath_categories-10.6.32.dist-info/WHEEL +5 -0
  4. passagemath_categories-10.6.32.dist-info/top_level.txt +2 -0
  5. passagemath_categories.libs/libgcc_s-2d945d6c.so.1 +0 -0
  6. passagemath_categories.libs/libgmp-28992bcb.so.10.5.0 +0 -0
  7. passagemath_categories.libs/libstdc++-85f2cd6d.so.6.0.33 +0 -0
  8. sage/all__sagemath_categories.py +28 -0
  9. sage/arith/all.py +38 -0
  10. sage/arith/constants.pxd +27 -0
  11. sage/arith/functions.cpython-314t-aarch64-linux-musl.so +0 -0
  12. sage/arith/functions.pxd +4 -0
  13. sage/arith/functions.pyx +221 -0
  14. sage/arith/misc.py +6552 -0
  15. sage/arith/multi_modular.cpython-314t-aarch64-linux-musl.so +0 -0
  16. sage/arith/multi_modular.pxd +39 -0
  17. sage/arith/multi_modular.pyx +994 -0
  18. sage/arith/rational_reconstruction.cpython-314t-aarch64-linux-musl.so +0 -0
  19. sage/arith/rational_reconstruction.pxd +4 -0
  20. sage/arith/rational_reconstruction.pyx +115 -0
  21. sage/arith/srange.cpython-314t-aarch64-linux-musl.so +0 -0
  22. sage/arith/srange.pyx +571 -0
  23. sage/calculus/all__sagemath_categories.py +2 -0
  24. sage/calculus/functional.py +481 -0
  25. sage/calculus/functions.py +151 -0
  26. sage/categories/additive_groups.py +73 -0
  27. sage/categories/additive_magmas.py +1044 -0
  28. sage/categories/additive_monoids.py +114 -0
  29. sage/categories/additive_semigroups.py +184 -0
  30. sage/categories/affine_weyl_groups.py +238 -0
  31. sage/categories/algebra_ideals.py +95 -0
  32. sage/categories/algebra_modules.py +96 -0
  33. sage/categories/algebras.py +349 -0
  34. sage/categories/algebras_with_basis.py +377 -0
  35. sage/categories/all.py +160 -0
  36. sage/categories/aperiodic_semigroups.py +29 -0
  37. sage/categories/associative_algebras.py +47 -0
  38. sage/categories/bialgebras.py +101 -0
  39. sage/categories/bialgebras_with_basis.py +414 -0
  40. sage/categories/bimodules.py +206 -0
  41. sage/categories/chain_complexes.py +268 -0
  42. sage/categories/classical_crystals.py +480 -0
  43. sage/categories/coalgebras.py +405 -0
  44. sage/categories/coalgebras_with_basis.py +232 -0
  45. sage/categories/coercion_methods.cpython-314t-aarch64-linux-musl.so +0 -0
  46. sage/categories/coercion_methods.pyx +52 -0
  47. sage/categories/commutative_additive_groups.py +104 -0
  48. sage/categories/commutative_additive_monoids.py +45 -0
  49. sage/categories/commutative_additive_semigroups.py +48 -0
  50. sage/categories/commutative_algebra_ideals.py +87 -0
  51. sage/categories/commutative_algebras.py +94 -0
  52. sage/categories/commutative_ring_ideals.py +58 -0
  53. sage/categories/commutative_rings.py +736 -0
  54. sage/categories/complete_discrete_valuation.py +293 -0
  55. sage/categories/complex_reflection_groups.py +145 -0
  56. sage/categories/complex_reflection_or_generalized_coxeter_groups.py +1249 -0
  57. sage/categories/coxeter_group_algebras.py +186 -0
  58. sage/categories/coxeter_groups.py +3402 -0
  59. sage/categories/crystals.py +2628 -0
  60. sage/categories/cw_complexes.py +216 -0
  61. sage/categories/dedekind_domains.py +137 -0
  62. sage/categories/discrete_valuation.py +325 -0
  63. sage/categories/distributive_magmas_and_additive_magmas.py +100 -0
  64. sage/categories/division_rings.py +114 -0
  65. sage/categories/domains.py +95 -0
  66. sage/categories/drinfeld_modules.py +789 -0
  67. sage/categories/dual.py +42 -0
  68. sage/categories/enumerated_sets.py +1146 -0
  69. sage/categories/euclidean_domains.py +271 -0
  70. sage/categories/examples/algebras_with_basis.py +102 -0
  71. sage/categories/examples/all.py +1 -0
  72. sage/categories/examples/commutative_additive_monoids.py +130 -0
  73. sage/categories/examples/commutative_additive_semigroups.py +199 -0
  74. sage/categories/examples/coxeter_groups.py +8 -0
  75. sage/categories/examples/crystals.py +236 -0
  76. sage/categories/examples/cw_complexes.py +163 -0
  77. sage/categories/examples/facade_sets.py +187 -0
  78. sage/categories/examples/filtered_algebras_with_basis.py +204 -0
  79. sage/categories/examples/filtered_modules_with_basis.py +154 -0
  80. sage/categories/examples/finite_coxeter_groups.py +252 -0
  81. sage/categories/examples/finite_dimensional_algebras_with_basis.py +148 -0
  82. sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py +495 -0
  83. sage/categories/examples/finite_enumerated_sets.py +208 -0
  84. sage/categories/examples/finite_monoids.py +150 -0
  85. sage/categories/examples/finite_semigroups.py +190 -0
  86. sage/categories/examples/finite_weyl_groups.py +191 -0
  87. sage/categories/examples/graded_connected_hopf_algebras_with_basis.py +152 -0
  88. sage/categories/examples/graded_modules_with_basis.py +168 -0
  89. sage/categories/examples/graphs.py +122 -0
  90. sage/categories/examples/hopf_algebras_with_basis.py +145 -0
  91. sage/categories/examples/infinite_enumerated_sets.py +190 -0
  92. sage/categories/examples/lie_algebras.py +352 -0
  93. sage/categories/examples/lie_algebras_with_basis.py +196 -0
  94. sage/categories/examples/magmas.py +162 -0
  95. sage/categories/examples/manifolds.py +94 -0
  96. sage/categories/examples/monoids.py +144 -0
  97. sage/categories/examples/posets.py +178 -0
  98. sage/categories/examples/semigroups.py +580 -0
  99. sage/categories/examples/semigroups_cython.cpython-314t-aarch64-linux-musl.so +0 -0
  100. sage/categories/examples/semigroups_cython.pyx +221 -0
  101. sage/categories/examples/semirings.py +249 -0
  102. sage/categories/examples/sets_cat.py +706 -0
  103. sage/categories/examples/sets_with_grading.py +101 -0
  104. sage/categories/examples/with_realizations.py +542 -0
  105. sage/categories/fields.py +991 -0
  106. sage/categories/filtered_algebras.py +63 -0
  107. sage/categories/filtered_algebras_with_basis.py +548 -0
  108. sage/categories/filtered_hopf_algebras_with_basis.py +138 -0
  109. sage/categories/filtered_modules.py +210 -0
  110. sage/categories/filtered_modules_with_basis.py +1209 -0
  111. sage/categories/finite_complex_reflection_groups.py +1506 -0
  112. sage/categories/finite_coxeter_groups.py +1138 -0
  113. sage/categories/finite_crystals.py +103 -0
  114. sage/categories/finite_dimensional_algebras_with_basis.py +1860 -0
  115. sage/categories/finite_dimensional_bialgebras_with_basis.py +33 -0
  116. sage/categories/finite_dimensional_coalgebras_with_basis.py +33 -0
  117. sage/categories/finite_dimensional_graded_lie_algebras_with_basis.py +231 -0
  118. sage/categories/finite_dimensional_hopf_algebras_with_basis.py +38 -0
  119. sage/categories/finite_dimensional_lie_algebras_with_basis.py +2774 -0
  120. sage/categories/finite_dimensional_modules_with_basis.py +1407 -0
  121. sage/categories/finite_dimensional_nilpotent_lie_algebras_with_basis.py +167 -0
  122. sage/categories/finite_dimensional_semisimple_algebras_with_basis.py +270 -0
  123. sage/categories/finite_enumerated_sets.py +769 -0
  124. sage/categories/finite_fields.py +252 -0
  125. sage/categories/finite_groups.py +256 -0
  126. sage/categories/finite_lattice_posets.py +242 -0
  127. sage/categories/finite_monoids.py +316 -0
  128. sage/categories/finite_permutation_groups.py +339 -0
  129. sage/categories/finite_posets.py +1994 -0
  130. sage/categories/finite_semigroups.py +136 -0
  131. sage/categories/finite_sets.py +93 -0
  132. sage/categories/finite_weyl_groups.py +39 -0
  133. sage/categories/finitely_generated_lambda_bracket_algebras.py +112 -0
  134. sage/categories/finitely_generated_lie_conformal_algebras.py +114 -0
  135. sage/categories/finitely_generated_magmas.py +57 -0
  136. sage/categories/finitely_generated_semigroups.py +214 -0
  137. sage/categories/function_fields.py +76 -0
  138. sage/categories/g_sets.py +77 -0
  139. sage/categories/gcd_domains.py +65 -0
  140. sage/categories/generalized_coxeter_groups.py +94 -0
  141. sage/categories/graded_algebras.py +85 -0
  142. sage/categories/graded_algebras_with_basis.py +258 -0
  143. sage/categories/graded_bialgebras.py +32 -0
  144. sage/categories/graded_bialgebras_with_basis.py +32 -0
  145. sage/categories/graded_coalgebras.py +65 -0
  146. sage/categories/graded_coalgebras_with_basis.py +51 -0
  147. sage/categories/graded_hopf_algebras.py +41 -0
  148. sage/categories/graded_hopf_algebras_with_basis.py +169 -0
  149. sage/categories/graded_lie_algebras.py +91 -0
  150. sage/categories/graded_lie_algebras_with_basis.py +44 -0
  151. sage/categories/graded_lie_conformal_algebras.py +74 -0
  152. sage/categories/graded_modules.py +133 -0
  153. sage/categories/graded_modules_with_basis.py +329 -0
  154. sage/categories/graphs.py +138 -0
  155. sage/categories/group_algebras.py +430 -0
  156. sage/categories/groupoid.py +94 -0
  157. sage/categories/groups.py +667 -0
  158. sage/categories/h_trivial_semigroups.py +64 -0
  159. sage/categories/hecke_modules.py +185 -0
  160. sage/categories/highest_weight_crystals.py +980 -0
  161. sage/categories/hopf_algebras.py +219 -0
  162. sage/categories/hopf_algebras_with_basis.py +309 -0
  163. sage/categories/infinite_enumerated_sets.py +115 -0
  164. sage/categories/integral_domains.py +203 -0
  165. sage/categories/j_trivial_semigroups.py +29 -0
  166. sage/categories/kac_moody_algebras.py +82 -0
  167. sage/categories/kahler_algebras.py +203 -0
  168. sage/categories/l_trivial_semigroups.py +63 -0
  169. sage/categories/lambda_bracket_algebras.py +280 -0
  170. sage/categories/lambda_bracket_algebras_with_basis.py +107 -0
  171. sage/categories/lattice_posets.py +89 -0
  172. sage/categories/left_modules.py +49 -0
  173. sage/categories/lie_algebras.py +1070 -0
  174. sage/categories/lie_algebras_with_basis.py +261 -0
  175. sage/categories/lie_conformal_algebras.py +350 -0
  176. sage/categories/lie_conformal_algebras_with_basis.py +147 -0
  177. sage/categories/lie_groups.py +73 -0
  178. sage/categories/loop_crystals.py +1290 -0
  179. sage/categories/magmas.py +1189 -0
  180. sage/categories/magmas_and_additive_magmas.py +149 -0
  181. sage/categories/magmatic_algebras.py +365 -0
  182. sage/categories/manifolds.py +352 -0
  183. sage/categories/matrix_algebras.py +40 -0
  184. sage/categories/metric_spaces.py +387 -0
  185. sage/categories/modular_abelian_varieties.py +78 -0
  186. sage/categories/modules.py +989 -0
  187. sage/categories/modules_with_basis.py +2794 -0
  188. sage/categories/monoid_algebras.py +38 -0
  189. sage/categories/monoids.py +739 -0
  190. sage/categories/noetherian_rings.py +87 -0
  191. sage/categories/number_fields.py +242 -0
  192. sage/categories/ore_modules.py +189 -0
  193. sage/categories/partially_ordered_monoids.py +49 -0
  194. sage/categories/permutation_groups.py +63 -0
  195. sage/categories/pointed_sets.py +42 -0
  196. sage/categories/polyhedra.py +74 -0
  197. sage/categories/poor_man_map.py +270 -0
  198. sage/categories/posets.py +722 -0
  199. sage/categories/principal_ideal_domains.py +270 -0
  200. sage/categories/quantum_group_representations.py +543 -0
  201. sage/categories/quotient_fields.py +728 -0
  202. sage/categories/r_trivial_semigroups.py +45 -0
  203. sage/categories/regular_crystals.py +898 -0
  204. sage/categories/regular_supercrystals.py +170 -0
  205. sage/categories/right_modules.py +49 -0
  206. sage/categories/ring_ideals.py +74 -0
  207. sage/categories/rings.py +1904 -0
  208. sage/categories/rngs.py +175 -0
  209. sage/categories/schemes.py +393 -0
  210. sage/categories/semigroups.py +1060 -0
  211. sage/categories/semirings.py +71 -0
  212. sage/categories/semisimple_algebras.py +114 -0
  213. sage/categories/sets_with_grading.py +235 -0
  214. sage/categories/shephard_groups.py +43 -0
  215. sage/categories/signed_tensor.py +120 -0
  216. sage/categories/simplicial_complexes.py +134 -0
  217. sage/categories/simplicial_sets.py +1206 -0
  218. sage/categories/super_algebras.py +149 -0
  219. sage/categories/super_algebras_with_basis.py +144 -0
  220. sage/categories/super_hopf_algebras_with_basis.py +126 -0
  221. sage/categories/super_lie_conformal_algebras.py +193 -0
  222. sage/categories/super_modules.py +229 -0
  223. sage/categories/super_modules_with_basis.py +193 -0
  224. sage/categories/supercommutative_algebras.py +99 -0
  225. sage/categories/supercrystals.py +406 -0
  226. sage/categories/tensor.py +110 -0
  227. sage/categories/topological_spaces.py +170 -0
  228. sage/categories/triangular_kac_moody_algebras.py +439 -0
  229. sage/categories/tutorial.py +58 -0
  230. sage/categories/unique_factorization_domains.py +318 -0
  231. sage/categories/unital_algebras.py +426 -0
  232. sage/categories/vector_bundles.py +159 -0
  233. sage/categories/vector_spaces.py +357 -0
  234. sage/categories/weyl_groups.py +853 -0
  235. sage/combinat/all__sagemath_categories.py +34 -0
  236. sage/combinat/backtrack.py +180 -0
  237. sage/combinat/combinat.py +2269 -0
  238. sage/combinat/combinat_cython.cpython-314t-aarch64-linux-musl.so +0 -0
  239. sage/combinat/combinat_cython.pxd +6 -0
  240. sage/combinat/combinat_cython.pyx +390 -0
  241. sage/combinat/combination.py +796 -0
  242. sage/combinat/combinatorial_map.py +416 -0
  243. sage/combinat/composition.py +2192 -0
  244. sage/combinat/dlx.py +510 -0
  245. sage/combinat/integer_lists/__init__.py +7 -0
  246. sage/combinat/integer_lists/base.cpython-314t-aarch64-linux-musl.so +0 -0
  247. sage/combinat/integer_lists/base.pxd +16 -0
  248. sage/combinat/integer_lists/base.pyx +713 -0
  249. sage/combinat/integer_lists/invlex.cpython-314t-aarch64-linux-musl.so +0 -0
  250. sage/combinat/integer_lists/invlex.pxd +4 -0
  251. sage/combinat/integer_lists/invlex.pyx +1650 -0
  252. sage/combinat/integer_lists/lists.py +328 -0
  253. sage/combinat/integer_lists/nn.py +48 -0
  254. sage/combinat/integer_vector.py +1818 -0
  255. sage/combinat/integer_vector_weighted.py +413 -0
  256. sage/combinat/matrices/all__sagemath_categories.py +5 -0
  257. sage/combinat/matrices/dancing_links.cpython-314t-aarch64-linux-musl.so +0 -0
  258. sage/combinat/matrices/dancing_links.pyx +1159 -0
  259. sage/combinat/matrices/dancing_links_c.h +380 -0
  260. sage/combinat/matrices/dlxcpp.py +136 -0
  261. sage/combinat/partition.py +10070 -0
  262. sage/combinat/partitions.cpython-314t-aarch64-linux-musl.so +0 -0
  263. sage/combinat/partitions.pyx +743 -0
  264. sage/combinat/permutation.py +10168 -0
  265. sage/combinat/permutation_cython.cpython-314t-aarch64-linux-musl.so +0 -0
  266. sage/combinat/permutation_cython.pxd +11 -0
  267. sage/combinat/permutation_cython.pyx +407 -0
  268. sage/combinat/q_analogues.py +1090 -0
  269. sage/combinat/ranker.py +268 -0
  270. sage/combinat/subset.py +1561 -0
  271. sage/combinat/subsets_hereditary.py +202 -0
  272. sage/combinat/subsets_pairwise.py +184 -0
  273. sage/combinat/tools.py +63 -0
  274. sage/combinat/tuple.py +348 -0
  275. sage/data_structures/all.py +2 -0
  276. sage/data_structures/all__sagemath_categories.py +2 -0
  277. sage/data_structures/binary_matrix.pxd +138 -0
  278. sage/data_structures/binary_search.cpython-314t-aarch64-linux-musl.so +0 -0
  279. sage/data_structures/binary_search.pxd +3 -0
  280. sage/data_structures/binary_search.pyx +66 -0
  281. sage/data_structures/bitset.cpython-314t-aarch64-linux-musl.so +0 -0
  282. sage/data_structures/bitset.pxd +40 -0
  283. sage/data_structures/bitset.pyx +2385 -0
  284. sage/data_structures/bitset_base.cpython-314t-aarch64-linux-musl.so +0 -0
  285. sage/data_structures/bitset_base.pxd +926 -0
  286. sage/data_structures/bitset_base.pyx +117 -0
  287. sage/data_structures/bitset_intrinsics.h +487 -0
  288. sage/data_structures/blas_dict.cpython-314t-aarch64-linux-musl.so +0 -0
  289. sage/data_structures/blas_dict.pxd +12 -0
  290. sage/data_structures/blas_dict.pyx +469 -0
  291. sage/data_structures/list_of_pairs.cpython-314t-aarch64-linux-musl.so +0 -0
  292. sage/data_structures/list_of_pairs.pxd +16 -0
  293. sage/data_structures/list_of_pairs.pyx +122 -0
  294. sage/data_structures/mutable_poset.py +3312 -0
  295. sage/data_structures/pairing_heap.cpython-314t-aarch64-linux-musl.so +0 -0
  296. sage/data_structures/pairing_heap.h +346 -0
  297. sage/data_structures/pairing_heap.pxd +88 -0
  298. sage/data_structures/pairing_heap.pyx +1464 -0
  299. sage/data_structures/sparse_bitset.pxd +62 -0
  300. sage/data_structures/stream.py +5070 -0
  301. sage/databases/all__sagemath_categories.py +7 -0
  302. sage/databases/sql_db.py +2236 -0
  303. sage/ext/all__sagemath_categories.py +3 -0
  304. sage/ext/fast_callable.cpython-314t-aarch64-linux-musl.so +0 -0
  305. sage/ext/fast_callable.pxd +4 -0
  306. sage/ext/fast_callable.pyx +2746 -0
  307. sage/ext/fast_eval.cpython-314t-aarch64-linux-musl.so +0 -0
  308. sage/ext/fast_eval.pxd +1 -0
  309. sage/ext/fast_eval.pyx +102 -0
  310. sage/ext/interpreters/__init__.py +1 -0
  311. sage/ext/interpreters/all__sagemath_categories.py +2 -0
  312. sage/ext/interpreters/wrapper_el.cpython-314t-aarch64-linux-musl.so +0 -0
  313. sage/ext/interpreters/wrapper_el.pxd +18 -0
  314. sage/ext/interpreters/wrapper_el.pyx +148 -0
  315. sage/ext/interpreters/wrapper_py.cpython-314t-aarch64-linux-musl.so +0 -0
  316. sage/ext/interpreters/wrapper_py.pxd +17 -0
  317. sage/ext/interpreters/wrapper_py.pyx +133 -0
  318. sage/functions/airy.py +937 -0
  319. sage/functions/all.py +97 -0
  320. sage/functions/bessel.py +2102 -0
  321. sage/functions/error.py +784 -0
  322. sage/functions/exp_integral.py +1529 -0
  323. sage/functions/gamma.py +1087 -0
  324. sage/functions/generalized.py +672 -0
  325. sage/functions/hyperbolic.py +747 -0
  326. sage/functions/hypergeometric.py +1156 -0
  327. sage/functions/jacobi.py +1705 -0
  328. sage/functions/log.py +1402 -0
  329. sage/functions/min_max.py +338 -0
  330. sage/functions/orthogonal_polys.py +3106 -0
  331. sage/functions/other.py +2303 -0
  332. sage/functions/piecewise.py +1505 -0
  333. sage/functions/prime_pi.cpython-314t-aarch64-linux-musl.so +0 -0
  334. sage/functions/prime_pi.pyx +262 -0
  335. sage/functions/special.py +1212 -0
  336. sage/functions/spike_function.py +278 -0
  337. sage/functions/transcendental.py +690 -0
  338. sage/functions/trig.py +1062 -0
  339. sage/functions/wigner.py +726 -0
  340. sage/geometry/abc.cpython-314t-aarch64-linux-musl.so +0 -0
  341. sage/geometry/abc.pyx +82 -0
  342. sage/geometry/all__sagemath_categories.py +1 -0
  343. sage/groups/all__sagemath_categories.py +11 -0
  344. sage/groups/generic.py +1733 -0
  345. sage/groups/groups_catalog.py +113 -0
  346. sage/groups/perm_gps/all__sagemath_categories.py +1 -0
  347. sage/groups/perm_gps/partn_ref/all.py +1 -0
  348. sage/groups/perm_gps/partn_ref/all__sagemath_categories.py +1 -0
  349. sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.cpython-314t-aarch64-linux-musl.so +0 -0
  350. sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.pxd +52 -0
  351. sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.pyx +906 -0
  352. sage/groups/perm_gps/partn_ref/canonical_augmentation.cpython-314t-aarch64-linux-musl.so +0 -0
  353. sage/groups/perm_gps/partn_ref/canonical_augmentation.pxd +85 -0
  354. sage/groups/perm_gps/partn_ref/canonical_augmentation.pyx +534 -0
  355. sage/groups/perm_gps/partn_ref/data_structures.cpython-314t-aarch64-linux-musl.so +0 -0
  356. sage/groups/perm_gps/partn_ref/data_structures.pxd +576 -0
  357. sage/groups/perm_gps/partn_ref/data_structures.pyx +1792 -0
  358. sage/groups/perm_gps/partn_ref/double_coset.cpython-314t-aarch64-linux-musl.so +0 -0
  359. sage/groups/perm_gps/partn_ref/double_coset.pxd +45 -0
  360. sage/groups/perm_gps/partn_ref/double_coset.pyx +739 -0
  361. sage/groups/perm_gps/partn_ref/refinement_lists.cpython-314t-aarch64-linux-musl.so +0 -0
  362. sage/groups/perm_gps/partn_ref/refinement_lists.pxd +18 -0
  363. sage/groups/perm_gps/partn_ref/refinement_lists.pyx +82 -0
  364. sage/groups/perm_gps/partn_ref/refinement_python.cpython-314t-aarch64-linux-musl.so +0 -0
  365. sage/groups/perm_gps/partn_ref/refinement_python.pxd +16 -0
  366. sage/groups/perm_gps/partn_ref/refinement_python.pyx +564 -0
  367. sage/groups/perm_gps/partn_ref/refinement_sets.cpython-314t-aarch64-linux-musl.so +0 -0
  368. sage/groups/perm_gps/partn_ref/refinement_sets.pxd +60 -0
  369. sage/groups/perm_gps/partn_ref/refinement_sets.pyx +858 -0
  370. sage/interfaces/abc.py +140 -0
  371. sage/interfaces/all.py +58 -0
  372. sage/interfaces/all__sagemath_categories.py +1 -0
  373. sage/interfaces/expect.py +1643 -0
  374. sage/interfaces/interface.py +1682 -0
  375. sage/interfaces/process.cpython-314t-aarch64-linux-musl.so +0 -0
  376. sage/interfaces/process.pxd +5 -0
  377. sage/interfaces/process.pyx +288 -0
  378. sage/interfaces/quit.py +167 -0
  379. sage/interfaces/sage0.py +604 -0
  380. sage/interfaces/sagespawn.cpython-314t-aarch64-linux-musl.so +0 -0
  381. sage/interfaces/sagespawn.pyx +308 -0
  382. sage/interfaces/tab_completion.py +101 -0
  383. sage/misc/all__sagemath_categories.py +78 -0
  384. sage/misc/allocator.cpython-314t-aarch64-linux-musl.so +0 -0
  385. sage/misc/allocator.pxd +6 -0
  386. sage/misc/allocator.pyx +47 -0
  387. sage/misc/binary_tree.cpython-314t-aarch64-linux-musl.so +0 -0
  388. sage/misc/binary_tree.pxd +29 -0
  389. sage/misc/binary_tree.pyx +537 -0
  390. sage/misc/callable_dict.cpython-314t-aarch64-linux-musl.so +0 -0
  391. sage/misc/callable_dict.pyx +89 -0
  392. sage/misc/citation.cpython-314t-aarch64-linux-musl.so +0 -0
  393. sage/misc/citation.pyx +159 -0
  394. sage/misc/converting_dict.py +293 -0
  395. sage/misc/defaults.py +129 -0
  396. sage/misc/derivative.cpython-314t-aarch64-linux-musl.so +0 -0
  397. sage/misc/derivative.pyx +223 -0
  398. sage/misc/functional.py +2005 -0
  399. sage/misc/html.py +589 -0
  400. sage/misc/latex.py +2673 -0
  401. sage/misc/latex_macros.py +236 -0
  402. sage/misc/latex_standalone.py +1833 -0
  403. sage/misc/map_threaded.py +38 -0
  404. sage/misc/mathml.py +76 -0
  405. sage/misc/method_decorator.py +88 -0
  406. sage/misc/mrange.py +755 -0
  407. sage/misc/multireplace.py +41 -0
  408. sage/misc/object_multiplexer.py +92 -0
  409. sage/misc/parser.cpython-314t-aarch64-linux-musl.so +0 -0
  410. sage/misc/parser.pyx +1107 -0
  411. sage/misc/random_testing.py +264 -0
  412. sage/misc/rest_index_of_methods.py +377 -0
  413. sage/misc/search.cpython-314t-aarch64-linux-musl.so +0 -0
  414. sage/misc/search.pxd +2 -0
  415. sage/misc/search.pyx +68 -0
  416. sage/misc/stopgap.cpython-314t-aarch64-linux-musl.so +0 -0
  417. sage/misc/stopgap.pyx +95 -0
  418. sage/misc/table.py +853 -0
  419. sage/monoids/all__sagemath_categories.py +1 -0
  420. sage/monoids/indexed_free_monoid.py +1071 -0
  421. sage/monoids/monoid.py +82 -0
  422. sage/numerical/all__sagemath_categories.py +1 -0
  423. sage/numerical/backends/all__sagemath_categories.py +1 -0
  424. sage/numerical/backends/generic_backend.cpython-314t-aarch64-linux-musl.so +0 -0
  425. sage/numerical/backends/generic_backend.pxd +61 -0
  426. sage/numerical/backends/generic_backend.pyx +1893 -0
  427. sage/numerical/backends/generic_sdp_backend.cpython-314t-aarch64-linux-musl.so +0 -0
  428. sage/numerical/backends/generic_sdp_backend.pxd +38 -0
  429. sage/numerical/backends/generic_sdp_backend.pyx +755 -0
  430. sage/parallel/all.py +6 -0
  431. sage/parallel/decorate.py +575 -0
  432. sage/parallel/map_reduce.py +1997 -0
  433. sage/parallel/multiprocessing_sage.py +76 -0
  434. sage/parallel/ncpus.py +35 -0
  435. sage/parallel/parallelism.py +364 -0
  436. sage/parallel/reference.py +47 -0
  437. sage/parallel/use_fork.py +333 -0
  438. sage/rings/abc.cpython-314t-aarch64-linux-musl.so +0 -0
  439. sage/rings/abc.pxd +31 -0
  440. sage/rings/abc.pyx +526 -0
  441. sage/rings/algebraic_closure_finite_field.py +1154 -0
  442. sage/rings/all__sagemath_categories.py +91 -0
  443. sage/rings/big_oh.py +227 -0
  444. sage/rings/continued_fraction.py +2754 -0
  445. sage/rings/continued_fraction_gosper.py +220 -0
  446. sage/rings/factorint.cpython-314t-aarch64-linux-musl.so +0 -0
  447. sage/rings/factorint.pyx +295 -0
  448. sage/rings/fast_arith.cpython-314t-aarch64-linux-musl.so +0 -0
  449. sage/rings/fast_arith.pxd +21 -0
  450. sage/rings/fast_arith.pyx +535 -0
  451. sage/rings/finite_rings/all__sagemath_categories.py +9 -0
  452. sage/rings/finite_rings/conway_polynomials.py +542 -0
  453. sage/rings/finite_rings/element_base.cpython-314t-aarch64-linux-musl.so +0 -0
  454. sage/rings/finite_rings/element_base.pxd +12 -0
  455. sage/rings/finite_rings/element_base.pyx +1176 -0
  456. sage/rings/finite_rings/finite_field_base.cpython-314t-aarch64-linux-musl.so +0 -0
  457. sage/rings/finite_rings/finite_field_base.pxd +7 -0
  458. sage/rings/finite_rings/finite_field_base.pyx +2171 -0
  459. sage/rings/finite_rings/finite_field_constructor.py +827 -0
  460. sage/rings/finite_rings/finite_field_prime_modn.py +372 -0
  461. sage/rings/finite_rings/galois_group.py +154 -0
  462. sage/rings/finite_rings/hom_finite_field.cpython-314t-aarch64-linux-musl.so +0 -0
  463. sage/rings/finite_rings/hom_finite_field.pxd +23 -0
  464. sage/rings/finite_rings/hom_finite_field.pyx +856 -0
  465. sage/rings/finite_rings/hom_prime_finite_field.cpython-314t-aarch64-linux-musl.so +0 -0
  466. sage/rings/finite_rings/hom_prime_finite_field.pxd +15 -0
  467. sage/rings/finite_rings/hom_prime_finite_field.pyx +164 -0
  468. sage/rings/finite_rings/homset.py +357 -0
  469. sage/rings/finite_rings/integer_mod.cpython-314t-aarch64-linux-musl.so +0 -0
  470. sage/rings/finite_rings/integer_mod.pxd +56 -0
  471. sage/rings/finite_rings/integer_mod.pyx +4586 -0
  472. sage/rings/finite_rings/integer_mod_limits.h +11 -0
  473. sage/rings/finite_rings/integer_mod_ring.py +2044 -0
  474. sage/rings/finite_rings/residue_field.cpython-314t-aarch64-linux-musl.so +0 -0
  475. sage/rings/finite_rings/residue_field.pxd +30 -0
  476. sage/rings/finite_rings/residue_field.pyx +1811 -0
  477. sage/rings/finite_rings/stdint.pxd +19 -0
  478. sage/rings/fraction_field.py +1452 -0
  479. sage/rings/fraction_field_element.cpython-314t-aarch64-linux-musl.so +0 -0
  480. sage/rings/fraction_field_element.pyx +1357 -0
  481. sage/rings/function_field/all.py +7 -0
  482. sage/rings/function_field/all__sagemath_categories.py +2 -0
  483. sage/rings/function_field/constructor.py +218 -0
  484. sage/rings/function_field/element.cpython-314t-aarch64-linux-musl.so +0 -0
  485. sage/rings/function_field/element.pxd +11 -0
  486. sage/rings/function_field/element.pyx +1008 -0
  487. sage/rings/function_field/element_rational.cpython-314t-aarch64-linux-musl.so +0 -0
  488. sage/rings/function_field/element_rational.pyx +513 -0
  489. sage/rings/function_field/extensions.py +230 -0
  490. sage/rings/function_field/function_field.py +1468 -0
  491. sage/rings/function_field/function_field_rational.py +1005 -0
  492. sage/rings/function_field/ideal.py +1155 -0
  493. sage/rings/function_field/ideal_rational.py +629 -0
  494. sage/rings/function_field/jacobian_base.py +826 -0
  495. sage/rings/function_field/jacobian_hess.py +1053 -0
  496. sage/rings/function_field/jacobian_khuri_makdisi.py +1027 -0
  497. sage/rings/function_field/maps.py +1039 -0
  498. sage/rings/function_field/order.py +281 -0
  499. sage/rings/function_field/order_basis.py +586 -0
  500. sage/rings/function_field/order_rational.py +576 -0
  501. sage/rings/function_field/place.py +426 -0
  502. sage/rings/function_field/place_rational.py +181 -0
  503. sage/rings/generic.py +320 -0
  504. sage/rings/homset.py +332 -0
  505. sage/rings/ideal.py +1885 -0
  506. sage/rings/ideal_monoid.py +215 -0
  507. sage/rings/infinity.py +1890 -0
  508. sage/rings/integer.cpython-314t-aarch64-linux-musl.so +0 -0
  509. sage/rings/integer.pxd +45 -0
  510. sage/rings/integer.pyx +7874 -0
  511. sage/rings/integer_ring.cpython-314t-aarch64-linux-musl.so +0 -0
  512. sage/rings/integer_ring.pxd +8 -0
  513. sage/rings/integer_ring.pyx +1693 -0
  514. sage/rings/laurent_series_ring.py +931 -0
  515. sage/rings/laurent_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
  516. sage/rings/laurent_series_ring_element.pxd +11 -0
  517. sage/rings/laurent_series_ring_element.pyx +1927 -0
  518. sage/rings/lazy_series.py +7815 -0
  519. sage/rings/lazy_series_ring.py +4356 -0
  520. sage/rings/localization.py +1043 -0
  521. sage/rings/morphism.cpython-314t-aarch64-linux-musl.so +0 -0
  522. sage/rings/morphism.pxd +39 -0
  523. sage/rings/morphism.pyx +3299 -0
  524. sage/rings/multi_power_series_ring.py +1145 -0
  525. sage/rings/multi_power_series_ring_element.py +2184 -0
  526. sage/rings/noncommutative_ideals.cpython-314t-aarch64-linux-musl.so +0 -0
  527. sage/rings/noncommutative_ideals.pyx +423 -0
  528. sage/rings/number_field/all__sagemath_categories.py +1 -0
  529. sage/rings/number_field/number_field_base.cpython-314t-aarch64-linux-musl.so +0 -0
  530. sage/rings/number_field/number_field_base.pxd +8 -0
  531. sage/rings/number_field/number_field_base.pyx +507 -0
  532. sage/rings/number_field/number_field_element_base.cpython-314t-aarch64-linux-musl.so +0 -0
  533. sage/rings/number_field/number_field_element_base.pxd +6 -0
  534. sage/rings/number_field/number_field_element_base.pyx +36 -0
  535. sage/rings/number_field/number_field_ideal.py +3550 -0
  536. sage/rings/padics/all__sagemath_categories.py +4 -0
  537. sage/rings/padics/local_generic.py +1670 -0
  538. sage/rings/padics/local_generic_element.cpython-314t-aarch64-linux-musl.so +0 -0
  539. sage/rings/padics/local_generic_element.pxd +5 -0
  540. sage/rings/padics/local_generic_element.pyx +1017 -0
  541. sage/rings/padics/misc.py +256 -0
  542. sage/rings/padics/padic_generic.py +1911 -0
  543. sage/rings/padics/pow_computer.cpython-314t-aarch64-linux-musl.so +0 -0
  544. sage/rings/padics/pow_computer.pxd +38 -0
  545. sage/rings/padics/pow_computer.pyx +671 -0
  546. sage/rings/padics/precision_error.py +24 -0
  547. sage/rings/polynomial/all__sagemath_categories.py +25 -0
  548. sage/rings/polynomial/commutative_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
  549. sage/rings/polynomial/commutative_polynomial.pxd +6 -0
  550. sage/rings/polynomial/commutative_polynomial.pyx +24 -0
  551. sage/rings/polynomial/cyclotomic.cpython-314t-aarch64-linux-musl.so +0 -0
  552. sage/rings/polynomial/cyclotomic.pyx +404 -0
  553. sage/rings/polynomial/flatten.py +711 -0
  554. sage/rings/polynomial/ideal.py +102 -0
  555. sage/rings/polynomial/infinite_polynomial_element.py +1768 -0
  556. sage/rings/polynomial/infinite_polynomial_ring.py +1653 -0
  557. sage/rings/polynomial/laurent_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
  558. sage/rings/polynomial/laurent_polynomial.pxd +18 -0
  559. sage/rings/polynomial/laurent_polynomial.pyx +2190 -0
  560. sage/rings/polynomial/laurent_polynomial_ideal.py +590 -0
  561. sage/rings/polynomial/laurent_polynomial_ring.py +832 -0
  562. sage/rings/polynomial/laurent_polynomial_ring_base.py +708 -0
  563. sage/rings/polynomial/multi_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
  564. sage/rings/polynomial/multi_polynomial.pxd +12 -0
  565. sage/rings/polynomial/multi_polynomial.pyx +3082 -0
  566. sage/rings/polynomial/multi_polynomial_element.py +2570 -0
  567. sage/rings/polynomial/multi_polynomial_ideal.py +5771 -0
  568. sage/rings/polynomial/multi_polynomial_ring.py +947 -0
  569. sage/rings/polynomial/multi_polynomial_ring_base.cpython-314t-aarch64-linux-musl.so +0 -0
  570. sage/rings/polynomial/multi_polynomial_ring_base.pxd +15 -0
  571. sage/rings/polynomial/multi_polynomial_ring_base.pyx +1855 -0
  572. sage/rings/polynomial/multi_polynomial_sequence.py +2204 -0
  573. sage/rings/polynomial/polydict.cpython-314t-aarch64-linux-musl.so +0 -0
  574. sage/rings/polynomial/polydict.pxd +45 -0
  575. sage/rings/polynomial/polydict.pyx +2701 -0
  576. sage/rings/polynomial/polynomial_compiled.cpython-314t-aarch64-linux-musl.so +0 -0
  577. sage/rings/polynomial/polynomial_compiled.pxd +59 -0
  578. sage/rings/polynomial/polynomial_compiled.pyx +509 -0
  579. sage/rings/polynomial/polynomial_element.cpython-314t-aarch64-linux-musl.so +0 -0
  580. sage/rings/polynomial/polynomial_element.pxd +64 -0
  581. sage/rings/polynomial/polynomial_element.pyx +13255 -0
  582. sage/rings/polynomial/polynomial_element_generic.py +1637 -0
  583. sage/rings/polynomial/polynomial_fateman.py +97 -0
  584. sage/rings/polynomial/polynomial_quotient_ring.py +2465 -0
  585. sage/rings/polynomial/polynomial_quotient_ring_element.py +779 -0
  586. sage/rings/polynomial/polynomial_ring.py +3784 -0
  587. sage/rings/polynomial/polynomial_ring_constructor.py +1051 -0
  588. sage/rings/polynomial/polynomial_ring_homomorphism.cpython-314t-aarch64-linux-musl.so +0 -0
  589. sage/rings/polynomial/polynomial_ring_homomorphism.pxd +5 -0
  590. sage/rings/polynomial/polynomial_ring_homomorphism.pyx +121 -0
  591. sage/rings/polynomial/polynomial_singular_interface.py +549 -0
  592. sage/rings/polynomial/symmetric_ideal.py +989 -0
  593. sage/rings/polynomial/symmetric_reduction.cpython-314t-aarch64-linux-musl.so +0 -0
  594. sage/rings/polynomial/symmetric_reduction.pxd +8 -0
  595. sage/rings/polynomial/symmetric_reduction.pyx +669 -0
  596. sage/rings/polynomial/term_order.py +2279 -0
  597. sage/rings/polynomial/toy_buchberger.py +449 -0
  598. sage/rings/polynomial/toy_d_basis.py +387 -0
  599. sage/rings/polynomial/toy_variety.py +362 -0
  600. sage/rings/power_series_mpoly.cpython-314t-aarch64-linux-musl.so +0 -0
  601. sage/rings/power_series_mpoly.pxd +9 -0
  602. sage/rings/power_series_mpoly.pyx +161 -0
  603. sage/rings/power_series_poly.cpython-314t-aarch64-linux-musl.so +0 -0
  604. sage/rings/power_series_poly.pxd +10 -0
  605. sage/rings/power_series_poly.pyx +1317 -0
  606. sage/rings/power_series_ring.py +1441 -0
  607. sage/rings/power_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
  608. sage/rings/power_series_ring_element.pxd +12 -0
  609. sage/rings/power_series_ring_element.pyx +3028 -0
  610. sage/rings/puiseux_series_ring.py +487 -0
  611. sage/rings/puiseux_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
  612. sage/rings/puiseux_series_ring_element.pxd +7 -0
  613. sage/rings/puiseux_series_ring_element.pyx +1055 -0
  614. sage/rings/qqbar_decorators.py +167 -0
  615. sage/rings/quotient_ring.py +1598 -0
  616. sage/rings/quotient_ring_element.py +979 -0
  617. sage/rings/rational.cpython-314t-aarch64-linux-musl.so +0 -0
  618. sage/rings/rational.pxd +20 -0
  619. sage/rings/rational.pyx +4284 -0
  620. sage/rings/rational_field.py +1730 -0
  621. sage/rings/real_double.cpython-314t-aarch64-linux-musl.so +0 -0
  622. sage/rings/real_double.pxd +16 -0
  623. sage/rings/real_double.pyx +2218 -0
  624. sage/rings/real_lazy.cpython-314t-aarch64-linux-musl.so +0 -0
  625. sage/rings/real_lazy.pxd +30 -0
  626. sage/rings/real_lazy.pyx +1773 -0
  627. sage/rings/ring.cpython-314t-aarch64-linux-musl.so +0 -0
  628. sage/rings/ring.pxd +30 -0
  629. sage/rings/ring.pyx +850 -0
  630. sage/rings/semirings/all.py +3 -0
  631. sage/rings/semirings/non_negative_integer_semiring.py +107 -0
  632. sage/rings/semirings/tropical_mpolynomial.py +972 -0
  633. sage/rings/semirings/tropical_polynomial.py +997 -0
  634. sage/rings/semirings/tropical_semiring.cpython-314t-aarch64-linux-musl.so +0 -0
  635. sage/rings/semirings/tropical_semiring.pyx +676 -0
  636. sage/rings/semirings/tropical_variety.py +1701 -0
  637. sage/rings/sum_of_squares.cpython-314t-aarch64-linux-musl.so +0 -0
  638. sage/rings/sum_of_squares.pxd +3 -0
  639. sage/rings/sum_of_squares.pyx +336 -0
  640. sage/rings/tests.py +504 -0
  641. sage/schemes/affine/affine_homset.py +508 -0
  642. sage/schemes/affine/affine_morphism.py +1574 -0
  643. sage/schemes/affine/affine_point.py +460 -0
  644. sage/schemes/affine/affine_rational_point.py +308 -0
  645. sage/schemes/affine/affine_space.py +1264 -0
  646. sage/schemes/affine/affine_subscheme.py +592 -0
  647. sage/schemes/affine/all.py +25 -0
  648. sage/schemes/all__sagemath_categories.py +5 -0
  649. sage/schemes/generic/algebraic_scheme.py +2092 -0
  650. sage/schemes/generic/all.py +5 -0
  651. sage/schemes/generic/ambient_space.py +400 -0
  652. sage/schemes/generic/divisor.py +465 -0
  653. sage/schemes/generic/divisor_group.py +313 -0
  654. sage/schemes/generic/glue.py +84 -0
  655. sage/schemes/generic/homset.py +820 -0
  656. sage/schemes/generic/hypersurface.py +234 -0
  657. sage/schemes/generic/morphism.py +2107 -0
  658. sage/schemes/generic/point.py +237 -0
  659. sage/schemes/generic/scheme.py +1190 -0
  660. sage/schemes/generic/spec.py +199 -0
  661. sage/schemes/product_projective/all.py +6 -0
  662. sage/schemes/product_projective/homset.py +236 -0
  663. sage/schemes/product_projective/morphism.py +517 -0
  664. sage/schemes/product_projective/point.py +568 -0
  665. sage/schemes/product_projective/rational_point.py +550 -0
  666. sage/schemes/product_projective/space.py +1301 -0
  667. sage/schemes/product_projective/subscheme.py +466 -0
  668. sage/schemes/projective/all.py +24 -0
  669. sage/schemes/projective/proj_bdd_height.py +453 -0
  670. sage/schemes/projective/projective_homset.py +718 -0
  671. sage/schemes/projective/projective_morphism.py +2792 -0
  672. sage/schemes/projective/projective_point.py +1484 -0
  673. sage/schemes/projective/projective_rational_point.py +569 -0
  674. sage/schemes/projective/projective_space.py +2571 -0
  675. sage/schemes/projective/projective_subscheme.py +1574 -0
  676. sage/sets/all.py +17 -0
  677. sage/sets/cartesian_product.py +376 -0
  678. sage/sets/condition_set.py +525 -0
  679. sage/sets/disjoint_set.cpython-314t-aarch64-linux-musl.so +0 -0
  680. sage/sets/disjoint_set.pxd +36 -0
  681. sage/sets/disjoint_set.pyx +998 -0
  682. sage/sets/disjoint_union_enumerated_sets.py +625 -0
  683. sage/sets/family.cpython-314t-aarch64-linux-musl.so +0 -0
  684. sage/sets/family.pxd +12 -0
  685. sage/sets/family.pyx +1556 -0
  686. sage/sets/finite_enumerated_set.py +406 -0
  687. sage/sets/finite_set_map_cy.cpython-314t-aarch64-linux-musl.so +0 -0
  688. sage/sets/finite_set_map_cy.pxd +34 -0
  689. sage/sets/finite_set_map_cy.pyx +708 -0
  690. sage/sets/finite_set_maps.py +591 -0
  691. sage/sets/image_set.py +448 -0
  692. sage/sets/integer_range.py +829 -0
  693. sage/sets/non_negative_integers.py +241 -0
  694. sage/sets/positive_integers.py +93 -0
  695. sage/sets/primes.py +188 -0
  696. sage/sets/real_set.py +2760 -0
  697. sage/sets/recursively_enumerated_set.cpython-314t-aarch64-linux-musl.so +0 -0
  698. sage/sets/recursively_enumerated_set.pxd +31 -0
  699. sage/sets/recursively_enumerated_set.pyx +2082 -0
  700. sage/sets/set.py +2083 -0
  701. sage/sets/set_from_iterator.py +1021 -0
  702. sage/sets/totally_ordered_finite_set.py +329 -0
  703. sage/symbolic/all__sagemath_categories.py +1 -0
  704. sage/symbolic/function.cpython-314t-aarch64-linux-musl.so +0 -0
  705. sage/symbolic/function.pxd +29 -0
  706. sage/symbolic/function.pyx +1488 -0
  707. sage/symbolic/symbols.py +56 -0
  708. sage/tests/all__sagemath_categories.py +1 -0
  709. sage/tests/cython.cpython-314t-aarch64-linux-musl.so +0 -0
  710. sage/tests/cython.pyx +37 -0
  711. sage/tests/stl_vector.cpython-314t-aarch64-linux-musl.so +0 -0
  712. sage/tests/stl_vector.pyx +171 -0
  713. sage/typeset/all.py +6 -0
  714. sage/typeset/ascii_art.py +295 -0
  715. sage/typeset/character_art.py +789 -0
  716. sage/typeset/character_art_factory.py +572 -0
  717. sage/typeset/symbols.py +334 -0
  718. sage/typeset/unicode_art.py +183 -0
  719. sage/typeset/unicode_characters.py +101 -0
@@ -0,0 +1,2102 @@
1
+ # sage_setup: distribution = sagemath-categories
2
+ r"""
3
+ Bessel functions
4
+
5
+ This module provides symbolic Bessel and Hankel functions, and their
6
+ spherical versions. These functions use the `mpmath library`_ for numerical
7
+ evaluation and Maxima, GiNaC, Pynac for symbolics.
8
+
9
+ The main objects which are exported from this module are:
10
+
11
+ * :meth:`bessel_J(n, x) <Function_Bessel_J>` -- the Bessel J function
12
+ * :meth:`bessel_Y(n, x) <Function_Bessel_Y>` -- the Bessel Y function
13
+ * :meth:`bessel_I(n, x) <Function_Bessel_I>` -- the Bessel I function
14
+ * :meth:`bessel_K(n, x) <Function_Bessel_K>` -- the Bessel K function
15
+ * :meth:`Bessel(...) <Bessel>` -- a factory function for producing Bessel functions of
16
+ various kinds and orders
17
+ * :meth:`hankel1(nu, z) <Function_Hankel1>` -- the Hankel function of the first kind
18
+ * :meth:`hankel2(nu, z) <Function_Hankel2>` -- the Hankel function of the second kind
19
+ * :meth:`struve_H(nu, z) <Function_Struve_H>` -- the Struve function
20
+ * :meth:`struve_L(nu, z) <Function_Struve_L>` -- the modified Struve function
21
+ * :meth:`spherical_bessel_J(n, z) <SphericalBesselJ>` -- the Spherical Bessel J function
22
+ * :meth:`spherical_bessel_Y(n, z) <SphericalBesselY>` -- the Spherical Bessel J function
23
+ * :meth:`spherical_hankel1(n, z) <SphericalHankel1>` -- the Spherical Hankel function of the first kind
24
+ * :meth:`spherical_hankel2(n, z) <SphericalHankel2>` -- the Spherical Hankel function of the second kind
25
+
26
+ - Bessel functions, first defined by the Swiss mathematician
27
+ Daniel Bernoulli and named after Friedrich Bessel, are canonical
28
+ solutions y(x) of Bessel's differential equation:
29
+
30
+ .. MATH::
31
+
32
+ x^2 \frac{d^2 y}{dx^2} + x \frac{dy}{dx} + \left(x^2 - \nu^2\right)y =
33
+ 0,
34
+
35
+ for an arbitrary complex number `\nu` (the order).
36
+
37
+ - In this module, `J_\nu` denotes the unique solution of Bessel's equation
38
+ which is non-singular at `x = 0`. This function is known as the Bessel
39
+ Function of the First Kind. This function also arises as a special case
40
+ of the hypergeometric function `{}_0F_1`:
41
+
42
+ .. MATH::
43
+
44
+ J_\nu(x) = \frac{x^n}{2^\nu \Gamma(\nu + 1)} {}_0F_1(\nu +
45
+ 1, -\frac{x^2}{4}).
46
+
47
+ - The second linearly independent solution to Bessel's equation (which is
48
+ singular at `x=0`) is denoted by `Y_\nu` and is called the Bessel
49
+ Function of the Second Kind:
50
+
51
+ .. MATH::
52
+
53
+ Y_\nu(x) = \frac{ J_\nu(x) \cos(\pi \nu) -
54
+ J_{-\nu}(x)}{\sin(\pi \nu)}.
55
+
56
+ - There are also two commonly used combinations of the Bessel J and Y
57
+ Functions. The Bessel I Function, or the Modified Bessel Function of the
58
+ First Kind, is defined by:
59
+
60
+ .. MATH::
61
+
62
+ I_\nu(x) = i^{-\nu} J_\nu(ix).
63
+
64
+ The Bessel K Function, or the Modified Bessel Function of the Second Kind,
65
+ is defined by:
66
+
67
+ .. MATH::
68
+
69
+ K_\nu(x) = \frac{\pi}{2} \cdot \frac{I_{-\nu}(x) -
70
+ I_n(x)}{\sin(\pi \nu)}.
71
+
72
+ We should note here that the above formulas for Bessel Y and K functions
73
+ should be understood as limits when `\nu` is an integer.
74
+
75
+ - It follows from Bessel's differential equation that the derivative of
76
+ `J_n(x)` with respect to `x` is:
77
+
78
+ .. MATH::
79
+
80
+ \frac{d}{dx} J_n(x) = \frac{1}{x^n} \left(x^n J_{n-1}(x) - n x^{n-1}
81
+ J_n(z) \right)
82
+
83
+ - Another important formulation of the two linearly independent
84
+ solutions to Bessel's equation are the Hankel functions
85
+ `H_\nu^{(1)}(x)` and `H_\nu^{(2)}(x)`,
86
+ defined by:
87
+
88
+ .. MATH::
89
+
90
+ H_\nu^{(1)}(x) = J_\nu(x) + i Y_\nu(x)
91
+
92
+ .. MATH::
93
+
94
+ H_\nu^{(2)}(x) = J_\nu(x) - i Y_\nu(x)
95
+
96
+ where `i` is the imaginary unit (and `J_*` and
97
+ `Y_*` are the usual J- and Y-Bessel functions). These
98
+ linear combinations are also known as Bessel functions of the third
99
+ kind; they are also two linearly independent solutions of Bessel's
100
+ differential equation. They are named for Hermann Hankel.
101
+
102
+ - When solving for separable solutions of Laplace's equation in
103
+ spherical coordinates, the radial equation has the form:
104
+
105
+ .. MATH::
106
+
107
+ x^2 \frac{d^2 y}{dx^2} + 2x \frac{dy}{dx} + [x^2 - n(n+1)]y = 0.
108
+
109
+ The spherical Bessel functions `j_n` and `y_n`,
110
+ are two linearly independent solutions to this equation. They are
111
+ related to the ordinary Bessel functions `J_n` and
112
+ `Y_n` by:
113
+
114
+ .. MATH::
115
+
116
+ j_n(x) = \sqrt{\frac{\pi}{2x}} J_{n+1/2}(x),
117
+
118
+ .. MATH::
119
+
120
+ y_n(x) = \sqrt{\frac{\pi}{2x}} Y_{n+1/2}(x) = (-1)^{n+1} \sqrt{\frac{\pi}{2x}} J_{-n-1/2}(x).
121
+
122
+ EXAMPLES:
123
+
124
+ Evaluate the Bessel J function symbolically and numerically::
125
+
126
+ sage: # needs sage.symbolic
127
+ sage: bessel_J(0, x)
128
+ bessel_J(0, x)
129
+ sage: bessel_J(0, 0)
130
+ 1
131
+ sage: bessel_J(0, x).diff(x)
132
+ -1/2*bessel_J(1, x) + 1/2*bessel_J(-1, x)
133
+ sage: N(bessel_J(0, 0), digits=20)
134
+ 1.0000000000000000000
135
+ sage: find_root(bessel_J(0,x), 0, 5) # needs scipy
136
+ 2.404825557695773
137
+
138
+ Plot the Bessel J function::
139
+
140
+ sage: f(x) = Bessel(0)(x); f # needs sage.symbolic
141
+ x |--> bessel_J(0, x)
142
+ sage: plot(f, (x, 1, 10)) # needs sage.plot sage.symbolic
143
+ Graphics object consisting of 1 graphics primitive
144
+
145
+ Visualize the Bessel Y function on the complex plane
146
+ (set plot_points to a higher value to get more detail)::
147
+
148
+ sage: complex_plot(bessel_Y(0, x), (-5, 5), (-5, 5), plot_points=20) # needs sage.plot sage.symbolic
149
+ Graphics object consisting of 1 graphics primitive
150
+
151
+ Evaluate a combination of Bessel functions::
152
+
153
+ sage: # needs sage.symbolic
154
+ sage: f(x) = bessel_J(1, x) - bessel_Y(0, x)
155
+ sage: f(pi)
156
+ bessel_J(1, pi) - bessel_Y(0, pi)
157
+ sage: f(pi).n()
158
+ -0.0437509653365599
159
+ sage: f(pi).n(digits=50)
160
+ -0.043750965336559909054985168023342675387737118378169
161
+
162
+ Symbolically solve a second order differential equation with initial
163
+ conditions `y(1) = a` and `y'(1) = b` in terms of Bessel functions::
164
+
165
+ sage: # needs sage.symbolic
166
+ sage: y = function('y')(x)
167
+ sage: a, b = var('a, b')
168
+ sage: diffeq = x^2*diff(y,x,x) + x*diff(y,x) + x^2*y == 0
169
+ sage: f = desolve(diffeq, y, [1, a, b]); f
170
+ (a*bessel_Y(1, 1) + b*bessel_Y(0, 1))*bessel_J(0, x)/(bessel_J(0,
171
+ 1)*bessel_Y(1, 1) - bessel_J(1, 1)*bessel_Y(0, 1)) -
172
+ (a*bessel_J(1, 1) + b*bessel_J(0, 1))*bessel_Y(0, x)/(bessel_J(0,
173
+ 1)*bessel_Y(1, 1) - bessel_J(1, 1)*bessel_Y(0, 1))
174
+
175
+
176
+ For more examples, see the docstring for :meth:`Bessel`.
177
+
178
+ AUTHORS:
179
+
180
+ - Some of the documentation here has been adapted from David Joyner's
181
+ original documentation of Sage's special functions module (2006).
182
+
183
+ REFERENCES:
184
+
185
+ - [AS-Bessel]_
186
+
187
+ - [AS-Spherical]_
188
+
189
+ - [AS-Struve]_
190
+
191
+ - [DLMF-Bessel]_
192
+
193
+ - [DLMF-Struve]_
194
+
195
+ .. _`mpmath library`: http://mpmath.org
196
+
197
+ - [WP-Bessel]_
198
+
199
+ - [WP-Struve]_
200
+ """
201
+ # ****************************************************************************
202
+ # Copyright (C) 2013 Benjamin Jones <benjaminfjones@gmail.com>
203
+ #
204
+ # Distributed under the terms of the GNU General Public License (GPL)
205
+ #
206
+ # This code is distributed in the hope that it will be useful,
207
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
208
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
209
+ # General Public License for more details.
210
+ #
211
+ # The full text of the GPL is available at:
212
+ #
213
+ # https://www.gnu.org/licenses/
214
+ # ****************************************************************************
215
+
216
+ from sage.misc.functional import sqrt
217
+ from sage.functions.log import exp
218
+ from sage.functions.gamma import gamma
219
+ from sage.functions.hyperbolic import sinh, cosh
220
+ from sage.functions.trig import sin, cos
221
+ from sage.misc.lazy_import import lazy_import
222
+ from sage.rings.infinity import infinity, unsigned_infinity
223
+ from sage.rings.integer import Integer
224
+ from sage.rings.integer_ring import ZZ
225
+ from sage.rings.rational_field import QQ
226
+ from sage.structure.element import Expression, get_coercion_model
227
+ from sage.symbolic.function import BuiltinFunction
228
+
229
+ lazy_import('sage.misc.latex', 'latex')
230
+
231
+ lazy_import('sage.symbolic.constants', 'pi')
232
+ lazy_import('sage.symbolic.ring', 'SR')
233
+
234
+ lazy_import('sage.libs.mpmath.utils', 'call', as_='_mpmath_utils_call')
235
+ lazy_import('mpmath',
236
+ ['besseli', 'besselj', 'besselk',
237
+ 'bessely', 'hankel1', 'hankel2',
238
+ 'struveh', 'struvel'],
239
+ as_=['_mpmath_besseli', '_mpmath_besselj', '_mpmath_besselk',
240
+ '_mpmath_bessely', '_mpmath_hankel1', '_mpmath_hankel2',
241
+ '_mpmath_struveh', '_mpmath_struvel'])
242
+
243
+
244
+ class Function_Bessel_J(BuiltinFunction):
245
+ r"""
246
+ The Bessel J Function, denoted by bessel_J(`\nu`, x) or `J_\nu(x)`.
247
+ As a Taylor series about `x=0` it is equal to:
248
+
249
+ .. MATH::
250
+
251
+ J_\nu(x) = \sum_{k=0}^\infty \frac{(-1)^k}{k! \Gamma(k+\nu+1)}
252
+ \left(\frac{x}{2}\right)^{2k+\nu}
253
+
254
+ The parameter `\nu` is called the order and may be any real or
255
+ complex number; however, integer and half-integer values are most
256
+ common. It is defined for all complex numbers `x` when `\nu`
257
+ is an integer or greater than zero and it diverges as `x \to 0`
258
+ for negative non-integer values of `\nu`.
259
+
260
+ For integer orders `\nu = n` there is an integral representation:
261
+
262
+ .. MATH::
263
+
264
+ J_n(x) = \frac{1}{\pi} \int_0^\pi \cos(n t - x \sin(t)) \; dt
265
+
266
+ This function also arises as a special case of the hypergeometric
267
+ function `{}_0F_1`:
268
+
269
+ .. MATH::
270
+
271
+ J_\nu(x) = \frac{x^n}{2^\nu \Gamma(\nu + 1)} {}_0F_1\left(\nu +
272
+ 1, -\frac{x^2}{4}\right).
273
+
274
+ EXAMPLES::
275
+
276
+ sage: bessel_J(1.0, 1.0) # needs mpmath
277
+ 0.440050585744933
278
+
279
+ sage: # needs sage.symbolic
280
+ sage: bessel_J(2, I).n(digits=30)
281
+ -0.135747669767038281182852569995
282
+ sage: bessel_J(1, x)
283
+ bessel_J(1, x)
284
+ sage: n = var('n')
285
+ sage: bessel_J(n, x)
286
+ bessel_J(n, x)
287
+
288
+ Examples of symbolic manipulation::
289
+
290
+ sage: # needs sage.symbolic
291
+ sage: a = bessel_J(pi, bessel_J(1, I)); a
292
+ bessel_J(pi, bessel_J(1, I))
293
+ sage: N(a, digits=20)
294
+ 0.00059023706363796717363 - 0.0026098820470081958110*I
295
+ sage: f = bessel_J(2, x)
296
+ sage: f.diff(x)
297
+ -1/2*bessel_J(3, x) + 1/2*bessel_J(1, x)
298
+
299
+ Comparison to a well-known integral representation of `J_1(1)`::
300
+
301
+ sage: A = numerical_integral(1/pi*cos(x - sin(x)), 0, pi) # needs sage.symbolic
302
+ sage: A[0] # abs tol 1e-14 # needs sage.symbolic
303
+ 0.44005058574493355
304
+ sage: bessel_J(1.0, 1.0) - A[0] < 1e-15 # needs sage.symbolic
305
+ True
306
+
307
+ Integration is supported directly and through Maxima::
308
+
309
+ sage: f = bessel_J(2, x) # needs sage.symbolic
310
+ sage: f.integrate(x) # needs sage.symbolic
311
+ 1/24*x^3*hypergeometric((3/2,), (5/2, 3), -1/4*x^2)
312
+
313
+ Visualization (set plot_points to a higher value to get more detail)::
314
+
315
+ sage: plot(bessel_J(1,x), (x,0,5), color='blue') # needs sage.plot sage.symbolic
316
+ Graphics object consisting of 1 graphics primitive
317
+ sage: complex_plot(bessel_J(1, x), (-5, 5), (-5, 5), plot_points=20) # needs sage.plot sage.symbolic
318
+ Graphics object consisting of 1 graphics primitive
319
+
320
+ ALGORITHM:
321
+
322
+ Numerical evaluation is handled by the mpmath library. Symbolics are
323
+ handled by a combination of Maxima and Sage (Ginac/Pynac).
324
+
325
+ Check whether the return value is real whenever the argument is real (:issue:`10251`)::
326
+
327
+ sage: bessel_J(5, 1.5) in RR # needs mpmath
328
+ True
329
+
330
+ REFERENCES:
331
+
332
+ - [AS-Bessel]_
333
+
334
+ - [DLMF-Bessel]_
335
+
336
+ - [AS-Bessel]_
337
+ """
338
+ def __init__(self):
339
+ """
340
+ See the docstring for :meth:`Function_Bessel_J`.
341
+
342
+ EXAMPLES::
343
+
344
+ sage: sage.functions.bessel.Function_Bessel_J()
345
+ bessel_J
346
+ sage: bessel_J(x, x)._sympy_() # needs sympy sage.symbolic
347
+ besselj(x, x)
348
+ """
349
+ BuiltinFunction.__init__(self, 'bessel_J', nargs=2,
350
+ conversions=dict(maple='BesselJ',
351
+ mathematica='BesselJ',
352
+ maxima='bessel_j',
353
+ sympy='besselj',
354
+ fricas='besselJ',
355
+ giac='BesselJ'))
356
+
357
+ def _eval_(self, n, x):
358
+ """
359
+ EXAMPLES::
360
+
361
+ sage: # needs sage.symbolic
362
+ sage: n = var('n')
363
+ sage: bessel_J(0, 0)
364
+ 1
365
+ sage: bessel_J(I, 0)
366
+ bessel_J(I, 0)
367
+ sage: bessel_J(5/2, 0)
368
+ 0
369
+ sage: bessel_J(-5/2, 0)
370
+ Infinity
371
+ sage: bessel_J(1/2, x)
372
+ sqrt(2)*sqrt(1/(pi*x))*sin(x)
373
+ sage: bessel_J(-1/2, x)
374
+ sqrt(2)*sqrt(1/(pi*x))*cos(x)
375
+ sage: bessel_J(n, 0)
376
+ bessel_J(n, 0)
377
+ """
378
+ if not isinstance(x, Expression) and x == 0:
379
+ if n == 0:
380
+ return ZZ.one()
381
+ elif n.real() > 0 or n in ZZ:
382
+ return ZZ.zero()
383
+ elif n.real() < 0:
384
+ return unsigned_infinity
385
+ if n == QQ((1, 2)):
386
+ return sqrt(2 / pi / x) * sin(x)
387
+ elif n == QQ((-1, 2)):
388
+ return sqrt(2 / pi / x) * cos(x)
389
+
390
+ def _evalf_(self, n, x, parent=None, algorithm=None):
391
+ """
392
+ EXAMPLES::
393
+
394
+ sage: bessel_J(0.0, 1.0) # needs mpmath
395
+ 0.765197686557967
396
+ sage: bessel_J(0, 1).n(digits=20) # needs sage.symbolic
397
+ 0.76519768655796655145
398
+ sage: bessel_J(0.5, 1.5) # needs mpmath
399
+ 0.649838074753747
400
+
401
+ Check for correct rounding (:issue:`17122`)::
402
+
403
+ sage: # needs sage.rings.real_mpfr
404
+ sage: R = RealField(113)
405
+ sage: a = R("8.935761195587725798762818805462843676e-01")
406
+ sage: aa = RealField(200)(a)
407
+ sage: for n in [-10..10]:
408
+ ....: b = bessel_J(R(n), a)
409
+ ....: bb = R(bessel_J(n, aa))
410
+ ....: if b != bb:
411
+ ....: print((n, b-bb))
412
+ """
413
+ if parent is not None:
414
+ x = parent(x)
415
+
416
+ try:
417
+ return x.jn(Integer(n))
418
+ except Exception:
419
+ pass
420
+
421
+ n, x = get_coercion_model().canonical_coercion(n, x)
422
+ return _mpmath_utils_call(_mpmath_besselj, n, x, parent=parent)
423
+
424
+ def _derivative_(self, n, x, diff_param):
425
+ """
426
+ Return the derivative of the Bessel J function.
427
+
428
+ EXAMPLES::
429
+
430
+ sage: # needs sage.symbolic
431
+ sage: f(z) = bessel_J(10, z)
432
+ sage: derivative(f, z)
433
+ z |--> -1/2*bessel_J(11, z) + 1/2*bessel_J(9, z)
434
+ sage: nu = var('nu')
435
+ sage: bessel_J(nu, z).diff(nu)
436
+ Traceback (most recent call last):
437
+ ...
438
+ NotImplementedError: derivative with respect to order
439
+ """
440
+ if diff_param == 1:
441
+ return (bessel_J(n - 1, x) - bessel_J(n + 1, x)) / Integer(2)
442
+ else:
443
+ raise NotImplementedError('derivative with respect to order')
444
+
445
+ def _print_latex_(self, n, z):
446
+ """
447
+ Custom ``_print_latex_`` method.
448
+
449
+ EXAMPLES::
450
+
451
+ sage: latex(bessel_J(1, x)) # needs sage.symbolic
452
+ J_{1}(x)
453
+ """
454
+ return r"J_{%s}(%s)" % (latex(n), latex(z))
455
+
456
+
457
+ bessel_J = Function_Bessel_J()
458
+
459
+
460
+ class Function_Bessel_Y(BuiltinFunction):
461
+ r"""
462
+ The Bessel Y functions, also known as the Bessel functions of the second
463
+ kind, Weber functions, or Neumann functions.
464
+
465
+ `Y_\nu(z)` is a holomorphic function of `z` on the complex plane,
466
+ cut along the negative real axis. It is singular at `z = 0`. When `z`
467
+ is fixed, `Y_\nu(z)` is an entire function of the order `\nu`.
468
+
469
+ DEFINITION:
470
+
471
+ .. MATH::
472
+
473
+ Y_n(z) = \frac{J_\nu(z) \cos(\nu z) -
474
+ J_{-\nu}(z)}{\sin(\nu z)}
475
+
476
+ Its derivative with respect to `z` is:
477
+
478
+ .. MATH::
479
+
480
+ \frac{d}{dz} Y_n(z) = \frac{1}{z^n} \left(z^n Y_{n-1}(z) - n z^{n-1}
481
+ Y_n(z) \right)
482
+
483
+ EXAMPLES::
484
+
485
+ sage: bessel_Y(1, x) # needs sage.symbolic
486
+ bessel_Y(1, x)
487
+ sage: bessel_Y(1.0, 1.0) # needs mpmath
488
+ -0.781212821300289
489
+
490
+ sage: # needs sage.symbolic
491
+ sage: n = var('n')
492
+ sage: bessel_Y(n, x)
493
+ bessel_Y(n, x)
494
+ sage: bessel_Y(2, I).n()
495
+ 1.03440456978312 - 0.135747669767038*I
496
+ sage: bessel_Y(0, 0).n()
497
+ -infinity
498
+ sage: bessel_Y(0, 1).n(128)
499
+ 0.088256964215676957982926766023515162828
500
+
501
+ Examples of symbolic manipulation::
502
+
503
+ sage: # needs sage.symbolic
504
+ sage: a = bessel_Y(pi, bessel_Y(1, I)); a
505
+ bessel_Y(pi, bessel_Y(1, I))
506
+ sage: N(a, digits=20)
507
+ 4.2059146571791095708 + 21.307914215321993526*I
508
+ sage: f = bessel_Y(2, x)
509
+ sage: f.diff(x)
510
+ -1/2*bessel_Y(3, x) + 1/2*bessel_Y(1, x)
511
+
512
+ High precision and complex valued inputs (see :issue:`4230`)::
513
+
514
+ sage: bessel_Y(0, 1).n(128) # needs sage.symbolic
515
+ 0.088256964215676957982926766023515162828
516
+ sage: bessel_Y(0, RealField(200)(1)) # needs sage.rings.real_mpfr
517
+ 0.088256964215676957982926766023515162827817523090675546711044
518
+ sage: bessel_Y(0, ComplexField(200)(0.5+I)) # needs sage.symbolic
519
+ 0.077763160184438051408593468823822434235010300228009867784073
520
+ + 1.0142336049916069152644677682828326441579314239591288411739*I
521
+
522
+ Visualization (set plot_points to a higher value to get more detail)::
523
+
524
+ sage: plot(bessel_Y(1, x), (x, 0, 5), color='blue') # needs sage.plot sage.symbolic
525
+ Graphics object consisting of 1 graphics primitive
526
+ sage: complex_plot(bessel_Y(1, x), (-5, 5), (-5, 5), plot_points=20) # needs sage.plot sage.symbolic
527
+ Graphics object consisting of 1 graphics primitive
528
+
529
+ ALGORITHM:
530
+
531
+ Numerical evaluation is handled by the mpmath library. Symbolics are
532
+ handled by a combination of Maxima and Sage (Ginac/Pynac).
533
+
534
+ TESTS:
535
+
536
+ Check whether the return value is real whenever the argument is real (:issue:`10251`)::
537
+
538
+ sage: bessel_Y(5, 1.5) in RR # needs mpmath
539
+ True
540
+
541
+ Coercion works correctly (see :issue:`17130`)::
542
+
543
+ sage: # needs sage.rings.real_mpfr
544
+ sage: r = bessel_Y(RealField(200)(1), 1.0); r
545
+ -0.781212821300289
546
+ sage: parent(r)
547
+ Real Field with 53 bits of precision
548
+ sage: r = bessel_Y(RealField(200)(1), 1); r
549
+ -0.78121282130028871654715000004796482054990639071644460784383
550
+ sage: parent(r)
551
+ Real Field with 200 bits of precision
552
+
553
+ REFERENCES:
554
+
555
+ - [AS-Bessel]_
556
+
557
+ - [DLMF-Bessel]_
558
+
559
+ - [WP-Bessel]_
560
+ """
561
+ def __init__(self):
562
+ """
563
+ See the docstring for :meth:`Function_Bessel_Y`.
564
+
565
+ EXAMPLES::
566
+
567
+ sage: sage.functions.bessel.Function_Bessel_Y()(0, x) # needs sage.symbolic
568
+ bessel_Y(0, x)
569
+ sage: bessel_Y(x, x)._sympy_() # needs sympy sage.symbolic
570
+ bessely(x, x)
571
+ """
572
+ BuiltinFunction.__init__(self, 'bessel_Y', nargs=2,
573
+ conversions=dict(maple='BesselY',
574
+ mathematica='BesselY',
575
+ maxima='bessel_y',
576
+ sympy='bessely',
577
+ fricas='besselY',
578
+ giac='BesselY'))
579
+
580
+ def _eval_(self, n, x):
581
+ """
582
+ EXAMPLES::
583
+
584
+ sage: # needs sage.symbolic
585
+ sage: bessel_Y(1, 0)
586
+ Infinity
587
+ sage: bessel_Y(I,0)
588
+ bessel_Y(I, 0)
589
+ sage: bessel_Y(1/2, x)
590
+ -sqrt(2)*sqrt(1/(pi*x))*cos(x)
591
+ sage: bessel_Y(-1/2, x)
592
+ sqrt(2)*sqrt(1/(pi*x))*sin(x)
593
+
594
+ TESTS::
595
+
596
+ sage: bessel_Y(0, 0) # needs sage.symbolic
597
+ -Infinity
598
+ """
599
+ if not isinstance(x, Expression) and x == 0:
600
+ if n == 0:
601
+ return -infinity
602
+ elif n.real() > 0 or n.real() < 0:
603
+ return unsigned_infinity
604
+ if n == QQ((1, 2)):
605
+ return -sqrt(2 / pi / x) * cos(x)
606
+ elif n == QQ((-1, 2)):
607
+ return sqrt(2 / pi / x) * sin(x)
608
+
609
+ def _evalf_(self, n, x, parent=None, algorithm=None):
610
+ """
611
+ EXAMPLES::
612
+
613
+ sage: bessel_Y(0.5, 1.5) # needs mpmath
614
+ -0.0460831658930974
615
+ sage: bessel_Y(1.0+2*I, 3.0+4*I) # needs mpmath sage.symbolic
616
+ 0.699410324467538 + 0.228917940896421*I
617
+ sage: bessel_Y(0, 1).n(256) # needs mpmath sage.symbolic
618
+ 0.08825696421567695798292676602351516282781752309067554671104384761199978932351
619
+
620
+ Check for correct rounding (:issue:`17122`)::
621
+
622
+ sage: # needs mpmath sage.rings.real_mpfr
623
+ sage: R = RealField(113)
624
+ sage: a = R("8.935761195587725798762818805462843676e-01")
625
+ sage: aa = RealField(200)(a)
626
+ sage: for n in [-10..10]:
627
+ ....: b = bessel_Y(R(n), a)
628
+ ....: bb = R(bessel_Y(n, aa))
629
+ ....: if b != bb:
630
+ ....: print((n, b-bb))
631
+ """
632
+ if parent is not None:
633
+ x = parent(x)
634
+
635
+ try:
636
+ return x.yn(Integer(n))
637
+ except Exception:
638
+ pass
639
+
640
+ n, x = get_coercion_model().canonical_coercion(n, x)
641
+ return _mpmath_utils_call(_mpmath_bessely, n, x, parent=parent)
642
+
643
+ def _derivative_(self, n, x, diff_param):
644
+ """
645
+ Return the derivative of the Bessel Y function.
646
+
647
+ EXAMPLES::
648
+
649
+ sage: # needs sage.symbolic
650
+ sage: f(x) = bessel_Y(10, x)
651
+ sage: derivative(f, x)
652
+ x |--> -1/2*bessel_Y(11, x) + 1/2*bessel_Y(9, x)
653
+ sage: nu = var('nu')
654
+ sage: bessel_Y(nu, x).diff(nu)
655
+ Traceback (most recent call last):
656
+ ...
657
+ NotImplementedError: derivative with respect to order
658
+ """
659
+ if diff_param == 1:
660
+ return (bessel_Y(n - 1, x) - bessel_Y(n + 1, x)) / Integer(2)
661
+ else:
662
+ raise NotImplementedError('derivative with respect to order')
663
+
664
+ def _print_latex_(self, n, z):
665
+ """
666
+ Custom ``_print_latex_`` method.
667
+
668
+ EXAMPLES::
669
+
670
+ sage: latex(bessel_Y(1, x)) # needs sage.symbolic
671
+ Y_{1}(x)
672
+ """
673
+ return r"Y_{%s}(%s)" % (latex(n), latex(z))
674
+
675
+
676
+ bessel_Y = Function_Bessel_Y()
677
+
678
+
679
+ class Function_Bessel_I(BuiltinFunction):
680
+ r"""
681
+ The Bessel I function, or the Modified Bessel Function of the First Kind.
682
+
683
+ DEFINITION:
684
+
685
+ .. MATH::
686
+
687
+ I_\nu(x) = i^{-\nu} J_\nu(ix)
688
+
689
+ EXAMPLES::
690
+
691
+ sage: bessel_I(1.0, 1.0) # needs mpmath
692
+ 0.565159103992485
693
+
694
+ sage: # needs sage.symbolic
695
+ sage: bessel_I(1, x)
696
+ bessel_I(1, x)
697
+ sage: n = var('n')
698
+ sage: bessel_I(n, x)
699
+ bessel_I(n, x)
700
+ sage: bessel_I(2, I).n()
701
+ -0.114903484931900
702
+
703
+ Examples of symbolic manipulation::
704
+
705
+ sage: # needs sage.symbolic
706
+ sage: a = bessel_I(pi, bessel_I(1, I))
707
+ sage: N(a, digits=20)
708
+ 0.00026073272117205890524 - 0.0011528954889080572268*I
709
+ sage: f = bessel_I(2, x)
710
+ sage: f.diff(x)
711
+ 1/2*bessel_I(3, x) + 1/2*bessel_I(1, x)
712
+
713
+ Special identities that bessel_I satisfies::
714
+
715
+ sage: # needs sage.symbolic
716
+ sage: bessel_I(1/2, x)
717
+ sqrt(2)*sqrt(1/(pi*x))*sinh(x)
718
+ sage: eq = bessel_I(1/2, x) == bessel_I(0.5, x)
719
+ sage: eq.test_relation()
720
+ True
721
+ sage: bessel_I(-1/2, x)
722
+ sqrt(2)*sqrt(1/(pi*x))*cosh(x)
723
+ sage: eq = bessel_I(-1/2, x) == bessel_I(-0.5, x)
724
+ sage: eq.test_relation()
725
+ True
726
+
727
+ Examples of asymptotic behavior::
728
+
729
+ sage: limit(bessel_I(0, x), x=oo) # needs sage.symbolic
730
+ +Infinity
731
+ sage: limit(bessel_I(0, x), x=0) # needs sage.symbolic
732
+ 1
733
+
734
+ High precision and complex valued inputs::
735
+
736
+ sage: bessel_I(0, 1).n(128) # needs sage.symbolic
737
+ 1.2660658777520083355982446252147175376
738
+ sage: bessel_I(0, RealField(200)(1)) # needs sage.rings.real_mpfr
739
+ 1.2660658777520083355982446252147175376076703113549622068081
740
+ sage: bessel_I(0, ComplexField(200)(0.5+I)) # needs sage.symbolic
741
+ 0.80644357583493619472428518415019222845373366024179916785502
742
+ + 0.22686958987911161141397453401487525043310874687430711021434*I
743
+
744
+ Visualization (set plot_points to a higher value to get more detail)::
745
+
746
+ sage: plot(bessel_I(1, x), (x, 0, 5), color='blue') # needs sage.plot sage.symbolic
747
+ Graphics object consisting of 1 graphics primitive
748
+ sage: complex_plot(bessel_I(1, x), (-5, 5), (-5, 5), plot_points=20) # needs sage.plot sage.symbolic
749
+ Graphics object consisting of 1 graphics primitive
750
+
751
+ ALGORITHM:
752
+
753
+ Numerical evaluation is handled by the mpmath library. Symbolics are
754
+ handled by a combination of Maxima and Sage (Ginac/Pynac).
755
+
756
+ TESTS::
757
+
758
+ sage: N(bessel_I(1,1),500) # needs sage.symbolic
759
+ 0.565159103992485027207696027609863307328899621621092009480294489479255640964371134092664997766814410064677886055526302676857637684917179812041131208121
760
+
761
+ Check whether the return value is real whenever the argument is real (:issue:`10251`)::
762
+
763
+ sage: bessel_I(5, 1.5) in RR # needs mpmath
764
+ True
765
+
766
+ REFERENCES:
767
+
768
+ - [AS-Bessel]_
769
+
770
+ - [DLMF-Bessel]_
771
+
772
+ - [WP-Bessel]_
773
+ """
774
+ def __init__(self):
775
+ """
776
+ See the docstring for :meth:`Function_Bessel_I`.
777
+
778
+ EXAMPLES::
779
+
780
+ sage: bessel_I(1, x) # needs sage.symbolic
781
+ bessel_I(1, x)
782
+ sage: bessel_I(x, x)._sympy_() # needs sympy sage.symbolic
783
+ besseli(x, x)
784
+ """
785
+ BuiltinFunction.__init__(self, 'bessel_I', nargs=2,
786
+ conversions=dict(maple='BesselI',
787
+ mathematica='BesselI',
788
+ maxima='bessel_i',
789
+ sympy='besseli',
790
+ fricas='besselI'))
791
+
792
+ def _eval_(self, n, x):
793
+ """
794
+ EXAMPLES::
795
+
796
+ sage: # needs sage.symbolic
797
+ sage: n,y = var('n,y')
798
+ sage: bessel_I(y, x)
799
+ bessel_I(y, x)
800
+ sage: bessel_I(0, 0)
801
+ 1
802
+ sage: bessel_I(7/2, 0)
803
+ 0
804
+ sage: bessel_I(-7/2, 0)
805
+ Infinity
806
+ sage: bessel_I(1/2, 1)
807
+ sqrt(2)*sinh(1)/sqrt(pi)
808
+ sage: bessel_I(-1/2, pi)
809
+ sqrt(2)*cosh(pi)/pi
810
+ sage: bessel_I(n, 0)
811
+ bessel_I(n, 0)
812
+ """
813
+ if not isinstance(x, Expression) and x == 0:
814
+ if n == 0:
815
+ return ZZ.one()
816
+ elif n.real() > 0 or n in ZZ:
817
+ return ZZ.zero()
818
+ elif n.real() < 0:
819
+ return unsigned_infinity
820
+ if n == QQ((1, 2)):
821
+ return sqrt(2 / (pi * x)) * sinh(x)
822
+ elif n == QQ((-1, 2)):
823
+ return sqrt(2 / (pi * x)) * cosh(x)
824
+
825
+ def _evalf_(self, n, x, parent=None, algorithm=None):
826
+ """
827
+ EXAMPLES::
828
+
829
+ sage: bessel_I(0.0, 1.0) # needs mpmath
830
+ 1.26606587775201
831
+ sage: bessel_I(1,3).n(digits=20) # needs sage.symbolic
832
+ 3.9533702174026093965
833
+ """
834
+ return _mpmath_utils_call(_mpmath_besseli, n, x, parent=parent)
835
+
836
+ def _derivative_(self, n, x, diff_param):
837
+ """
838
+ Return the derivative of the Bessel I function `I_n(x)` with respect
839
+ to `x`.
840
+
841
+ EXAMPLES::
842
+
843
+ sage: # needs sage.symbolic
844
+ sage: f(z) = bessel_I(10, x)
845
+ sage: derivative(f, x)
846
+ z |--> 1/2*bessel_I(11, x) + 1/2*bessel_I(9, x)
847
+ sage: nu = var('nu')
848
+ sage: bessel_I(nu, x).diff(nu)
849
+ Traceback (most recent call last):
850
+ ...
851
+ NotImplementedError: derivative with respect to order
852
+ """
853
+ if diff_param == 1:
854
+ return (bessel_I(n - 1, x) + bessel_I(n + 1, x)) / Integer(2)
855
+ else:
856
+ raise NotImplementedError('derivative with respect to order')
857
+
858
+ def _print_latex_(self, n, z):
859
+ """
860
+ Custom ``_print_latex_`` method.
861
+
862
+ EXAMPLES::
863
+
864
+ sage: latex(bessel_I(1, x)) # needs sage.symbolic
865
+ I_{1}(x)
866
+ """
867
+ return r"I_{%s}(%s)" % (latex(n), latex(z))
868
+
869
+
870
+ bessel_I = Function_Bessel_I()
871
+
872
+
873
+ class Function_Bessel_K(BuiltinFunction):
874
+ r"""
875
+ The Bessel K function, or the modified Bessel function of the second kind.
876
+
877
+ DEFINITION:
878
+
879
+ .. MATH::
880
+
881
+ K_\nu(x) = \frac{\pi}{2} \frac{I_{-\nu}(x)-I_\nu(x)}{\sin(\nu \pi)}
882
+
883
+ EXAMPLES::
884
+
885
+ sage: bessel_K(1.0, 1.0) # needs mpmath
886
+ 0.601907230197235
887
+
888
+ sage: # needs sage.symbolic
889
+ sage: bessel_K(1, x)
890
+ bessel_K(1, x)
891
+ sage: n = var('n')
892
+ sage: bessel_K(n, x)
893
+ bessel_K(n, x)
894
+ sage: bessel_K(2, I).n()
895
+ -2.59288617549120 + 0.180489972066962*I
896
+
897
+ Examples of symbolic manipulation::
898
+
899
+ sage: # needs sage.symbolic
900
+ sage: a = bessel_K(pi, bessel_K(1, I)); a
901
+ bessel_K(pi, bessel_K(1, I))
902
+ sage: N(a, digits=20)
903
+ 3.8507583115005220156 + 0.068528298579883425456*I
904
+ sage: f = bessel_K(2, x)
905
+ sage: f.diff(x)
906
+ -1/2*bessel_K(3, x) - 1/2*bessel_K(1, x)
907
+ sage: bessel_K(1/2, x)
908
+ sqrt(1/2)*sqrt(pi)*e^(-x)/sqrt(x)
909
+ sage: bessel_K(1/2, -1)
910
+ -I*sqrt(1/2)*sqrt(pi)*e
911
+ sage: bessel_K(1/2, 1)
912
+ sqrt(1/2)*sqrt(pi)*e^(-1)
913
+
914
+ Examples of asymptotic behavior::
915
+
916
+ sage: bessel_K(0, 0.0) # needs mpmath
917
+ +infinity
918
+ sage: limit(bessel_K(0, x), x=0) # needs sage.symbolic
919
+ +Infinity
920
+ sage: limit(bessel_K(0, x), x=oo) # needs sage.symbolic
921
+ 0
922
+
923
+ High precision and complex valued inputs::
924
+
925
+ sage: bessel_K(0, 1).n(128) # needs sage.symbolic
926
+ 0.42102443824070833333562737921260903614
927
+ sage: bessel_K(0, RealField(200)(1)) # needs sage.rings.real_mpfr
928
+ 0.42102443824070833333562737921260903613621974822666047229897
929
+ sage: bessel_K(0, ComplexField(200)(0.5+I)) # needs sage.rings.real_mpfr sage.symbolic
930
+ 0.058365979093103864080375311643360048144715516692187818271179
931
+ - 0.67645499731334483535184142196073004335768129348518210260256*I
932
+
933
+ Visualization (set plot_points to a higher value to get more detail)::
934
+
935
+ sage: plot(bessel_K(1,x), (x,0,5), color='blue') # needs sage.plot sage.symbolic
936
+ Graphics object consisting of 1 graphics primitive
937
+ sage: complex_plot(bessel_K(1, x), (-5, 5), (-5, 5), plot_points=20) # needs sage.plot sage.symbolic
938
+ Graphics object consisting of 1 graphics primitive
939
+
940
+ ALGORITHM:
941
+
942
+ Numerical evaluation is handled by the mpmath library. Symbolics are
943
+ handled by a combination of Maxima and Sage (Ginac/Pynac).
944
+
945
+ TESTS:
946
+
947
+ Verify that :issue:`3426` is fixed:
948
+
949
+ The Bessel K function can be evaluated numerically at complex orders::
950
+
951
+ sage: bessel_K(10 * I, 10).n() # needs sage.symbolic
952
+ 9.82415743819925e-8
953
+
954
+ For a fixed imaginary order and increasing, real, second component the
955
+ value of Bessel K is exponentially decaying::
956
+
957
+ sage: for x in [10, 20, 50, 100, 200]: print(bessel_K(5*I, x).n()) # needs sage.symbolic
958
+ 5.27812176514912e-6
959
+ 3.11005908421801e-10
960
+ 2.66182488515423e-23 - 8.59622057747552e-58*I
961
+ 4.11189776828337e-45 - 1.01494840019482e-80*I
962
+ 1.15159692553603e-88 - 6.75787862113718e-125*I
963
+
964
+ Check whether the return value is real whenever the argument is real (:issue:`10251`)::
965
+
966
+ sage: bessel_K(5, 1.5) in RR # needs mpmath
967
+ True
968
+
969
+ REFERENCES:
970
+
971
+ - [AS-Bessel]_
972
+
973
+ - [DLMF-Bessel]_
974
+
975
+ - [WP-Bessel]_
976
+ """
977
+ def __init__(self):
978
+ """
979
+ See the docstring for :meth:`Function_Bessel_K`.
980
+
981
+ EXAMPLES::
982
+
983
+ sage: sage.functions.bessel.Function_Bessel_K()
984
+ bessel_K
985
+ sage: bessel_K(x, x)._sympy_() # needs sympy sage.symbolic
986
+ besselk(x, x)
987
+ """
988
+ BuiltinFunction.__init__(self, 'bessel_K', nargs=2,
989
+ conversions=dict(maple='BesselK',
990
+ mathematica='BesselK',
991
+ maxima='bessel_k',
992
+ sympy='besselk',
993
+ fricas='besselK'))
994
+
995
+ def _eval_(self, n, x):
996
+ """
997
+ EXAMPLES::
998
+
999
+ sage: # needs sage.symbolic
1000
+ sage: n = var('n')
1001
+ sage: bessel_K(1, 0)
1002
+ Infinity
1003
+ sage: bessel_K(1/2, x)
1004
+ sqrt(1/2)*sqrt(pi)*e^(-x)/sqrt(x)
1005
+ sage: bessel_K(n, 0)
1006
+ bessel_K(n, 0)
1007
+
1008
+ TESTS::
1009
+
1010
+ sage: bessel_K(0, 0) # needs sage.symbolic
1011
+ +Infinity
1012
+ """
1013
+ if not isinstance(x, Expression) and x == 0:
1014
+ if n == 0:
1015
+ return infinity
1016
+ elif n.real() > 0 or n.real() < 0:
1017
+ return unsigned_infinity
1018
+ if n == QQ((1, 2)) or n == QQ((-1, 2)) and x > 0:
1019
+ return sqrt(pi / 2) * exp(-x) * x ** (-Integer(1) / Integer(2))
1020
+
1021
+ def _evalf_(self, n, x, parent=None, algorithm=None):
1022
+ """
1023
+ EXAMPLES::
1024
+
1025
+ sage: bessel_K(0.0, 1.0) # needs mpmath
1026
+ 0.421024438240708
1027
+ sage: bessel_K(-1, 1).n(128) # needs sage.symbolic
1028
+ 0.60190723019723457473754000153561733926
1029
+ sage: bessel_K(0, RealField(128)(1)) # needs sage.rings.real_mpfr
1030
+ 0.42102443824070833333562737921260903614
1031
+ """
1032
+ return _mpmath_utils_call(_mpmath_besselk, n, x, parent=parent)
1033
+
1034
+ def _derivative_(self, n, x, diff_param):
1035
+ """
1036
+ Return the derivative of the Bessel K function.
1037
+
1038
+ EXAMPLES::
1039
+
1040
+ sage: # needs sage.symbolic
1041
+ sage: f(x) = bessel_K(10, x)
1042
+ sage: derivative(f, x)
1043
+ x |--> -1/2*bessel_K(11, x) - 1/2*bessel_K(9, x)
1044
+ sage: nu = var('nu')
1045
+ sage: bessel_K(nu, x).diff(nu)
1046
+ Traceback (most recent call last):
1047
+ ...
1048
+ NotImplementedError: derivative with respect to order
1049
+ """
1050
+ if diff_param == 1:
1051
+ return -(bessel_K(n - 1, x) + bessel_K(n + 1, x)) / Integer(2)
1052
+ else:
1053
+ raise NotImplementedError('derivative with respect to order')
1054
+
1055
+ def _print_latex_(self, n, z):
1056
+ """
1057
+ Custom ``_print_latex_`` method.
1058
+
1059
+ EXAMPLES::
1060
+
1061
+ sage: latex(bessel_K(1, x)) # needs sage.symbolic
1062
+ K_{1}(x)
1063
+ """
1064
+ return r"K_{%s}(%s)" % (latex(n), latex(z))
1065
+
1066
+
1067
+ bessel_K = Function_Bessel_K()
1068
+
1069
+
1070
+ # dictionary used in Bessel
1071
+ bessel_type_dict = {'I': bessel_I, 'J': bessel_J, 'K': bessel_K, 'Y': bessel_Y}
1072
+
1073
+
1074
+ def Bessel(*args, **kwds):
1075
+ """
1076
+ A function factory that produces symbolic I, J, K, and Y Bessel functions.
1077
+ There are several ways to call this function:
1078
+
1079
+ - ``Bessel(order, type)``
1080
+ - ``Bessel(order)`` -- type defaults to ``'J'``
1081
+ - ``Bessel(order, typ=T)``
1082
+ - ``Bessel(typ=T)`` -- order is unspecified, this is a 2-parameter
1083
+ function
1084
+ - ``Bessel()`` -- order is unspecified, type is ``'J'``
1085
+
1086
+ where ``order`` can be any integer and ``T`` must be one of the strings ``'I'``,
1087
+ ``'J'``, ``'K'``, or ``'Y'``.
1088
+
1089
+ See the EXAMPLES below.
1090
+
1091
+ EXAMPLES:
1092
+
1093
+ Construction of Bessel functions with various orders and types::
1094
+
1095
+ sage: Bessel()
1096
+ bessel_J
1097
+ sage: Bessel(typ='K')
1098
+ bessel_K
1099
+
1100
+ sage: # needs sage.symbolic
1101
+ sage: Bessel(1)(x)
1102
+ bessel_J(1, x)
1103
+ sage: Bessel(1, 'Y')(x)
1104
+ bessel_Y(1, x)
1105
+ sage: Bessel(-2, 'Y')(x)
1106
+ bessel_Y(-2, x)
1107
+ sage: Bessel(0, typ='I')(x)
1108
+ bessel_I(0, x)
1109
+
1110
+ Evaluation::
1111
+
1112
+ sage: f = Bessel(1)
1113
+ sage: f(3.0) # needs mpmath
1114
+ 0.339058958525936
1115
+
1116
+ sage: # needs sage.symbolic
1117
+ sage: f(3)
1118
+ bessel_J(1, 3)
1119
+ sage: f(3).n(digits=50)
1120
+ 0.33905895852593645892551459720647889697308041819801
1121
+ sage: g = Bessel(typ='J')
1122
+ sage: g(1,3)
1123
+ bessel_J(1, 3)
1124
+ sage: g(2, 3+I).n()
1125
+ 0.634160370148554 + 0.0253384000032695*I
1126
+ sage: abs(numerical_integral(1/pi*cos(3*sin(x)), 0.0, pi)[0]
1127
+ ....: - Bessel(0, 'J')(3.0)) < 1e-15
1128
+ True
1129
+
1130
+ Symbolic calculus::
1131
+
1132
+ sage: f(x) = Bessel(0, 'J')(x) # needs sage.symbolic
1133
+ sage: derivative(f, x) # needs sage.symbolic
1134
+ x |--> -1/2*bessel_J(1, x) + 1/2*bessel_J(-1, x)
1135
+ sage: derivative(f, x, x) # needs sage.symbolic
1136
+ x |--> 1/4*bessel_J(2, x) - 1/2*bessel_J(0, x) + 1/4*bessel_J(-2, x)
1137
+
1138
+ Verify that `J_0` satisfies Bessel's differential equation numerically
1139
+ using the ``test_relation()`` method::
1140
+
1141
+ sage: y = bessel_J(0, x) # needs sage.symbolic
1142
+ sage: diffeq = x^2*derivative(y,x,x) + x*derivative(y,x) + x^2*y == 0 # needs sage.symbolic
1143
+ sage: diffeq.test_relation(proof=False) # needs sage.symbolic
1144
+ True
1145
+
1146
+ Conversion to other systems::
1147
+
1148
+ sage: # needs sage.symbolic
1149
+ sage: x,y = var('x,y')
1150
+ sage: f = Bessel(typ='K')(x,y)
1151
+ sage: expected = f.derivative(y)
1152
+ sage: actual = maxima(f).derivative('_SAGE_VAR_y').sage()
1153
+ sage: bool(actual == expected)
1154
+ True
1155
+
1156
+ Compute the particular solution to Bessel's Differential Equation that
1157
+ satisfies `y(1) = 1` and `y'(1) = 1`, then verify the initial conditions
1158
+ and plot it::
1159
+
1160
+ sage: # needs sage.symbolic
1161
+ sage: y = function('y')(x)
1162
+ sage: diffeq = x^2*diff(y,x,x) + x*diff(y,x) + x^2*y == 0
1163
+ sage: f = desolve(diffeq, y, [1, 1, 1]); f
1164
+ (bessel_Y(1, 1) + bessel_Y(0, 1))*bessel_J(0, x)/(bessel_J(0,
1165
+ 1)*bessel_Y(1, 1) - bessel_J(1, 1)*bessel_Y(0, 1)) - (bessel_J(1,
1166
+ 1) + bessel_J(0, 1))*bessel_Y(0, x)/(bessel_J(0, 1)*bessel_Y(1, 1)
1167
+ - bessel_J(1, 1)*bessel_Y(0, 1))
1168
+ sage: f.subs(x=1).n() # numerical verification
1169
+ 1.00000000000000
1170
+ sage: fp = f.diff(x)
1171
+ sage: fp.subs(x=1).n()
1172
+ 1.00000000000000
1173
+
1174
+ sage: f.subs(x=1).simplify_full() # symbolic verification # needs sage.symbolic
1175
+ 1
1176
+ sage: fp = f.diff(x) # needs sage.symbolic
1177
+ sage: fp.subs(x=1).simplify_full() # needs sage.symbolic
1178
+ 1
1179
+
1180
+ sage: plot(f, (x,0,5)) # needs sage.plot sage.symbolic
1181
+ Graphics object consisting of 1 graphics primitive
1182
+
1183
+ Plotting::
1184
+
1185
+ sage: f(x) = Bessel(0)(x); f # needs sage.symbolic
1186
+ x |--> bessel_J(0, x)
1187
+ sage: plot(f, (x, 1, 10)) # needs sage.plot sage.symbolic
1188
+ Graphics object consisting of 1 graphics primitive
1189
+
1190
+ sage: plot([Bessel(i, 'J') for i in range(5)], 2, 10) # needs sage.plot
1191
+ Graphics object consisting of 5 graphics primitives
1192
+
1193
+ sage: G = Graphics() # needs sage.plot
1194
+ sage: G += sum(plot(Bessel(i), 0, 4*pi, rgbcolor=hue(sin(pi*i/10))) # needs sage.plot sage.symbolic
1195
+ ....: for i in range(5))
1196
+ sage: show(G) # needs sage.plot
1197
+
1198
+ A recreation of Abramowitz and Stegun Figure 9.1::
1199
+
1200
+ sage: # needs sage.plot sage.symbolic
1201
+ sage: G = plot(Bessel(0, 'J'), 0, 15, color='black')
1202
+ sage: G += plot(Bessel(0, 'Y'), 0, 15, color='black')
1203
+ sage: G += plot(Bessel(1, 'J'), 0, 15, color='black', linestyle='dotted')
1204
+ sage: G += plot(Bessel(1, 'Y'), 0, 15, color='black', linestyle='dotted')
1205
+ sage: show(G, ymin=-1, ymax=1)
1206
+ """
1207
+ # Determine the order and type of function from the arguments and keywords.
1208
+ # These are recorded in local variables: _type, _order, _system, _nargs.
1209
+ _type = None
1210
+ if len(args) == 0: # no order specified
1211
+ _order = None
1212
+ _nargs = 2
1213
+ elif len(args) == 1: # order is specified
1214
+ _order = args[0]
1215
+ _nargs = 1
1216
+ elif len(args) == 2: # both order and type are positional arguments
1217
+ _order = args[0]
1218
+ _type = args[1]
1219
+ _nargs = 1
1220
+ else:
1221
+ raise ValueError("Too many arguments (%s given)" % str(len(args)))
1222
+
1223
+ # check for type inconsistency
1224
+ if _type is not None and 'typ' in kwds and _type != kwds['typ']:
1225
+ raise ValueError("inconsistent types given")
1226
+ # record the function type
1227
+ if _type is None:
1228
+ if 'typ' in kwds:
1229
+ _type = kwds['typ']
1230
+ else:
1231
+ _type = 'J'
1232
+ if _type not in ['I', 'J', 'K', 'Y']:
1233
+ raise ValueError("type must be one of I, J, K, Y")
1234
+
1235
+ # return the function
1236
+ _f = bessel_type_dict[_type]
1237
+ if _nargs == 1:
1238
+ return lambda x: _f(_order, x)
1239
+ else:
1240
+ return _f
1241
+
1242
+
1243
+ class Function_Struve_H(BuiltinFunction):
1244
+ r"""
1245
+ The Struve functions, solutions to the non-homogeneous Bessel differential equation:
1246
+
1247
+ .. MATH::
1248
+
1249
+ x^2\frac{d^2y}{dx^2}+x\frac{dy}{dx}+(x^2-\alpha^2)y=\frac{4\bigl(\frac{x}{2}\bigr)^{\alpha+1}}{\sqrt\pi\Gamma(\alpha+\tfrac12)},
1250
+
1251
+ .. MATH::
1252
+
1253
+ \mathrm{H}_\alpha(x) = y(x)
1254
+
1255
+ EXAMPLES::
1256
+
1257
+ sage: struve_H(-1/2, x) # needs sage.symbolic
1258
+ sqrt(2)*sqrt(1/(pi*x))*sin(x)
1259
+ sage: struve_H(2, x) # needs sage.symbolic
1260
+ struve_H(2, x)
1261
+ sage: struve_H(1/2, pi).n() # needs sage.symbolic
1262
+ 0.900316316157106
1263
+
1264
+ REFERENCES:
1265
+
1266
+ - [AS-Struve]_
1267
+
1268
+ - [DLMF-Struve]_
1269
+
1270
+ - [WP-Struve]_
1271
+ """
1272
+ def __init__(self):
1273
+ r"""
1274
+ EXAMPLES::
1275
+
1276
+ sage: # needs sage.symbolic
1277
+ sage: n = var('n')
1278
+ sage: maxima("struve_h(n,x);").sage()
1279
+ struve_H(n, x)
1280
+ sage: struve_H(7/5, 1)._maxima_()
1281
+ struve_h(7/5,1)
1282
+ sage: loads(dumps(struve_H(n,x)))
1283
+ struve_H(n, x)
1284
+ """
1285
+ BuiltinFunction.__init__(self, 'struve_H', nargs=2,
1286
+ conversions=dict(maple='StruveH',
1287
+ mathematica='StruveH',
1288
+ maxima='struve_h',
1289
+ fricas='struveH',
1290
+ sympy='struveh'))
1291
+
1292
+ def _eval_(self, a, z):
1293
+ """
1294
+ EXAMPLES::
1295
+
1296
+ sage: # needs sage.symbolic
1297
+ sage: struve_H(0, 0)
1298
+ 0
1299
+ sage: struve_H(pi, 0)
1300
+ 0
1301
+ sage: struve_H(-1/2, x)
1302
+ sqrt(2)*sqrt(1/(pi*x))*sin(x)
1303
+ sage: struve_H(1/2, -1)
1304
+ -sqrt(2)*sqrt(-1/pi)*(cos(1) - 1)
1305
+ sage: struve_H(1/2, pi)
1306
+ 2*sqrt(2)/pi
1307
+ sage: struve_H(2, x)
1308
+ struve_H(2, x)
1309
+ sage: struve_H(-3/2, x)
1310
+ -bessel_J(3/2, x)
1311
+ """
1312
+ if z.is_zero() \
1313
+ and (SR(a).is_numeric() or SR(a).is_constant()) \
1314
+ and a.real() >= -1:
1315
+ return ZZ.zero()
1316
+ if a == QQ((-1, 2)):
1317
+ return sqrt(2 / (pi * z)) * sin(z)
1318
+ if a == QQ((1, 2)):
1319
+ return sqrt(2 / (pi * z)) * (1 - cos(z))
1320
+ if a < 0 and not SR(a).is_integer() and SR(2 * a).is_integer():
1321
+ n = (a * (-2) - 1) / 2
1322
+ return Integer(-1)**n * bessel_J(n + QQ((1, 2)), z)
1323
+
1324
+ def _evalf_(self, a, z, parent=None, algorithm=None):
1325
+ """
1326
+ EXAMPLES::
1327
+
1328
+ sage: struve_H(1/2, pi).n() # needs sage.symbolic
1329
+ 0.900316316157106
1330
+ sage: struve_H(1/2, pi).n(200) # needs sage.symbolic
1331
+ 0.9003163161571060695551991910...
1332
+ """
1333
+ return _mpmath_utils_call(_mpmath_struveh, a, z, parent=parent)
1334
+
1335
+ def _derivative_(self, a, z, diff_param=None):
1336
+ """
1337
+ EXAMPLES::
1338
+
1339
+ sage: diff(struve_H(3/2,x), x) # needs sage.symbolic
1340
+ -1/2*sqrt(2)*sqrt(1/(pi*x))*(cos(x) - 1) + 1/16*sqrt(2)*x^(3/2)/sqrt(pi)
1341
+ - 1/2*struve_H(5/2, x)
1342
+ """
1343
+ if diff_param == 0:
1344
+ raise ValueError("cannot differentiate struve_H in the first parameter")
1345
+
1346
+ from .other import sqrt
1347
+ return (z**a / (sqrt(pi) * 2**a * gamma(a + Integer(3) / Integer(2))) - struve_H(a + 1, z) + struve_H(a - 1, z)) / 2
1348
+
1349
+ def _print_latex_(self, a, z):
1350
+ """
1351
+ EXAMPLES::
1352
+
1353
+ sage: latex(struve_H(2,x)) # needs sage.symbolic
1354
+ H_{{2}}({x})
1355
+ """
1356
+ return r"H_{{%s}}({%s})" % (a, z)
1357
+
1358
+
1359
+ struve_H = Function_Struve_H()
1360
+
1361
+
1362
+ class Function_Struve_L(BuiltinFunction):
1363
+ r"""
1364
+ The modified Struve functions.
1365
+
1366
+ .. MATH::
1367
+
1368
+ \mathrm{L}_\alpha(x) = -i\cdot e^{-\frac{i\alpha\pi}{2}}\cdot\mathrm{H}_\alpha(ix)
1369
+
1370
+ EXAMPLES::
1371
+
1372
+ sage: struve_L(2, x) # needs sage.symbolic
1373
+ struve_L(2, x)
1374
+ sage: struve_L(1/2, pi).n() # needs sage.symbolic
1375
+ 4.76805417696286
1376
+ sage: diff(struve_L(1,x), x) # needs sage.symbolic
1377
+ 1/3*x/pi - 1/2*struve_L(2, x) + 1/2*struve_L(0, x)
1378
+
1379
+ REFERENCES:
1380
+
1381
+ - [AS-Struve]_
1382
+
1383
+ - [DLMF-Struve]_
1384
+
1385
+ - [WP-Struve]_
1386
+ """
1387
+ def __init__(self):
1388
+ r"""
1389
+ EXAMPLES::
1390
+
1391
+ sage: # needs sage.symbolic
1392
+ sage: n = var('n')
1393
+ sage: maxima("struve_l(n,x);").sage()
1394
+ struve_L(n, x)
1395
+ sage: struve_L(7/5, 1)._maxima_()
1396
+ struve_l(7/5,1)
1397
+ sage: loads(dumps(struve_L(n, x)))
1398
+ struve_L(n, x)
1399
+ """
1400
+ BuiltinFunction.__init__(self, 'struve_L', nargs=2,
1401
+ conversions=dict(maple='StruveL',
1402
+ mathematica='StruveL',
1403
+ maxima='struve_l',
1404
+ fricas='struveL',
1405
+ sympy='struvel'))
1406
+
1407
+ def _eval_(self, a, z):
1408
+ """
1409
+ EXAMPLES::
1410
+
1411
+ sage: # needs sage.symbolic
1412
+ sage: struve_L(-2, 0)
1413
+ struve_L(-2, 0)
1414
+ sage: struve_L(-1, 0)
1415
+ 0
1416
+ sage: struve_L(pi, 0)
1417
+ 0
1418
+ sage: struve_L(-1/2, x)
1419
+ sqrt(2)*sqrt(1/(pi*x))*sinh(x)
1420
+ sage: struve_L(1/2, 1)
1421
+ sqrt(2)*(cosh(1) - 1)/sqrt(pi)
1422
+ sage: struve_L(2, x)
1423
+ struve_L(2, x)
1424
+ sage: struve_L(-3/2, x)
1425
+ -bessel_I(3/2, x)
1426
+ """
1427
+ if z.is_zero() \
1428
+ and (SR(a).is_numeric() or SR(a).is_constant()) \
1429
+ and a.real() >= -1:
1430
+ return ZZ.zero()
1431
+ if a == -Integer(1) / 2:
1432
+ return sqrt(2 / (pi * z)) * sinh(z)
1433
+ if a == Integer(1) / 2:
1434
+ return sqrt(2 / (pi * z)) * (cosh(z) - 1)
1435
+ if a < 0 and not SR(a).is_integer() and SR(2 * a).is_integer():
1436
+ n = (a * (-2) - 1) / 2
1437
+ return Integer(-1)**n * bessel_I(n + QQ((1, 2)), z)
1438
+
1439
+ def _evalf_(self, a, z, parent=None, algorithm=None):
1440
+ """
1441
+ EXAMPLES::
1442
+
1443
+ sage: struve_L(1/2, pi).n() # needs sage.symbolic
1444
+ 4.76805417696286
1445
+ sage: struve_L(1/2, pi).n(200) # needs sage.symbolic
1446
+ 4.768054176962864289162484345...
1447
+ """
1448
+ return _mpmath_utils_call(_mpmath_struvel, a, z, parent=parent)
1449
+
1450
+ def _derivative_(self, a, z, diff_param=None):
1451
+ """
1452
+ EXAMPLES::
1453
+
1454
+ sage: diff(struve_L(1,x), x) # needs sage.symbolic
1455
+ 1/3*x/pi - 1/2*struve_L(2, x) + 1/2*struve_L(0, x)
1456
+ """
1457
+ if diff_param == 0:
1458
+ raise ValueError("cannot differentiate struve_L in the first parameter")
1459
+
1460
+ from .other import sqrt
1461
+ return (z**a / (sqrt(pi) * 2**a * gamma(a + Integer(3) / Integer(2))) - struve_L(a + 1, z) + struve_L(a - 1, z)) / 2
1462
+
1463
+ def _print_latex_(self, a, z):
1464
+ """
1465
+ EXAMPLES::
1466
+
1467
+ sage: latex(struve_L(2,x)) # needs sage.symbolic
1468
+ L_{{2}}({x})
1469
+ """
1470
+ return r"L_{{%s}}({%s})" % (a, z)
1471
+
1472
+
1473
+ struve_L = Function_Struve_L()
1474
+
1475
+
1476
+ class Function_Hankel1(BuiltinFunction):
1477
+ r"""
1478
+ The Hankel function of the first kind.
1479
+
1480
+ DEFINITION:
1481
+
1482
+ .. MATH::
1483
+
1484
+ H_\nu^{(1)}(z) = J_{\nu}(z) + iY_{\nu}(z)
1485
+
1486
+ EXAMPLES::
1487
+
1488
+ sage: hankel1(3, x) # needs sage.symbolic
1489
+ hankel1(3, x)
1490
+ sage: hankel1(3, 4.) # needs mpmath
1491
+ 0.430171473875622 - 0.182022115953485*I
1492
+ sage: latex(hankel1(3, x)) # needs sage.symbolic
1493
+ H_{3}^{(1)}\left(x\right)
1494
+ sage: hankel1(3., x).series(x == 2, 10).subs(x=3).n() # abs tol 1e-12 # needs sage.symbolic
1495
+ 0.309062682819597 - 0.512591541605233*I
1496
+ sage: hankel1(3, 3.) # needs mpmath
1497
+ 0.309062722255252 - 0.538541616105032*I
1498
+
1499
+ REFERENCES:
1500
+
1501
+ - [AS-Bessel]_ see 9.1.6
1502
+ """
1503
+ def __init__(self):
1504
+ r"""
1505
+ TESTS::
1506
+
1507
+ sage: hankel1(3, x)._sympy_() # needs sympy sage.symbolic
1508
+ hankel1(3, x)
1509
+ """
1510
+ BuiltinFunction.__init__(self, 'hankel1', nargs=2,
1511
+ conversions=dict(maple='HankelH1',
1512
+ mathematica='HankelH1',
1513
+ maxima='hankel1',
1514
+ sympy='hankel1',
1515
+ fricas='hankelH1'))
1516
+
1517
+ def _evalf_(self, nu, z, parent=None, algorithm=None):
1518
+ r"""
1519
+ TESTS::
1520
+
1521
+ sage: hankel1(3, 3).n(100) # needs sage.symbolic
1522
+ 0.30906272225525164361826019495 - 0.53854161610503161800470390534*I
1523
+ sage: hankel1(I, I).n() # needs sage.symbolic
1524
+ -0.886357449263715*I
1525
+ """
1526
+ return _mpmath_utils_call(_mpmath_hankel1, nu, z, parent=parent)
1527
+
1528
+ def _latex_(self):
1529
+ r"""
1530
+ TESTS::
1531
+
1532
+ sage: latex(hankel1)
1533
+ H_{\nu}^{(1)}
1534
+ """
1535
+ return r'H_{\nu}^{(1)}'
1536
+
1537
+ def _print_latex_(self, nu, z):
1538
+ r"""
1539
+ TESTS::
1540
+
1541
+ sage: latex(hankel1(3, x)) # needs sage.symbolic
1542
+ H_{3}^{(1)}\left(x\right)
1543
+ """
1544
+ return r"H_{{{}}}^{{(1)}}\left({}\right)".format(latex(nu), latex(z))
1545
+
1546
+ def _derivative_(self, nu, z, diff_param):
1547
+ r"""
1548
+ TESTS::
1549
+
1550
+ sage: y = var('y') # needs sage.symbolic
1551
+ sage: hankel1(x, y).diff(y) # needs sage.symbolic
1552
+ x*hankel1(x, y)/y - hankel1(x + 1, y)
1553
+ """
1554
+ if diff_param == 1:
1555
+ return (nu * hankel1(nu, z)) / z - hankel1(nu + 1, z)
1556
+ else:
1557
+ raise NotImplementedError('derivative with respect to order')
1558
+
1559
+
1560
+ hankel1 = Function_Hankel1()
1561
+
1562
+
1563
+ class Function_Hankel2(BuiltinFunction):
1564
+ r"""
1565
+ The Hankel function of the second kind.
1566
+
1567
+ DEFINITION:
1568
+
1569
+ .. MATH::
1570
+
1571
+ H_\nu^{(2)}(z) = J_{\nu}(z) - iY_{\nu}(z)
1572
+
1573
+ EXAMPLES::
1574
+
1575
+ sage: hankel2(3, x) # needs sage.symbolic
1576
+ hankel2(3, x)
1577
+ sage: hankel2(3, 4.) # needs mpmath
1578
+ 0.430171473875622 + 0.182022115953485*I
1579
+ sage: latex(hankel2(3, x)) # needs sage.symbolic
1580
+ H_{3}^{(2)}\left(x\right)
1581
+ sage: hankel2(3., x).series(x == 2, 10).subs(x=3).n() # abs tol 1e-12 # needs sage.symbolic
1582
+ 0.309062682819597 + 0.512591541605234*I
1583
+ sage: hankel2(3, 3.) # needs mpmath
1584
+ 0.309062722255252 + 0.538541616105032*I
1585
+
1586
+ REFERENCES:
1587
+
1588
+ - [AS-Bessel]_ see 9.1.6
1589
+ """
1590
+ def __init__(self):
1591
+ r"""
1592
+ TESTS::
1593
+
1594
+ sage: hankel2(3, x)._sympy_() # needs sympy sage.symbolic
1595
+ hankel2(3, x)
1596
+ """
1597
+ BuiltinFunction.__init__(self, 'hankel2', nargs=2,
1598
+ conversions=dict(maple='HankelH2',
1599
+ mathematica='HankelH2',
1600
+ maxima='hankel2',
1601
+ sympy='hankel2',
1602
+ fricas='hankelH2'))
1603
+
1604
+ def _evalf_(self, nu, z, parent=None, algorithm=None):
1605
+ r"""
1606
+ TESTS::
1607
+
1608
+ sage: hankel2(3, 3).n(100) # needs sage.symbolic
1609
+ 0.30906272225525164361826019495 + 0.53854161610503161800470390534*I
1610
+ sage: hankel2(I, I).n() # needs sage.symbolic
1611
+ 0.790274862674015 + 0.444006335520019*I
1612
+ """
1613
+ return _mpmath_utils_call(_mpmath_hankel2, nu, z, parent=parent)
1614
+
1615
+ def _latex_(self):
1616
+ r"""
1617
+ TESTS::
1618
+
1619
+ sage: latex(hankel2)
1620
+ H_{\nu}^{(2)}
1621
+ """
1622
+ return r'H_{\nu}^{(2)}'
1623
+
1624
+ def _print_latex_(self, nu, z):
1625
+ r"""
1626
+ TESTS::
1627
+
1628
+ sage: latex(hankel2(3, x)) # needs sage.symbolic
1629
+ H_{3}^{(2)}\left(x\right)
1630
+ """
1631
+ return r"H_{{{}}}^{{(2)}}\left({}\right)".format(latex(nu), latex(z))
1632
+
1633
+ def _derivative_(self, nu, z, diff_param):
1634
+ r"""
1635
+ TESTS::
1636
+
1637
+ sage: y = var('y') # needs sage.symbolic
1638
+ sage: hankel2(x, y).diff(y) # needs sage.symbolic
1639
+ -1/2*hankel2(x + 1, y) + 1/2*hankel2(x - 1, y)
1640
+ """
1641
+ if diff_param == 1:
1642
+ return (Integer(1) / 2) * (hankel2(nu - 1, z) - hankel2(nu + 1, z))
1643
+ else:
1644
+ raise NotImplementedError('derivative with respect to order')
1645
+
1646
+
1647
+ hankel2 = Function_Hankel2()
1648
+
1649
+
1650
+ class SphericalBesselJ(BuiltinFunction):
1651
+ r"""
1652
+ The spherical Bessel function of the first kind.
1653
+
1654
+ DEFINITION:
1655
+
1656
+ .. MATH::
1657
+
1658
+ j_n(z) = \sqrt{\frac{\pi}{2z}} \,J_{n + \frac{1}{2}}(z)
1659
+
1660
+ EXAMPLES::
1661
+
1662
+ sage: spherical_bessel_J(3, 3.) # needs mpmath
1663
+ 0.152051662030533
1664
+ sage: spherical_bessel_J(2.,3.) # rel tol 1e-10 # needs mpmath
1665
+ 0.2986374970757335
1666
+
1667
+ sage: # needs sage.symbolic
1668
+ sage: spherical_bessel_J(3, x)
1669
+ spherical_bessel_J(3, x)
1670
+ sage: spherical_bessel_J(3 + 0.2 * I, 3)
1671
+ 0.150770999183897 - 0.0260662466510632*I
1672
+ sage: spherical_bessel_J(3, x).series(x == 2, 10).subs(x=3).n()
1673
+ 0.152051648665037
1674
+ sage: spherical_bessel_J(4, x).simplify()
1675
+ -((45/x^2 - 105/x^4 - 1)*sin(x) + 5*(21/x^2 - 2)*cos(x)/x)/x
1676
+ sage: integrate(spherical_bessel_J(1,x)^2,(x,0,oo))
1677
+ 1/6*pi
1678
+ sage: latex(spherical_bessel_J(4, x))
1679
+ j_{4}\left(x\right)
1680
+
1681
+ REFERENCES:
1682
+
1683
+ - [AS-Spherical]_
1684
+
1685
+ - [DLMF-Bessel]_
1686
+
1687
+ - [WP-Bessel]_
1688
+ """
1689
+ def __init__(self):
1690
+ r"""
1691
+ TESTS::
1692
+
1693
+ sage: spherical_bessel_J(3, x)._sympy_() # needs sympy sage.symbolic
1694
+ jn(3, x)
1695
+ """
1696
+ conversions = dict(mathematica='SphericalBesselJ',
1697
+ maxima='spherical_bessel_j',
1698
+ sympy='jn')
1699
+ BuiltinFunction.__init__(self, 'spherical_bessel_J', nargs=2,
1700
+ conversions=conversions)
1701
+
1702
+ def _evalf_(self, n, z, parent=None, algorithm=None):
1703
+ r"""
1704
+ TESTS::
1705
+
1706
+ sage: spherical_bessel_J(3, 3).n(100) # needs sage.symbolic
1707
+ 0.15205166203053329097480571600
1708
+ sage: spherical_bessel_J(I, I).n() # needs sage.symbolic
1709
+ 0.215520585196889 - 0.282308805801851*I
1710
+ """
1711
+ return _mpmath_utils_call(spherical_bessel_f, 'besselj', n, z,
1712
+ parent=parent)
1713
+
1714
+ def _latex_(self):
1715
+ r"""
1716
+ TESTS::
1717
+
1718
+ sage: latex(spherical_bessel_J)
1719
+ j_n
1720
+ """
1721
+ return r'j_n'
1722
+
1723
+ def _print_latex_(self, n, z):
1724
+ r"""
1725
+ TESTS::
1726
+
1727
+ sage: latex(spherical_bessel_J(4, x)) # needs sage.symbolic
1728
+ j_{4}\left(x\right)
1729
+ """
1730
+ return r"j_{{{}}}\left({}\right)".format(latex(n), latex(z))
1731
+
1732
+ def _derivative_(self, n, z, diff_param):
1733
+ r"""
1734
+ TESTS::
1735
+
1736
+ sage: y = var('y') # needs sage.symbolic
1737
+ sage: spherical_bessel_J(x, y).diff(y) # needs sage.symbolic
1738
+ -(x + 1)*spherical_bessel_J(x, y)/y + spherical_bessel_J(x - 1, y)
1739
+ """
1740
+ if SR(n).is_numeric() and not SR(n).is_integer():
1741
+ raise NotImplementedError('derivative of spherical function with noninteger index')
1742
+ if diff_param == 1:
1743
+ return (spherical_bessel_J(n - 1, z) -
1744
+ ((n + 1) / z) * spherical_bessel_J(n, z))
1745
+ else:
1746
+ raise NotImplementedError('derivative with respect to order')
1747
+
1748
+
1749
+ spherical_bessel_J = SphericalBesselJ()
1750
+
1751
+
1752
+ class SphericalBesselY(BuiltinFunction):
1753
+ r"""
1754
+ The spherical Bessel function of the second kind.
1755
+
1756
+ DEFINITION:
1757
+
1758
+ .. MATH::
1759
+
1760
+ y_n(z) = \sqrt{\frac{\pi}{2z}} \,Y_{n + \frac{1}{2}}(z)
1761
+
1762
+ EXAMPLES::
1763
+
1764
+ sage: # needs sage.symbolic
1765
+ sage: spherical_bessel_Y(3, x)
1766
+ spherical_bessel_Y(3, x)
1767
+ sage: spherical_bessel_Y(3 + 0.2 * I, 3)
1768
+ -0.505215297588210 - 0.0508835883281404*I
1769
+ sage: spherical_bessel_Y(-3, x).simplify()
1770
+ ((3/x^2 - 1)*sin(x) - 3*cos(x)/x)/x
1771
+ sage: spherical_bessel_Y(3 + 2 * I, 5 - 0.2 * I)
1772
+ -0.270205813266440 - 0.615994702714957*I
1773
+ sage: integrate(spherical_bessel_Y(0, x), x)
1774
+ -1/2*Ei(I*x) - 1/2*Ei(-I*x)
1775
+ sage: integrate(spherical_bessel_Y(1,x)^2,(x,0,oo))
1776
+ -1/6*pi
1777
+ sage: latex(spherical_bessel_Y(0, x))
1778
+ y_{0}\left(x\right)
1779
+
1780
+ REFERENCES:
1781
+
1782
+ - [AS-Spherical]_
1783
+
1784
+ - [DLMF-Bessel]_
1785
+
1786
+ - [WP-Bessel]_
1787
+ """
1788
+ def __init__(self):
1789
+ r"""
1790
+ TESTS::
1791
+
1792
+ sage: spherical_bessel_Y(3, x)._sympy_() # needs sympy sage.symbolic
1793
+ yn(3, x)
1794
+ """
1795
+ conversions = dict(mathematica='SphericalBesselY',
1796
+ maxima='spherical_bessel_y',
1797
+ sympy='yn')
1798
+ BuiltinFunction.__init__(self, 'spherical_bessel_Y', nargs=2,
1799
+ conversions=conversions)
1800
+
1801
+ def _evalf_(self, n, z, parent=None, algorithm=None):
1802
+ r"""
1803
+ TESTS::
1804
+
1805
+ sage: spherical_bessel_Y(3, 3).n(100) # needs sage.symbolic
1806
+ -0.50802305570981460285684870920
1807
+ sage: spherical_bessel_Y(I, I).n() # needs sage.symbolic
1808
+ -0.174225389805399 + 1.36247234140312*I
1809
+ """
1810
+ return _mpmath_utils_call(spherical_bessel_f, 'bessely', n, z,
1811
+ parent=parent)
1812
+
1813
+ def _latex_(self):
1814
+ r"""
1815
+ TESTS::
1816
+
1817
+ sage: latex(spherical_bessel_Y)
1818
+ y_n
1819
+ """
1820
+ return r'y_n'
1821
+
1822
+ def _print_latex_(self, n, z):
1823
+ r"""
1824
+ TESTS::
1825
+
1826
+ sage: latex(spherical_bessel_Y(4, x)) # needs sage.symbolic
1827
+ y_{4}\left(x\right)
1828
+ """
1829
+ return r"y_{{{}}}\left({}\right)".format(latex(n), latex(z))
1830
+
1831
+ def _derivative_(self, n, z, diff_param):
1832
+ r"""
1833
+ TESTS::
1834
+
1835
+ sage: y = var('y') # needs sage.symbolic
1836
+ sage: spherical_bessel_Y(x, y).diff(y) # needs sage.symbolic
1837
+ -1/2*spherical_bessel_Y(x, y)/y -...
1838
+ 1/2*spherical_bessel_Y(x + 1, y) + 1/2*spherical_bessel_Y(x - 1, y)
1839
+ """
1840
+ if SR(n).is_numeric() and not SR(n).is_integer():
1841
+ raise NotImplementedError('derivative of spherical function with noninteger index')
1842
+ if diff_param == 1:
1843
+ return (-spherical_bessel_Y(n, z) / (2 * z) +
1844
+ (spherical_bessel_Y(n - 1, z) -
1845
+ spherical_bessel_Y(n + 1, z)) / 2)
1846
+ else:
1847
+ raise NotImplementedError('derivative with respect to order')
1848
+
1849
+
1850
+ spherical_bessel_Y = SphericalBesselY()
1851
+
1852
+
1853
+ class SphericalHankel1(BuiltinFunction):
1854
+ r"""
1855
+ The spherical Hankel function of the first kind.
1856
+
1857
+ DEFINITION:
1858
+
1859
+ .. MATH::
1860
+
1861
+ h_n^{(1)}(z) = \sqrt{\frac{\pi}{2z}} \,H_{n + \frac{1}{2}}^{(1)}(z)
1862
+
1863
+ EXAMPLES::
1864
+
1865
+ sage: # needs sage.symbolic
1866
+ sage: spherical_hankel1(3, x)
1867
+ spherical_hankel1(3, x)
1868
+ sage: spherical_hankel1(3 + 0.2 * I, 3)
1869
+ 0.201654587512037 - 0.531281544239273*I
1870
+ sage: spherical_hankel1(1, x).simplify()
1871
+ -(x + I)*e^(I*x)/x^2
1872
+ sage: spherical_hankel1(3 + 2 * I, 5 - 0.2 * I)
1873
+ 1.25375216869913 - 0.518011435921789*I
1874
+ sage: integrate(spherical_hankel1(3, x), x)
1875
+ Ei(I*x) - 6*gamma(-1, -I*x) - 15*gamma(-2, -I*x) - 15*gamma(-3, -I*x)
1876
+ sage: latex(spherical_hankel1(3, x))
1877
+ h_{3}^{(1)}\left(x\right)
1878
+
1879
+ REFERENCES:
1880
+
1881
+ - [AS-Spherical]_
1882
+
1883
+ - [DLMF-Bessel]_
1884
+
1885
+ - [WP-Bessel]_
1886
+ """
1887
+ def __init__(self):
1888
+ r"""
1889
+ TESTS::
1890
+
1891
+ sage: spherical_hankel1
1892
+ spherical_hankel1
1893
+ """
1894
+ conversions = dict(mathematica='SphericalHankelH1',
1895
+ maxima='spherical_hankel1')
1896
+ BuiltinFunction.__init__(self, 'spherical_hankel1', nargs=2,
1897
+ conversions=conversions)
1898
+
1899
+ def _evalf_(self, n, z, parent=None, algorithm=None):
1900
+ r"""
1901
+ TESTS::
1902
+
1903
+ sage: spherical_hankel1(3, 3).n(100) # needs sage.symbolic
1904
+ 0.15205166203053329097480571600 - 0.50802305570981460285684870920*I
1905
+ sage: spherical_hankel1(I, I).n() # needs sage.symbolic
1906
+ -1.14695175620623 - 0.456534195607250*I
1907
+ """
1908
+ return _mpmath_utils_call(spherical_bessel_f, 'hankel1', n, z,
1909
+ parent=parent)
1910
+
1911
+ def _latex_(self):
1912
+ r"""
1913
+ TESTS::
1914
+
1915
+ sage: latex(spherical_hankel1)
1916
+ h_n^{(1)}
1917
+ """
1918
+ return r'h_n^{(1)}'
1919
+
1920
+ def _print_latex_(self, n, z):
1921
+ r"""
1922
+ TESTS::
1923
+
1924
+ sage: latex(spherical_hankel1(4, x)) # needs sage.symbolic
1925
+ h_{4}^{(1)}\left(x\right)
1926
+ """
1927
+ return r"h_{{{}}}^{{(1)}}\left({}\right)".format(latex(n), latex(z))
1928
+
1929
+ def _derivative_(self, n, z, diff_param):
1930
+ r"""
1931
+ TESTS::
1932
+
1933
+ sage: y = var('y') # needs sage.symbolic
1934
+ sage: spherical_hankel1(x, y).diff(y) # needs sage.symbolic
1935
+ -1/2*spherical_hankel1(x, y)/y -...
1936
+ 1/2*spherical_hankel1(x + 1, y) + 1/2*spherical_hankel1(x - 1, y)
1937
+ """
1938
+ if SR(n).is_numeric() and not SR(n).is_integer():
1939
+ raise NotImplementedError('derivative of spherical function with noninteger index')
1940
+ if diff_param == 1:
1941
+ return (-spherical_hankel1(n, z) / (2 * z) +
1942
+ (spherical_hankel1(n - 1, z) -
1943
+ spherical_hankel1(n + 1, z)) / 2)
1944
+ else:
1945
+ raise NotImplementedError('derivative with respect to order')
1946
+
1947
+
1948
+ spherical_hankel1 = SphericalHankel1()
1949
+
1950
+
1951
+ class SphericalHankel2(BuiltinFunction):
1952
+ r"""
1953
+ The spherical Hankel function of the second kind.
1954
+
1955
+ DEFINITION:
1956
+
1957
+ .. MATH::
1958
+
1959
+ h_n^{(2)}(z) = \sqrt{\frac{\pi}{2z}} \,H_{n + \frac{1}{2}}^{(2)}(z)
1960
+
1961
+ EXAMPLES::
1962
+
1963
+ sage: # needs sage.symbolic
1964
+ sage: spherical_hankel2(3, x)
1965
+ spherical_hankel2(3, x)
1966
+ sage: spherical_hankel2(3 + 0.2 * I, 3)
1967
+ 0.0998874108557565 + 0.479149050937147*I
1968
+ sage: spherical_hankel2(1, x).simplify()
1969
+ -(x - I)*e^(-I*x)/x^2
1970
+ sage: spherical_hankel2(2,i).simplify()
1971
+ -e
1972
+ sage: spherical_hankel2(2,x).simplify()
1973
+ (-I*x^2 - 3*x + 3*I)*e^(-I*x)/x^3
1974
+ sage: spherical_hankel2(3 + 2*I, 5 - 0.2*I)
1975
+ 0.0217627632692163 + 0.0224001906110906*I
1976
+ sage: integrate(spherical_hankel2(3, x), x)
1977
+ Ei(-I*x) - 6*gamma(-1, I*x) - 15*gamma(-2, I*x) - 15*gamma(-3, I*x)
1978
+ sage: latex(spherical_hankel2(3, x))
1979
+ h_{3}^{(2)}\left(x\right)
1980
+
1981
+ REFERENCES:
1982
+
1983
+ - [AS-Spherical]_
1984
+
1985
+ - [DLMF-Bessel]_
1986
+
1987
+ - [WP-Bessel]_
1988
+ """
1989
+ def __init__(self):
1990
+ r"""
1991
+ TESTS::
1992
+
1993
+ sage: spherical_hankel2
1994
+ spherical_hankel2
1995
+ """
1996
+ BuiltinFunction.__init__(self, 'spherical_hankel2', nargs=2,
1997
+ conversions=dict(mathematica='SphericalHankelH2',
1998
+ maxima='spherical_hankel2'))
1999
+
2000
+ def _evalf_(self, n, z, parent=None, algorithm=None):
2001
+ r"""
2002
+ TESTS::
2003
+
2004
+ sage: spherical_hankel2(3, 3).n(100) # needs sage.symbolic
2005
+ 0.15205166203053329097480571600 + 0.50802305570981460285684870920*I
2006
+ sage: spherical_hankel2(I, I).n() # needs sage.symbolic
2007
+ 1.57799292660001 - 0.108083415996452*I
2008
+ """
2009
+ return _mpmath_utils_call(spherical_bessel_f, 'hankel2', n, z,
2010
+ parent=parent)
2011
+
2012
+ def _latex_(self):
2013
+ r"""
2014
+ TESTS::
2015
+
2016
+ sage: latex(spherical_hankel2)
2017
+ h_n^{(2)}
2018
+ """
2019
+ return r'h_n^{(2)}'
2020
+
2021
+ def _print_latex_(self, n, z):
2022
+ r"""
2023
+ TESTS::
2024
+
2025
+ sage: latex(spherical_hankel2(4, x)) # needs sage.symbolic
2026
+ h_{4}^{(2)}\left(x\right)
2027
+ """
2028
+ return r"h_{{{}}}^{{(2)}}\left({}\right)".format(latex(n), latex(z))
2029
+
2030
+ def _derivative_(self, n, z, diff_param):
2031
+ r"""
2032
+ TESTS::
2033
+
2034
+ sage: # needs sage.symbolic
2035
+ sage: y = var('y')
2036
+ sage: spherical_hankel2(x, y).diff(y)
2037
+ -1/2*spherical_hankel2(x, y)/y -...
2038
+ 1/2*spherical_hankel2(x + 1, y) + 1/2*spherical_hankel2(x - 1, y)
2039
+ sage: spherical_hankel2(x, y).diff(x)
2040
+ Traceback (most recent call last):
2041
+ ...
2042
+ NotImplementedError: derivative with respect to order
2043
+ sage: spherical_hankel2(3/2, y).diff(y)
2044
+ Traceback (most recent call last):
2045
+ ...
2046
+ NotImplementedError: derivative of spherical function with noninteger index
2047
+ """
2048
+ if SR(n).is_numeric() and not SR(n).is_integer():
2049
+ raise NotImplementedError('derivative of spherical function with noninteger index')
2050
+ if diff_param == 1:
2051
+ return (-spherical_hankel2(n, z) / (2 * z) +
2052
+ (spherical_hankel2(n - 1, z) -
2053
+ spherical_hankel2(n + 1, z)) / 2)
2054
+ else:
2055
+ raise NotImplementedError('derivative with respect to order')
2056
+
2057
+
2058
+ spherical_hankel2 = SphericalHankel2()
2059
+
2060
+
2061
+ def spherical_bessel_f(F, n, z):
2062
+ r"""
2063
+ Numerically evaluate the spherical version, `f`, of the Bessel function `F`
2064
+ by computing `f_n(z) = \sqrt{\frac{1}{2}\pi/z} F_{n + \frac{1}{2}}(z)`.
2065
+ According to Abramowitz & Stegun, this identity holds for the Bessel
2066
+ functions `J`, `Y`, `K`, `I`, `H^{(1)}`, and `H^{(2)}`.
2067
+
2068
+ EXAMPLES::
2069
+
2070
+ sage: from sage.functions.bessel import spherical_bessel_f
2071
+ sage: spherical_bessel_f('besselj', 3, 4) # needs mpmath
2072
+ mpf('0.22924385795503024')
2073
+ sage: spherical_bessel_f('hankel1', 3, 4) # needs mpmath
2074
+ mpc(real='0.22924385795503024', imag='-0.21864196590306359')
2075
+
2076
+ TESTS:
2077
+
2078
+ Check that :issue:`28474` is fixed::
2079
+
2080
+ sage: from sage.functions.bessel import spherical_bessel_f
2081
+ sage: spherical_bessel_f('besselj', 3, -4) # needs mpmath
2082
+ mpc(real='-0.22924385795503024', imag='0.0')
2083
+ sage: spherical_bessel_f('bessely', 3, -4) # needs mpmath
2084
+ mpc(real='-0.21864196590306359', imag='0.0')
2085
+ """
2086
+ from mpmath import mp as ctx
2087
+ prec = ctx.prec
2088
+ try:
2089
+ n = ctx.convert(n)
2090
+ z = ctx.convert(z)
2091
+ ctx.prec += 10
2092
+ Fz = getattr(ctx, F)(n + 0.5, z)
2093
+ hpi = 0.5 * ctx.pi()
2094
+ ctx.prec += 10
2095
+ sqrthpi = ctx.sqrt(hpi)
2096
+ sqrtz = ctx.sqrt(z)
2097
+ ctx.prec += 10
2098
+ quotient = sqrthpi / sqrtz
2099
+ ctx.prec += 10
2100
+ return quotient * Fz
2101
+ finally:
2102
+ ctx.prec = prec