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.
- passagemath_categories-10.6.32.dist-info/METADATA +156 -0
- passagemath_categories-10.6.32.dist-info/RECORD +719 -0
- passagemath_categories-10.6.32.dist-info/WHEEL +5 -0
- passagemath_categories-10.6.32.dist-info/top_level.txt +2 -0
- passagemath_categories.libs/libgcc_s-2d945d6c.so.1 +0 -0
- passagemath_categories.libs/libgmp-28992bcb.so.10.5.0 +0 -0
- passagemath_categories.libs/libstdc++-85f2cd6d.so.6.0.33 +0 -0
- sage/all__sagemath_categories.py +28 -0
- sage/arith/all.py +38 -0
- sage/arith/constants.pxd +27 -0
- sage/arith/functions.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/functions.pxd +4 -0
- sage/arith/functions.pyx +221 -0
- sage/arith/misc.py +6552 -0
- sage/arith/multi_modular.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/multi_modular.pxd +39 -0
- sage/arith/multi_modular.pyx +994 -0
- sage/arith/rational_reconstruction.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/rational_reconstruction.pxd +4 -0
- sage/arith/rational_reconstruction.pyx +115 -0
- sage/arith/srange.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/srange.pyx +571 -0
- sage/calculus/all__sagemath_categories.py +2 -0
- sage/calculus/functional.py +481 -0
- sage/calculus/functions.py +151 -0
- sage/categories/additive_groups.py +73 -0
- sage/categories/additive_magmas.py +1044 -0
- sage/categories/additive_monoids.py +114 -0
- sage/categories/additive_semigroups.py +184 -0
- sage/categories/affine_weyl_groups.py +238 -0
- sage/categories/algebra_ideals.py +95 -0
- sage/categories/algebra_modules.py +96 -0
- sage/categories/algebras.py +349 -0
- sage/categories/algebras_with_basis.py +377 -0
- sage/categories/all.py +160 -0
- sage/categories/aperiodic_semigroups.py +29 -0
- sage/categories/associative_algebras.py +47 -0
- sage/categories/bialgebras.py +101 -0
- sage/categories/bialgebras_with_basis.py +414 -0
- sage/categories/bimodules.py +206 -0
- sage/categories/chain_complexes.py +268 -0
- sage/categories/classical_crystals.py +480 -0
- sage/categories/coalgebras.py +405 -0
- sage/categories/coalgebras_with_basis.py +232 -0
- sage/categories/coercion_methods.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/categories/coercion_methods.pyx +52 -0
- sage/categories/commutative_additive_groups.py +104 -0
- sage/categories/commutative_additive_monoids.py +45 -0
- sage/categories/commutative_additive_semigroups.py +48 -0
- sage/categories/commutative_algebra_ideals.py +87 -0
- sage/categories/commutative_algebras.py +94 -0
- sage/categories/commutative_ring_ideals.py +58 -0
- sage/categories/commutative_rings.py +736 -0
- sage/categories/complete_discrete_valuation.py +293 -0
- sage/categories/complex_reflection_groups.py +145 -0
- sage/categories/complex_reflection_or_generalized_coxeter_groups.py +1249 -0
- sage/categories/coxeter_group_algebras.py +186 -0
- sage/categories/coxeter_groups.py +3402 -0
- sage/categories/crystals.py +2628 -0
- sage/categories/cw_complexes.py +216 -0
- sage/categories/dedekind_domains.py +137 -0
- sage/categories/discrete_valuation.py +325 -0
- sage/categories/distributive_magmas_and_additive_magmas.py +100 -0
- sage/categories/division_rings.py +114 -0
- sage/categories/domains.py +95 -0
- sage/categories/drinfeld_modules.py +789 -0
- sage/categories/dual.py +42 -0
- sage/categories/enumerated_sets.py +1146 -0
- sage/categories/euclidean_domains.py +271 -0
- sage/categories/examples/algebras_with_basis.py +102 -0
- sage/categories/examples/all.py +1 -0
- sage/categories/examples/commutative_additive_monoids.py +130 -0
- sage/categories/examples/commutative_additive_semigroups.py +199 -0
- sage/categories/examples/coxeter_groups.py +8 -0
- sage/categories/examples/crystals.py +236 -0
- sage/categories/examples/cw_complexes.py +163 -0
- sage/categories/examples/facade_sets.py +187 -0
- sage/categories/examples/filtered_algebras_with_basis.py +204 -0
- sage/categories/examples/filtered_modules_with_basis.py +154 -0
- sage/categories/examples/finite_coxeter_groups.py +252 -0
- sage/categories/examples/finite_dimensional_algebras_with_basis.py +148 -0
- sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py +495 -0
- sage/categories/examples/finite_enumerated_sets.py +208 -0
- sage/categories/examples/finite_monoids.py +150 -0
- sage/categories/examples/finite_semigroups.py +190 -0
- sage/categories/examples/finite_weyl_groups.py +191 -0
- sage/categories/examples/graded_connected_hopf_algebras_with_basis.py +152 -0
- sage/categories/examples/graded_modules_with_basis.py +168 -0
- sage/categories/examples/graphs.py +122 -0
- sage/categories/examples/hopf_algebras_with_basis.py +145 -0
- sage/categories/examples/infinite_enumerated_sets.py +190 -0
- sage/categories/examples/lie_algebras.py +352 -0
- sage/categories/examples/lie_algebras_with_basis.py +196 -0
- sage/categories/examples/magmas.py +162 -0
- sage/categories/examples/manifolds.py +94 -0
- sage/categories/examples/monoids.py +144 -0
- sage/categories/examples/posets.py +178 -0
- sage/categories/examples/semigroups.py +580 -0
- sage/categories/examples/semigroups_cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/categories/examples/semigroups_cython.pyx +221 -0
- sage/categories/examples/semirings.py +249 -0
- sage/categories/examples/sets_cat.py +706 -0
- sage/categories/examples/sets_with_grading.py +101 -0
- sage/categories/examples/with_realizations.py +542 -0
- sage/categories/fields.py +991 -0
- sage/categories/filtered_algebras.py +63 -0
- sage/categories/filtered_algebras_with_basis.py +548 -0
- sage/categories/filtered_hopf_algebras_with_basis.py +138 -0
- sage/categories/filtered_modules.py +210 -0
- sage/categories/filtered_modules_with_basis.py +1209 -0
- sage/categories/finite_complex_reflection_groups.py +1506 -0
- sage/categories/finite_coxeter_groups.py +1138 -0
- sage/categories/finite_crystals.py +103 -0
- sage/categories/finite_dimensional_algebras_with_basis.py +1860 -0
- sage/categories/finite_dimensional_bialgebras_with_basis.py +33 -0
- sage/categories/finite_dimensional_coalgebras_with_basis.py +33 -0
- sage/categories/finite_dimensional_graded_lie_algebras_with_basis.py +231 -0
- sage/categories/finite_dimensional_hopf_algebras_with_basis.py +38 -0
- sage/categories/finite_dimensional_lie_algebras_with_basis.py +2774 -0
- sage/categories/finite_dimensional_modules_with_basis.py +1407 -0
- sage/categories/finite_dimensional_nilpotent_lie_algebras_with_basis.py +167 -0
- sage/categories/finite_dimensional_semisimple_algebras_with_basis.py +270 -0
- sage/categories/finite_enumerated_sets.py +769 -0
- sage/categories/finite_fields.py +252 -0
- sage/categories/finite_groups.py +256 -0
- sage/categories/finite_lattice_posets.py +242 -0
- sage/categories/finite_monoids.py +316 -0
- sage/categories/finite_permutation_groups.py +339 -0
- sage/categories/finite_posets.py +1994 -0
- sage/categories/finite_semigroups.py +136 -0
- sage/categories/finite_sets.py +93 -0
- sage/categories/finite_weyl_groups.py +39 -0
- sage/categories/finitely_generated_lambda_bracket_algebras.py +112 -0
- sage/categories/finitely_generated_lie_conformal_algebras.py +114 -0
- sage/categories/finitely_generated_magmas.py +57 -0
- sage/categories/finitely_generated_semigroups.py +214 -0
- sage/categories/function_fields.py +76 -0
- sage/categories/g_sets.py +77 -0
- sage/categories/gcd_domains.py +65 -0
- sage/categories/generalized_coxeter_groups.py +94 -0
- sage/categories/graded_algebras.py +85 -0
- sage/categories/graded_algebras_with_basis.py +258 -0
- sage/categories/graded_bialgebras.py +32 -0
- sage/categories/graded_bialgebras_with_basis.py +32 -0
- sage/categories/graded_coalgebras.py +65 -0
- sage/categories/graded_coalgebras_with_basis.py +51 -0
- sage/categories/graded_hopf_algebras.py +41 -0
- sage/categories/graded_hopf_algebras_with_basis.py +169 -0
- sage/categories/graded_lie_algebras.py +91 -0
- sage/categories/graded_lie_algebras_with_basis.py +44 -0
- sage/categories/graded_lie_conformal_algebras.py +74 -0
- sage/categories/graded_modules.py +133 -0
- sage/categories/graded_modules_with_basis.py +329 -0
- sage/categories/graphs.py +138 -0
- sage/categories/group_algebras.py +430 -0
- sage/categories/groupoid.py +94 -0
- sage/categories/groups.py +667 -0
- sage/categories/h_trivial_semigroups.py +64 -0
- sage/categories/hecke_modules.py +185 -0
- sage/categories/highest_weight_crystals.py +980 -0
- sage/categories/hopf_algebras.py +219 -0
- sage/categories/hopf_algebras_with_basis.py +309 -0
- sage/categories/infinite_enumerated_sets.py +115 -0
- sage/categories/integral_domains.py +203 -0
- sage/categories/j_trivial_semigroups.py +29 -0
- sage/categories/kac_moody_algebras.py +82 -0
- sage/categories/kahler_algebras.py +203 -0
- sage/categories/l_trivial_semigroups.py +63 -0
- sage/categories/lambda_bracket_algebras.py +280 -0
- sage/categories/lambda_bracket_algebras_with_basis.py +107 -0
- sage/categories/lattice_posets.py +89 -0
- sage/categories/left_modules.py +49 -0
- sage/categories/lie_algebras.py +1070 -0
- sage/categories/lie_algebras_with_basis.py +261 -0
- sage/categories/lie_conformal_algebras.py +350 -0
- sage/categories/lie_conformal_algebras_with_basis.py +147 -0
- sage/categories/lie_groups.py +73 -0
- sage/categories/loop_crystals.py +1290 -0
- sage/categories/magmas.py +1189 -0
- sage/categories/magmas_and_additive_magmas.py +149 -0
- sage/categories/magmatic_algebras.py +365 -0
- sage/categories/manifolds.py +352 -0
- sage/categories/matrix_algebras.py +40 -0
- sage/categories/metric_spaces.py +387 -0
- sage/categories/modular_abelian_varieties.py +78 -0
- sage/categories/modules.py +989 -0
- sage/categories/modules_with_basis.py +2794 -0
- sage/categories/monoid_algebras.py +38 -0
- sage/categories/monoids.py +739 -0
- sage/categories/noetherian_rings.py +87 -0
- sage/categories/number_fields.py +242 -0
- sage/categories/ore_modules.py +189 -0
- sage/categories/partially_ordered_monoids.py +49 -0
- sage/categories/permutation_groups.py +63 -0
- sage/categories/pointed_sets.py +42 -0
- sage/categories/polyhedra.py +74 -0
- sage/categories/poor_man_map.py +270 -0
- sage/categories/posets.py +722 -0
- sage/categories/principal_ideal_domains.py +270 -0
- sage/categories/quantum_group_representations.py +543 -0
- sage/categories/quotient_fields.py +728 -0
- sage/categories/r_trivial_semigroups.py +45 -0
- sage/categories/regular_crystals.py +898 -0
- sage/categories/regular_supercrystals.py +170 -0
- sage/categories/right_modules.py +49 -0
- sage/categories/ring_ideals.py +74 -0
- sage/categories/rings.py +1904 -0
- sage/categories/rngs.py +175 -0
- sage/categories/schemes.py +393 -0
- sage/categories/semigroups.py +1060 -0
- sage/categories/semirings.py +71 -0
- sage/categories/semisimple_algebras.py +114 -0
- sage/categories/sets_with_grading.py +235 -0
- sage/categories/shephard_groups.py +43 -0
- sage/categories/signed_tensor.py +120 -0
- sage/categories/simplicial_complexes.py +134 -0
- sage/categories/simplicial_sets.py +1206 -0
- sage/categories/super_algebras.py +149 -0
- sage/categories/super_algebras_with_basis.py +144 -0
- sage/categories/super_hopf_algebras_with_basis.py +126 -0
- sage/categories/super_lie_conformal_algebras.py +193 -0
- sage/categories/super_modules.py +229 -0
- sage/categories/super_modules_with_basis.py +193 -0
- sage/categories/supercommutative_algebras.py +99 -0
- sage/categories/supercrystals.py +406 -0
- sage/categories/tensor.py +110 -0
- sage/categories/topological_spaces.py +170 -0
- sage/categories/triangular_kac_moody_algebras.py +439 -0
- sage/categories/tutorial.py +58 -0
- sage/categories/unique_factorization_domains.py +318 -0
- sage/categories/unital_algebras.py +426 -0
- sage/categories/vector_bundles.py +159 -0
- sage/categories/vector_spaces.py +357 -0
- sage/categories/weyl_groups.py +853 -0
- sage/combinat/all__sagemath_categories.py +34 -0
- sage/combinat/backtrack.py +180 -0
- sage/combinat/combinat.py +2269 -0
- sage/combinat/combinat_cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/combinat_cython.pxd +6 -0
- sage/combinat/combinat_cython.pyx +390 -0
- sage/combinat/combination.py +796 -0
- sage/combinat/combinatorial_map.py +416 -0
- sage/combinat/composition.py +2192 -0
- sage/combinat/dlx.py +510 -0
- sage/combinat/integer_lists/__init__.py +7 -0
- sage/combinat/integer_lists/base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/integer_lists/base.pxd +16 -0
- sage/combinat/integer_lists/base.pyx +713 -0
- sage/combinat/integer_lists/invlex.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/integer_lists/invlex.pxd +4 -0
- sage/combinat/integer_lists/invlex.pyx +1650 -0
- sage/combinat/integer_lists/lists.py +328 -0
- sage/combinat/integer_lists/nn.py +48 -0
- sage/combinat/integer_vector.py +1818 -0
- sage/combinat/integer_vector_weighted.py +413 -0
- sage/combinat/matrices/all__sagemath_categories.py +5 -0
- sage/combinat/matrices/dancing_links.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/matrices/dancing_links.pyx +1159 -0
- sage/combinat/matrices/dancing_links_c.h +380 -0
- sage/combinat/matrices/dlxcpp.py +136 -0
- sage/combinat/partition.py +10070 -0
- sage/combinat/partitions.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/partitions.pyx +743 -0
- sage/combinat/permutation.py +10168 -0
- sage/combinat/permutation_cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/permutation_cython.pxd +11 -0
- sage/combinat/permutation_cython.pyx +407 -0
- sage/combinat/q_analogues.py +1090 -0
- sage/combinat/ranker.py +268 -0
- sage/combinat/subset.py +1561 -0
- sage/combinat/subsets_hereditary.py +202 -0
- sage/combinat/subsets_pairwise.py +184 -0
- sage/combinat/tools.py +63 -0
- sage/combinat/tuple.py +348 -0
- sage/data_structures/all.py +2 -0
- sage/data_structures/all__sagemath_categories.py +2 -0
- sage/data_structures/binary_matrix.pxd +138 -0
- sage/data_structures/binary_search.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/binary_search.pxd +3 -0
- sage/data_structures/binary_search.pyx +66 -0
- sage/data_structures/bitset.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/bitset.pxd +40 -0
- sage/data_structures/bitset.pyx +2385 -0
- sage/data_structures/bitset_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/bitset_base.pxd +926 -0
- sage/data_structures/bitset_base.pyx +117 -0
- sage/data_structures/bitset_intrinsics.h +487 -0
- sage/data_structures/blas_dict.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/blas_dict.pxd +12 -0
- sage/data_structures/blas_dict.pyx +469 -0
- sage/data_structures/list_of_pairs.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/list_of_pairs.pxd +16 -0
- sage/data_structures/list_of_pairs.pyx +122 -0
- sage/data_structures/mutable_poset.py +3312 -0
- sage/data_structures/pairing_heap.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/pairing_heap.h +346 -0
- sage/data_structures/pairing_heap.pxd +88 -0
- sage/data_structures/pairing_heap.pyx +1464 -0
- sage/data_structures/sparse_bitset.pxd +62 -0
- sage/data_structures/stream.py +5070 -0
- sage/databases/all__sagemath_categories.py +7 -0
- sage/databases/sql_db.py +2236 -0
- sage/ext/all__sagemath_categories.py +3 -0
- sage/ext/fast_callable.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/fast_callable.pxd +4 -0
- sage/ext/fast_callable.pyx +2746 -0
- sage/ext/fast_eval.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/fast_eval.pxd +1 -0
- sage/ext/fast_eval.pyx +102 -0
- sage/ext/interpreters/__init__.py +1 -0
- sage/ext/interpreters/all__sagemath_categories.py +2 -0
- sage/ext/interpreters/wrapper_el.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/interpreters/wrapper_el.pxd +18 -0
- sage/ext/interpreters/wrapper_el.pyx +148 -0
- sage/ext/interpreters/wrapper_py.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/interpreters/wrapper_py.pxd +17 -0
- sage/ext/interpreters/wrapper_py.pyx +133 -0
- sage/functions/airy.py +937 -0
- sage/functions/all.py +97 -0
- sage/functions/bessel.py +2102 -0
- sage/functions/error.py +784 -0
- sage/functions/exp_integral.py +1529 -0
- sage/functions/gamma.py +1087 -0
- sage/functions/generalized.py +672 -0
- sage/functions/hyperbolic.py +747 -0
- sage/functions/hypergeometric.py +1156 -0
- sage/functions/jacobi.py +1705 -0
- sage/functions/log.py +1402 -0
- sage/functions/min_max.py +338 -0
- sage/functions/orthogonal_polys.py +3106 -0
- sage/functions/other.py +2303 -0
- sage/functions/piecewise.py +1505 -0
- sage/functions/prime_pi.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/functions/prime_pi.pyx +262 -0
- sage/functions/special.py +1212 -0
- sage/functions/spike_function.py +278 -0
- sage/functions/transcendental.py +690 -0
- sage/functions/trig.py +1062 -0
- sage/functions/wigner.py +726 -0
- sage/geometry/abc.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/geometry/abc.pyx +82 -0
- sage/geometry/all__sagemath_categories.py +1 -0
- sage/groups/all__sagemath_categories.py +11 -0
- sage/groups/generic.py +1733 -0
- sage/groups/groups_catalog.py +113 -0
- sage/groups/perm_gps/all__sagemath_categories.py +1 -0
- sage/groups/perm_gps/partn_ref/all.py +1 -0
- sage/groups/perm_gps/partn_ref/all__sagemath_categories.py +1 -0
- sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.pxd +52 -0
- sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.pyx +906 -0
- sage/groups/perm_gps/partn_ref/canonical_augmentation.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/canonical_augmentation.pxd +85 -0
- sage/groups/perm_gps/partn_ref/canonical_augmentation.pyx +534 -0
- sage/groups/perm_gps/partn_ref/data_structures.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/data_structures.pxd +576 -0
- sage/groups/perm_gps/partn_ref/data_structures.pyx +1792 -0
- sage/groups/perm_gps/partn_ref/double_coset.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/double_coset.pxd +45 -0
- sage/groups/perm_gps/partn_ref/double_coset.pyx +739 -0
- sage/groups/perm_gps/partn_ref/refinement_lists.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_lists.pxd +18 -0
- sage/groups/perm_gps/partn_ref/refinement_lists.pyx +82 -0
- sage/groups/perm_gps/partn_ref/refinement_python.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_python.pxd +16 -0
- sage/groups/perm_gps/partn_ref/refinement_python.pyx +564 -0
- sage/groups/perm_gps/partn_ref/refinement_sets.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_sets.pxd +60 -0
- sage/groups/perm_gps/partn_ref/refinement_sets.pyx +858 -0
- sage/interfaces/abc.py +140 -0
- sage/interfaces/all.py +58 -0
- sage/interfaces/all__sagemath_categories.py +1 -0
- sage/interfaces/expect.py +1643 -0
- sage/interfaces/interface.py +1682 -0
- sage/interfaces/process.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/interfaces/process.pxd +5 -0
- sage/interfaces/process.pyx +288 -0
- sage/interfaces/quit.py +167 -0
- sage/interfaces/sage0.py +604 -0
- sage/interfaces/sagespawn.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/interfaces/sagespawn.pyx +308 -0
- sage/interfaces/tab_completion.py +101 -0
- sage/misc/all__sagemath_categories.py +78 -0
- sage/misc/allocator.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/allocator.pxd +6 -0
- sage/misc/allocator.pyx +47 -0
- sage/misc/binary_tree.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/binary_tree.pxd +29 -0
- sage/misc/binary_tree.pyx +537 -0
- sage/misc/callable_dict.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/callable_dict.pyx +89 -0
- sage/misc/citation.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/citation.pyx +159 -0
- sage/misc/converting_dict.py +293 -0
- sage/misc/defaults.py +129 -0
- sage/misc/derivative.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/derivative.pyx +223 -0
- sage/misc/functional.py +2005 -0
- sage/misc/html.py +589 -0
- sage/misc/latex.py +2673 -0
- sage/misc/latex_macros.py +236 -0
- sage/misc/latex_standalone.py +1833 -0
- sage/misc/map_threaded.py +38 -0
- sage/misc/mathml.py +76 -0
- sage/misc/method_decorator.py +88 -0
- sage/misc/mrange.py +755 -0
- sage/misc/multireplace.py +41 -0
- sage/misc/object_multiplexer.py +92 -0
- sage/misc/parser.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/parser.pyx +1107 -0
- sage/misc/random_testing.py +264 -0
- sage/misc/rest_index_of_methods.py +377 -0
- sage/misc/search.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/search.pxd +2 -0
- sage/misc/search.pyx +68 -0
- sage/misc/stopgap.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/stopgap.pyx +95 -0
- sage/misc/table.py +853 -0
- sage/monoids/all__sagemath_categories.py +1 -0
- sage/monoids/indexed_free_monoid.py +1071 -0
- sage/monoids/monoid.py +82 -0
- sage/numerical/all__sagemath_categories.py +1 -0
- sage/numerical/backends/all__sagemath_categories.py +1 -0
- sage/numerical/backends/generic_backend.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/numerical/backends/generic_backend.pxd +61 -0
- sage/numerical/backends/generic_backend.pyx +1893 -0
- sage/numerical/backends/generic_sdp_backend.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/numerical/backends/generic_sdp_backend.pxd +38 -0
- sage/numerical/backends/generic_sdp_backend.pyx +755 -0
- sage/parallel/all.py +6 -0
- sage/parallel/decorate.py +575 -0
- sage/parallel/map_reduce.py +1997 -0
- sage/parallel/multiprocessing_sage.py +76 -0
- sage/parallel/ncpus.py +35 -0
- sage/parallel/parallelism.py +364 -0
- sage/parallel/reference.py +47 -0
- sage/parallel/use_fork.py +333 -0
- sage/rings/abc.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/abc.pxd +31 -0
- sage/rings/abc.pyx +526 -0
- sage/rings/algebraic_closure_finite_field.py +1154 -0
- sage/rings/all__sagemath_categories.py +91 -0
- sage/rings/big_oh.py +227 -0
- sage/rings/continued_fraction.py +2754 -0
- sage/rings/continued_fraction_gosper.py +220 -0
- sage/rings/factorint.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/factorint.pyx +295 -0
- sage/rings/fast_arith.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/fast_arith.pxd +21 -0
- sage/rings/fast_arith.pyx +535 -0
- sage/rings/finite_rings/all__sagemath_categories.py +9 -0
- sage/rings/finite_rings/conway_polynomials.py +542 -0
- sage/rings/finite_rings/element_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/element_base.pxd +12 -0
- sage/rings/finite_rings/element_base.pyx +1176 -0
- sage/rings/finite_rings/finite_field_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/finite_field_base.pxd +7 -0
- sage/rings/finite_rings/finite_field_base.pyx +2171 -0
- sage/rings/finite_rings/finite_field_constructor.py +827 -0
- sage/rings/finite_rings/finite_field_prime_modn.py +372 -0
- sage/rings/finite_rings/galois_group.py +154 -0
- sage/rings/finite_rings/hom_finite_field.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/hom_finite_field.pxd +23 -0
- sage/rings/finite_rings/hom_finite_field.pyx +856 -0
- sage/rings/finite_rings/hom_prime_finite_field.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/hom_prime_finite_field.pxd +15 -0
- sage/rings/finite_rings/hom_prime_finite_field.pyx +164 -0
- sage/rings/finite_rings/homset.py +357 -0
- sage/rings/finite_rings/integer_mod.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/integer_mod.pxd +56 -0
- sage/rings/finite_rings/integer_mod.pyx +4586 -0
- sage/rings/finite_rings/integer_mod_limits.h +11 -0
- sage/rings/finite_rings/integer_mod_ring.py +2044 -0
- sage/rings/finite_rings/residue_field.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/residue_field.pxd +30 -0
- sage/rings/finite_rings/residue_field.pyx +1811 -0
- sage/rings/finite_rings/stdint.pxd +19 -0
- sage/rings/fraction_field.py +1452 -0
- sage/rings/fraction_field_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/fraction_field_element.pyx +1357 -0
- sage/rings/function_field/all.py +7 -0
- sage/rings/function_field/all__sagemath_categories.py +2 -0
- sage/rings/function_field/constructor.py +218 -0
- sage/rings/function_field/element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/function_field/element.pxd +11 -0
- sage/rings/function_field/element.pyx +1008 -0
- sage/rings/function_field/element_rational.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/function_field/element_rational.pyx +513 -0
- sage/rings/function_field/extensions.py +230 -0
- sage/rings/function_field/function_field.py +1468 -0
- sage/rings/function_field/function_field_rational.py +1005 -0
- sage/rings/function_field/ideal.py +1155 -0
- sage/rings/function_field/ideal_rational.py +629 -0
- sage/rings/function_field/jacobian_base.py +826 -0
- sage/rings/function_field/jacobian_hess.py +1053 -0
- sage/rings/function_field/jacobian_khuri_makdisi.py +1027 -0
- sage/rings/function_field/maps.py +1039 -0
- sage/rings/function_field/order.py +281 -0
- sage/rings/function_field/order_basis.py +586 -0
- sage/rings/function_field/order_rational.py +576 -0
- sage/rings/function_field/place.py +426 -0
- sage/rings/function_field/place_rational.py +181 -0
- sage/rings/generic.py +320 -0
- sage/rings/homset.py +332 -0
- sage/rings/ideal.py +1885 -0
- sage/rings/ideal_monoid.py +215 -0
- sage/rings/infinity.py +1890 -0
- sage/rings/integer.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/integer.pxd +45 -0
- sage/rings/integer.pyx +7874 -0
- sage/rings/integer_ring.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/integer_ring.pxd +8 -0
- sage/rings/integer_ring.pyx +1693 -0
- sage/rings/laurent_series_ring.py +931 -0
- sage/rings/laurent_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/laurent_series_ring_element.pxd +11 -0
- sage/rings/laurent_series_ring_element.pyx +1927 -0
- sage/rings/lazy_series.py +7815 -0
- sage/rings/lazy_series_ring.py +4356 -0
- sage/rings/localization.py +1043 -0
- sage/rings/morphism.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/morphism.pxd +39 -0
- sage/rings/morphism.pyx +3299 -0
- sage/rings/multi_power_series_ring.py +1145 -0
- sage/rings/multi_power_series_ring_element.py +2184 -0
- sage/rings/noncommutative_ideals.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/noncommutative_ideals.pyx +423 -0
- sage/rings/number_field/all__sagemath_categories.py +1 -0
- sage/rings/number_field/number_field_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/number_field/number_field_base.pxd +8 -0
- sage/rings/number_field/number_field_base.pyx +507 -0
- sage/rings/number_field/number_field_element_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/number_field/number_field_element_base.pxd +6 -0
- sage/rings/number_field/number_field_element_base.pyx +36 -0
- sage/rings/number_field/number_field_ideal.py +3550 -0
- sage/rings/padics/all__sagemath_categories.py +4 -0
- sage/rings/padics/local_generic.py +1670 -0
- sage/rings/padics/local_generic_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/padics/local_generic_element.pxd +5 -0
- sage/rings/padics/local_generic_element.pyx +1017 -0
- sage/rings/padics/misc.py +256 -0
- sage/rings/padics/padic_generic.py +1911 -0
- sage/rings/padics/pow_computer.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/padics/pow_computer.pxd +38 -0
- sage/rings/padics/pow_computer.pyx +671 -0
- sage/rings/padics/precision_error.py +24 -0
- sage/rings/polynomial/all__sagemath_categories.py +25 -0
- sage/rings/polynomial/commutative_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/commutative_polynomial.pxd +6 -0
- sage/rings/polynomial/commutative_polynomial.pyx +24 -0
- sage/rings/polynomial/cyclotomic.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/cyclotomic.pyx +404 -0
- sage/rings/polynomial/flatten.py +711 -0
- sage/rings/polynomial/ideal.py +102 -0
- sage/rings/polynomial/infinite_polynomial_element.py +1768 -0
- sage/rings/polynomial/infinite_polynomial_ring.py +1653 -0
- sage/rings/polynomial/laurent_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/laurent_polynomial.pxd +18 -0
- sage/rings/polynomial/laurent_polynomial.pyx +2190 -0
- sage/rings/polynomial/laurent_polynomial_ideal.py +590 -0
- sage/rings/polynomial/laurent_polynomial_ring.py +832 -0
- sage/rings/polynomial/laurent_polynomial_ring_base.py +708 -0
- sage/rings/polynomial/multi_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/multi_polynomial.pxd +12 -0
- sage/rings/polynomial/multi_polynomial.pyx +3082 -0
- sage/rings/polynomial/multi_polynomial_element.py +2570 -0
- sage/rings/polynomial/multi_polynomial_ideal.py +5771 -0
- sage/rings/polynomial/multi_polynomial_ring.py +947 -0
- sage/rings/polynomial/multi_polynomial_ring_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/multi_polynomial_ring_base.pxd +15 -0
- sage/rings/polynomial/multi_polynomial_ring_base.pyx +1855 -0
- sage/rings/polynomial/multi_polynomial_sequence.py +2204 -0
- sage/rings/polynomial/polydict.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polydict.pxd +45 -0
- sage/rings/polynomial/polydict.pyx +2701 -0
- sage/rings/polynomial/polynomial_compiled.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_compiled.pxd +59 -0
- sage/rings/polynomial/polynomial_compiled.pyx +509 -0
- sage/rings/polynomial/polynomial_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_element.pxd +64 -0
- sage/rings/polynomial/polynomial_element.pyx +13255 -0
- sage/rings/polynomial/polynomial_element_generic.py +1637 -0
- sage/rings/polynomial/polynomial_fateman.py +97 -0
- sage/rings/polynomial/polynomial_quotient_ring.py +2465 -0
- sage/rings/polynomial/polynomial_quotient_ring_element.py +779 -0
- sage/rings/polynomial/polynomial_ring.py +3784 -0
- sage/rings/polynomial/polynomial_ring_constructor.py +1051 -0
- sage/rings/polynomial/polynomial_ring_homomorphism.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_ring_homomorphism.pxd +5 -0
- sage/rings/polynomial/polynomial_ring_homomorphism.pyx +121 -0
- sage/rings/polynomial/polynomial_singular_interface.py +549 -0
- sage/rings/polynomial/symmetric_ideal.py +989 -0
- sage/rings/polynomial/symmetric_reduction.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/symmetric_reduction.pxd +8 -0
- sage/rings/polynomial/symmetric_reduction.pyx +669 -0
- sage/rings/polynomial/term_order.py +2279 -0
- sage/rings/polynomial/toy_buchberger.py +449 -0
- sage/rings/polynomial/toy_d_basis.py +387 -0
- sage/rings/polynomial/toy_variety.py +362 -0
- sage/rings/power_series_mpoly.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/power_series_mpoly.pxd +9 -0
- sage/rings/power_series_mpoly.pyx +161 -0
- sage/rings/power_series_poly.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/power_series_poly.pxd +10 -0
- sage/rings/power_series_poly.pyx +1317 -0
- sage/rings/power_series_ring.py +1441 -0
- sage/rings/power_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/power_series_ring_element.pxd +12 -0
- sage/rings/power_series_ring_element.pyx +3028 -0
- sage/rings/puiseux_series_ring.py +487 -0
- sage/rings/puiseux_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/puiseux_series_ring_element.pxd +7 -0
- sage/rings/puiseux_series_ring_element.pyx +1055 -0
- sage/rings/qqbar_decorators.py +167 -0
- sage/rings/quotient_ring.py +1598 -0
- sage/rings/quotient_ring_element.py +979 -0
- sage/rings/rational.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/rational.pxd +20 -0
- sage/rings/rational.pyx +4284 -0
- sage/rings/rational_field.py +1730 -0
- sage/rings/real_double.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/real_double.pxd +16 -0
- sage/rings/real_double.pyx +2218 -0
- sage/rings/real_lazy.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/real_lazy.pxd +30 -0
- sage/rings/real_lazy.pyx +1773 -0
- sage/rings/ring.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/ring.pxd +30 -0
- sage/rings/ring.pyx +850 -0
- sage/rings/semirings/all.py +3 -0
- sage/rings/semirings/non_negative_integer_semiring.py +107 -0
- sage/rings/semirings/tropical_mpolynomial.py +972 -0
- sage/rings/semirings/tropical_polynomial.py +997 -0
- sage/rings/semirings/tropical_semiring.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/semirings/tropical_semiring.pyx +676 -0
- sage/rings/semirings/tropical_variety.py +1701 -0
- sage/rings/sum_of_squares.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/sum_of_squares.pxd +3 -0
- sage/rings/sum_of_squares.pyx +336 -0
- sage/rings/tests.py +504 -0
- sage/schemes/affine/affine_homset.py +508 -0
- sage/schemes/affine/affine_morphism.py +1574 -0
- sage/schemes/affine/affine_point.py +460 -0
- sage/schemes/affine/affine_rational_point.py +308 -0
- sage/schemes/affine/affine_space.py +1264 -0
- sage/schemes/affine/affine_subscheme.py +592 -0
- sage/schemes/affine/all.py +25 -0
- sage/schemes/all__sagemath_categories.py +5 -0
- sage/schemes/generic/algebraic_scheme.py +2092 -0
- sage/schemes/generic/all.py +5 -0
- sage/schemes/generic/ambient_space.py +400 -0
- sage/schemes/generic/divisor.py +465 -0
- sage/schemes/generic/divisor_group.py +313 -0
- sage/schemes/generic/glue.py +84 -0
- sage/schemes/generic/homset.py +820 -0
- sage/schemes/generic/hypersurface.py +234 -0
- sage/schemes/generic/morphism.py +2107 -0
- sage/schemes/generic/point.py +237 -0
- sage/schemes/generic/scheme.py +1190 -0
- sage/schemes/generic/spec.py +199 -0
- sage/schemes/product_projective/all.py +6 -0
- sage/schemes/product_projective/homset.py +236 -0
- sage/schemes/product_projective/morphism.py +517 -0
- sage/schemes/product_projective/point.py +568 -0
- sage/schemes/product_projective/rational_point.py +550 -0
- sage/schemes/product_projective/space.py +1301 -0
- sage/schemes/product_projective/subscheme.py +466 -0
- sage/schemes/projective/all.py +24 -0
- sage/schemes/projective/proj_bdd_height.py +453 -0
- sage/schemes/projective/projective_homset.py +718 -0
- sage/schemes/projective/projective_morphism.py +2792 -0
- sage/schemes/projective/projective_point.py +1484 -0
- sage/schemes/projective/projective_rational_point.py +569 -0
- sage/schemes/projective/projective_space.py +2571 -0
- sage/schemes/projective/projective_subscheme.py +1574 -0
- sage/sets/all.py +17 -0
- sage/sets/cartesian_product.py +376 -0
- sage/sets/condition_set.py +525 -0
- sage/sets/disjoint_set.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/disjoint_set.pxd +36 -0
- sage/sets/disjoint_set.pyx +998 -0
- sage/sets/disjoint_union_enumerated_sets.py +625 -0
- sage/sets/family.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/family.pxd +12 -0
- sage/sets/family.pyx +1556 -0
- sage/sets/finite_enumerated_set.py +406 -0
- sage/sets/finite_set_map_cy.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/finite_set_map_cy.pxd +34 -0
- sage/sets/finite_set_map_cy.pyx +708 -0
- sage/sets/finite_set_maps.py +591 -0
- sage/sets/image_set.py +448 -0
- sage/sets/integer_range.py +829 -0
- sage/sets/non_negative_integers.py +241 -0
- sage/sets/positive_integers.py +93 -0
- sage/sets/primes.py +188 -0
- sage/sets/real_set.py +2760 -0
- sage/sets/recursively_enumerated_set.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/recursively_enumerated_set.pxd +31 -0
- sage/sets/recursively_enumerated_set.pyx +2082 -0
- sage/sets/set.py +2083 -0
- sage/sets/set_from_iterator.py +1021 -0
- sage/sets/totally_ordered_finite_set.py +329 -0
- sage/symbolic/all__sagemath_categories.py +1 -0
- sage/symbolic/function.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/symbolic/function.pxd +29 -0
- sage/symbolic/function.pyx +1488 -0
- sage/symbolic/symbols.py +56 -0
- sage/tests/all__sagemath_categories.py +1 -0
- sage/tests/cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/tests/cython.pyx +37 -0
- sage/tests/stl_vector.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/tests/stl_vector.pyx +171 -0
- sage/typeset/all.py +6 -0
- sage/typeset/ascii_art.py +295 -0
- sage/typeset/character_art.py +789 -0
- sage/typeset/character_art_factory.py +572 -0
- sage/typeset/symbols.py +334 -0
- sage/typeset/unicode_art.py +183 -0
- sage/typeset/unicode_characters.py +101 -0
|
@@ -0,0 +1,1156 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-categories
|
|
2
|
+
r"""
|
|
3
|
+
Hypergeometric functions
|
|
4
|
+
|
|
5
|
+
This module implements manipulation of infinite hypergeometric series
|
|
6
|
+
represented in standard parametric form (as `\,_pF_q` functions).
|
|
7
|
+
|
|
8
|
+
AUTHORS:
|
|
9
|
+
|
|
10
|
+
- Fredrik Johansson (2010): initial version
|
|
11
|
+
|
|
12
|
+
- Eviatar Bach (2013): major changes
|
|
13
|
+
|
|
14
|
+
EXAMPLES:
|
|
15
|
+
|
|
16
|
+
Examples from :issue:`9908`::
|
|
17
|
+
|
|
18
|
+
sage: # needs sage.symbolic
|
|
19
|
+
sage: maxima('integrate(bessel_j(2, x), x)').sage()
|
|
20
|
+
1/24*x^3*hypergeometric((3/2,), (5/2, 3), -1/4*x^2)
|
|
21
|
+
sage: sum(((2*I)^x/(x^3 + 1)*(1/4)^x), x, 0, oo)
|
|
22
|
+
hypergeometric((1, 1, -1/2*I*sqrt(3) - 1/2, 1/2*I*sqrt(3) - 1/2),...
|
|
23
|
+
(2, -1/2*I*sqrt(3) + 1/2, 1/2*I*sqrt(3) + 1/2), 1/2*I)
|
|
24
|
+
sage: res = sum((-1)^x/((2*x + 1)*factorial(2*x + 1)), x, 0, oo)
|
|
25
|
+
sage: res # not tested (depends on maxima version)
|
|
26
|
+
hypergeometric((1/2,), (3/2, 3/2), -1/4)
|
|
27
|
+
sage: res in [hypergeometric((1/2,), (3/2, 3/2), -1/4), sin_integral(1)]
|
|
28
|
+
True
|
|
29
|
+
|
|
30
|
+
Simplification (note that ``simplify_full`` does not yet call
|
|
31
|
+
``simplify_hypergeometric``)::
|
|
32
|
+
|
|
33
|
+
sage: # needs sage.symbolic
|
|
34
|
+
sage: hypergeometric([-2], [], x).simplify_hypergeometric()
|
|
35
|
+
x^2 - 2*x + 1
|
|
36
|
+
sage: hypergeometric([], [], x).simplify_hypergeometric()
|
|
37
|
+
e^x
|
|
38
|
+
sage: a = hypergeometric((hypergeometric((), (), x),), (),
|
|
39
|
+
....: hypergeometric((), (), x))
|
|
40
|
+
sage: a.simplify_hypergeometric()
|
|
41
|
+
1/((-e^x + 1)^e^x)
|
|
42
|
+
sage: a.simplify_hypergeometric(algorithm='sage')
|
|
43
|
+
1/((-e^x + 1)^e^x)
|
|
44
|
+
|
|
45
|
+
Equality testing::
|
|
46
|
+
|
|
47
|
+
sage: bool(hypergeometric([], [], x).derivative(x) == # needs sage.symbolic
|
|
48
|
+
....: hypergeometric([], [], x)) # diff(e^x, x) == e^x
|
|
49
|
+
True
|
|
50
|
+
sage: bool(hypergeometric([], [], x) == hypergeometric([], [1], x)) # needs sage.symbolic
|
|
51
|
+
False
|
|
52
|
+
|
|
53
|
+
Computing terms and series::
|
|
54
|
+
|
|
55
|
+
sage: # needs sage.symbolic
|
|
56
|
+
sage: var('z')
|
|
57
|
+
z
|
|
58
|
+
sage: hypergeometric([], [], z).series(z, 0)
|
|
59
|
+
Order(1)
|
|
60
|
+
sage: hypergeometric([], [], z).series(z, 1)
|
|
61
|
+
1 + Order(z)
|
|
62
|
+
sage: hypergeometric([], [], z).series(z, 2)
|
|
63
|
+
1 + 1*z + Order(z^2)
|
|
64
|
+
sage: hypergeometric([], [], z).series(z, 3)
|
|
65
|
+
1 + 1*z + 1/2*z^2 + Order(z^3)
|
|
66
|
+
|
|
67
|
+
sage: # needs sage.symbolic
|
|
68
|
+
sage: hypergeometric([-2], [], z).series(z, 3)
|
|
69
|
+
1 + (-2)*z + 1*z^2
|
|
70
|
+
sage: hypergeometric([-2], [], z).series(z, 6)
|
|
71
|
+
1 + (-2)*z + 1*z^2
|
|
72
|
+
sage: hypergeometric([-2], [], z).series(z, 6).is_terminating_series()
|
|
73
|
+
True
|
|
74
|
+
sage: hypergeometric([-2], [], z).series(z, 2)
|
|
75
|
+
1 + (-2)*z + Order(z^2)
|
|
76
|
+
sage: hypergeometric([-2], [], z).series(z, 2).is_terminating_series()
|
|
77
|
+
False
|
|
78
|
+
|
|
79
|
+
sage: hypergeometric([1], [], z).series(z, 6) # needs sage.symbolic
|
|
80
|
+
1 + 1*z + 1*z^2 + 1*z^3 + 1*z^4 + 1*z^5 + Order(z^6)
|
|
81
|
+
sage: hypergeometric([], [1/2], -z^2/4).series(z, 11) # needs sage.symbolic
|
|
82
|
+
1 + (-1/2)*z^2 + 1/24*z^4 + (-1/720)*z^6 + 1/40320*z^8 +...
|
|
83
|
+
(-1/3628800)*z^10 + Order(z^11)
|
|
84
|
+
|
|
85
|
+
sage: hypergeometric([1], [5], x).series(x, 5) # needs sage.symbolic
|
|
86
|
+
1 + 1/5*x + 1/30*x^2 + 1/210*x^3 + 1/1680*x^4 + Order(x^5)
|
|
87
|
+
|
|
88
|
+
sage: sum(hypergeometric([1, 2], [3], 1/3).terms(6)).n() # needs sage.symbolic
|
|
89
|
+
1.29788359788360
|
|
90
|
+
sage: hypergeometric([1, 2], [3], 1/3).n() # needs sage.symbolic
|
|
91
|
+
1.29837194594696
|
|
92
|
+
sage: hypergeometric([], [], x).series(x, 20)(x=1).n() == e.n() # needs sage.symbolic
|
|
93
|
+
True
|
|
94
|
+
|
|
95
|
+
Plotting::
|
|
96
|
+
|
|
97
|
+
sage: # needs sage.symbolic
|
|
98
|
+
sage: f(x) = hypergeometric([1, 1], [3, 3, 3], x)
|
|
99
|
+
sage: plot(f, x, -30, 30) # needs sage.plot
|
|
100
|
+
Graphics object consisting of 1 graphics primitive
|
|
101
|
+
sage: g(x) = hypergeometric([x], [], 2)
|
|
102
|
+
sage: complex_plot(g, (-1, 1), (-1, 1)) # needs sage.plot
|
|
103
|
+
Graphics object consisting of 1 graphics primitive
|
|
104
|
+
|
|
105
|
+
Numeric evaluation::
|
|
106
|
+
|
|
107
|
+
sage: # needs sage.symbolic
|
|
108
|
+
sage: hypergeometric([1], [], 1/10).n() # geometric series
|
|
109
|
+
1.11111111111111
|
|
110
|
+
sage: hypergeometric([], [], 1).n() # e
|
|
111
|
+
2.71828182845905
|
|
112
|
+
sage: hypergeometric([], [], 3., hold=True)
|
|
113
|
+
hypergeometric((), (), 3.00000000000000)
|
|
114
|
+
sage: hypergeometric([1, 2, 3], [4, 5, 6], 1/2).n()
|
|
115
|
+
1.02573619590134
|
|
116
|
+
sage: hypergeometric([1, 2, 3], [4, 5, 6], 1/2).n(digits=30)
|
|
117
|
+
1.02573619590133865036584139535
|
|
118
|
+
sage: hypergeometric([5 - 3*I], [3/2, 2 + I, sqrt(2)], 4 + I).n()
|
|
119
|
+
5.52605111678803 - 7.86331357527540*I
|
|
120
|
+
sage: hypergeometric((10, 10), (50,), 2.)
|
|
121
|
+
-1705.75733163554 - 356.749986056024*I
|
|
122
|
+
|
|
123
|
+
Conversions::
|
|
124
|
+
|
|
125
|
+
sage: maxima(hypergeometric([1, 1, 1], [3, 3, 3], x)) # needs sage.symbolic
|
|
126
|
+
hypergeometric([1,1,1],[3,3,3],_SAGE_VAR_x)
|
|
127
|
+
sage: hypergeometric((5,), (4,), 3)._sympy_() # needs sympy sage.symbolic
|
|
128
|
+
hyper((5,), (4,), 3)
|
|
129
|
+
sage: hypergeometric((5, 4), (4, 4), 3)._mathematica_init_() # needs sage.symbolic
|
|
130
|
+
'HypergeometricPFQ[{5,4},{4,4},3]'
|
|
131
|
+
|
|
132
|
+
Arbitrary level of nesting for conversions::
|
|
133
|
+
|
|
134
|
+
sage: maxima(nest(lambda y: hypergeometric([y], [], x), 3, 1)) # needs sage.symbolic
|
|
135
|
+
1/(1-_SAGE_VAR_x)^(1/(1-_SAGE_VAR_x)^(1/(1-_SAGE_VAR_x)))
|
|
136
|
+
sage: maxima(nest(lambda y: hypergeometric([y], [3], x), 3, 1))._sage_() # needs sage.symbolic
|
|
137
|
+
hypergeometric((hypergeometric((hypergeometric((1,), (3,), x),), (3,),...
|
|
138
|
+
x),), (3,), x)
|
|
139
|
+
sage: nest(lambda y: hypergeometric([y], [], x), 3, 1)._mathematica_init_() # needs sage.symbolic
|
|
140
|
+
'HypergeometricPFQ[{HypergeometricPFQ[{HypergeometricPFQ[{1},{},x]},...
|
|
141
|
+
|
|
142
|
+
The confluent hypergeometric functions can arise as solutions to second-order
|
|
143
|
+
differential equations (example from `here <http://ask.sagemath.org/question/
|
|
144
|
+
1168/how-can-one-use-maxima-kummer-confluent-functions>`_)::
|
|
145
|
+
|
|
146
|
+
sage: var('m') # needs sage.symbolic
|
|
147
|
+
m
|
|
148
|
+
sage: y = function('y')(x) # needs sage.symbolic
|
|
149
|
+
sage: desolve(diff(y, x, 2) + 2*x*diff(y, x) - 4*m*y, y, # needs sage.symbolic
|
|
150
|
+
....: contrib_ode=true, ivar=x)
|
|
151
|
+
[y(x) == _K1*hypergeometric_M(-m, 1/2, -x^2) +...
|
|
152
|
+
_K2*hypergeometric_U(-m, 1/2, -x^2)]
|
|
153
|
+
|
|
154
|
+
Series expansions of confluent hypergeometric functions::
|
|
155
|
+
|
|
156
|
+
sage: hypergeometric_M(2, 2, x).series(x, 3) # needs sage.symbolic
|
|
157
|
+
1 + 1*x + 1/2*x^2 + Order(x^3)
|
|
158
|
+
sage: hypergeometric_U(2, 2, x).series(x == 3, 100).subs(x=1).n() # needs sage.symbolic
|
|
159
|
+
0.403652637676806
|
|
160
|
+
sage: hypergeometric_U(2, 2, 1).n() # needs mpmath sage.symbolic
|
|
161
|
+
0.403652637676806
|
|
162
|
+
"""
|
|
163
|
+
|
|
164
|
+
# ****************************************************************************
|
|
165
|
+
# Copyright (C) 2010 Fredrik Johansson <fredrik.johansson@gmail.com>
|
|
166
|
+
# Copyright (C) 2013 Eviatar Bach <eviatarbach@gmail.com>
|
|
167
|
+
#
|
|
168
|
+
# This program is free software: you can redistribute it and/or modify
|
|
169
|
+
# it under the terms of the GNU General Public License as published by
|
|
170
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
171
|
+
# (at your option) any later version.
|
|
172
|
+
# https://www.gnu.org/licenses/
|
|
173
|
+
# ****************************************************************************
|
|
174
|
+
|
|
175
|
+
from functools import reduce
|
|
176
|
+
|
|
177
|
+
from sage.arith.misc import binomial, factorial, rising_factorial
|
|
178
|
+
from sage.calculus.functional import derivative
|
|
179
|
+
from sage.functions.error import erf
|
|
180
|
+
from sage.functions.gamma import gamma
|
|
181
|
+
from sage.functions.hyperbolic import cosh, sinh
|
|
182
|
+
from sage.functions.log import exp, log
|
|
183
|
+
from sage.functions.other import sqrt, real_part
|
|
184
|
+
from sage.misc.lazy_import import lazy_import
|
|
185
|
+
from sage.misc.misc_c import prod
|
|
186
|
+
from sage.rings.infinity import Infinity
|
|
187
|
+
from sage.rings.integer import Integer
|
|
188
|
+
from sage.rings.integer_ring import ZZ
|
|
189
|
+
from sage.rings.rational_field import QQ
|
|
190
|
+
from sage.structure.element import Expression, get_coercion_model
|
|
191
|
+
from sage.symbolic.function import BuiltinFunction
|
|
192
|
+
|
|
193
|
+
lazy_import('sage.misc.latex', 'latex')
|
|
194
|
+
|
|
195
|
+
lazy_import('sage.symbolic.constants', 'pi')
|
|
196
|
+
lazy_import('sage.symbolic.ring', 'SR')
|
|
197
|
+
|
|
198
|
+
lazy_import('sage.libs.mpmath.utils', 'call', as_='_mpmath_utils_call')
|
|
199
|
+
lazy_import('mpmath', 'hyp1f1', as_='_mpmath_hyp1f1')
|
|
200
|
+
lazy_import('mpmath', 'hyper', as_='_mpmath_hyper')
|
|
201
|
+
lazy_import('mpmath', 'hyperu', as_='_mpmath_hyperu')
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def rational_param_as_tuple(x):
|
|
205
|
+
r"""
|
|
206
|
+
Utility function for converting rational `\,_pF_q` parameters to
|
|
207
|
+
tuples (which mpmath handles more efficiently).
|
|
208
|
+
|
|
209
|
+
EXAMPLES::
|
|
210
|
+
|
|
211
|
+
sage: from sage.functions.hypergeometric import rational_param_as_tuple
|
|
212
|
+
sage: rational_param_as_tuple(1/2)
|
|
213
|
+
(1, 2)
|
|
214
|
+
sage: rational_param_as_tuple(3)
|
|
215
|
+
3
|
|
216
|
+
sage: rational_param_as_tuple(pi) # needs sage.symbolic
|
|
217
|
+
pi
|
|
218
|
+
"""
|
|
219
|
+
try:
|
|
220
|
+
x = x.pyobject()
|
|
221
|
+
except AttributeError:
|
|
222
|
+
pass
|
|
223
|
+
try:
|
|
224
|
+
if x.parent() is QQ:
|
|
225
|
+
p = int(x.numer())
|
|
226
|
+
q = int(x.denom())
|
|
227
|
+
return p, q
|
|
228
|
+
except AttributeError:
|
|
229
|
+
pass
|
|
230
|
+
return x
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
class Hypergeometric(BuiltinFunction):
|
|
234
|
+
r"""
|
|
235
|
+
Represent a (formal) generalized infinite hypergeometric series.
|
|
236
|
+
|
|
237
|
+
It is defined as
|
|
238
|
+
|
|
239
|
+
.. MATH::
|
|
240
|
+
|
|
241
|
+
\,_pF_q(a_1, \ldots, a_p; b_1, \ldots, b_q; z)
|
|
242
|
+
= \sum_{n=0}^{\infty} \frac{(a_1)_n \cdots (a_p)_n}{(b_1)_n
|
|
243
|
+
\cdots(b_q)_n} \, \frac{z^n}{n!},
|
|
244
|
+
|
|
245
|
+
where `(x)_n` is the rising factorial.
|
|
246
|
+
"""
|
|
247
|
+
def __init__(self):
|
|
248
|
+
"""
|
|
249
|
+
Initialize class.
|
|
250
|
+
|
|
251
|
+
EXAMPLES::
|
|
252
|
+
|
|
253
|
+
sage: maxima(hypergeometric) # needs sage.symbolic
|
|
254
|
+
hypergeometric
|
|
255
|
+
|
|
256
|
+
TESTS::
|
|
257
|
+
|
|
258
|
+
sage: F = hypergeometric([-4,2],[1],1) # optional - maple
|
|
259
|
+
sage: G = maple(F); G # optional - maple
|
|
260
|
+
hypergeom([-4, 2],[1],1)
|
|
261
|
+
sage: G.simplify() # optional - maple
|
|
262
|
+
0
|
|
263
|
+
"""
|
|
264
|
+
BuiltinFunction.__init__(self, 'hypergeometric', nargs=3,
|
|
265
|
+
conversions={'mathematica':
|
|
266
|
+
'HypergeometricPFQ',
|
|
267
|
+
'maxima': 'hypergeometric',
|
|
268
|
+
'maple': 'hypergeom',
|
|
269
|
+
'sympy': 'hyper',
|
|
270
|
+
'fricas': 'hypergeometricF'})
|
|
271
|
+
|
|
272
|
+
def __call__(self, a, b, z, **kwargs):
|
|
273
|
+
"""
|
|
274
|
+
Return symbolic hypergeometric function expression.
|
|
275
|
+
|
|
276
|
+
INPUT:
|
|
277
|
+
|
|
278
|
+
- ``a`` -- list or tuple of parameters
|
|
279
|
+
- ``b`` -- list or tuple of parameters
|
|
280
|
+
- ``z`` -- number or symbolic expression
|
|
281
|
+
|
|
282
|
+
EXAMPLES::
|
|
283
|
+
|
|
284
|
+
sage: # needs sage.symbolic
|
|
285
|
+
sage: hypergeometric([], [], 1)
|
|
286
|
+
hypergeometric((), (), 1)
|
|
287
|
+
sage: hypergeometric([], [1], 1)
|
|
288
|
+
hypergeometric((), (1,), 1)
|
|
289
|
+
sage: hypergeometric([2, 3], [1], 1)
|
|
290
|
+
hypergeometric((2, 3), (1,), 1)
|
|
291
|
+
sage: hypergeometric([], [], x)
|
|
292
|
+
hypergeometric((), (), x)
|
|
293
|
+
sage: hypergeometric([x], [], x^2)
|
|
294
|
+
hypergeometric((x,), (), x^2)
|
|
295
|
+
|
|
296
|
+
The only simplification that is done automatically is returning 1
|
|
297
|
+
if ``z`` is 0. For other simplifications use the
|
|
298
|
+
``simplify_hypergeometric`` method.
|
|
299
|
+
|
|
300
|
+
TESTS::
|
|
301
|
+
|
|
302
|
+
sage: hypergeometric([2, 3, 4], [4, 1], 1) # needs sage.symbolic
|
|
303
|
+
hypergeometric((2, 3, 4), (4, 1), 1)
|
|
304
|
+
"""
|
|
305
|
+
return BuiltinFunction.__call__(self,
|
|
306
|
+
SR._force_pyobject(a),
|
|
307
|
+
SR._force_pyobject(b),
|
|
308
|
+
z, **kwargs)
|
|
309
|
+
|
|
310
|
+
def _print_latex_(self, a, b, z):
|
|
311
|
+
r"""
|
|
312
|
+
TESTS::
|
|
313
|
+
|
|
314
|
+
sage: latex(hypergeometric([1, 1], [2], -1)) # needs sage.symbolic
|
|
315
|
+
\,_2F_1\left(\begin{matrix} 1,1 \\ 2 \end{matrix} ; -1 \right)
|
|
316
|
+
"""
|
|
317
|
+
aa = ",".join(latex(c) for c in a)
|
|
318
|
+
bb = ",".join(latex(c) for c in b)
|
|
319
|
+
z = latex(z)
|
|
320
|
+
return (r"\,_{}F_{}\left(\begin{{matrix}} {} \\ {} \end{{matrix}} ; "
|
|
321
|
+
r"{} \right)").format(len(a), len(b), aa, bb, z)
|
|
322
|
+
|
|
323
|
+
def _eval_(self, a, b, z, **kwargs):
|
|
324
|
+
"""
|
|
325
|
+
EXAMPLES::
|
|
326
|
+
|
|
327
|
+
sage: hypergeometric([], [], 0) # needs sage.symbolic
|
|
328
|
+
1
|
|
329
|
+
"""
|
|
330
|
+
if not isinstance(a, tuple) or not isinstance(b, tuple):
|
|
331
|
+
raise TypeError("The first two parameters must be of type list")
|
|
332
|
+
|
|
333
|
+
if not isinstance(z, Expression) and z == 0: # Expression is excluded
|
|
334
|
+
return Integer(1) # to avoid call to Maxima
|
|
335
|
+
|
|
336
|
+
def _evalf_try_(self, a, b, z):
|
|
337
|
+
"""
|
|
338
|
+
Call :meth:`_evalf_` if one of the arguments is numerical and none
|
|
339
|
+
of the arguments are symbolic.
|
|
340
|
+
|
|
341
|
+
OUTPUT:
|
|
342
|
+
|
|
343
|
+
- ``None`` if we didn't succeed to call :meth:`_evalf_` or if
|
|
344
|
+
the input wasn't suitable for it.
|
|
345
|
+
|
|
346
|
+
- otherwise, a numerical value for the function.
|
|
347
|
+
|
|
348
|
+
EXAMPLES::
|
|
349
|
+
|
|
350
|
+
sage: hypergeometric._evalf_try_((1.0,), (2.0,), 3.0) # needs mpmath
|
|
351
|
+
6.36184564106256
|
|
352
|
+
sage: hypergeometric._evalf_try_((1.0, 1), (), 3.0) # needs mpmath
|
|
353
|
+
-0.0377593153441588 + 0.750349833788561*I
|
|
354
|
+
sage: hypergeometric._evalf_try_((1, 1), (), 3) # exact input
|
|
355
|
+
sage: hypergeometric._evalf_try_((x,), (), 1.0) # symbolic # needs sage.symbolic
|
|
356
|
+
sage: hypergeometric._evalf_try_(1.0, 2.0, 3.0) # not tuples
|
|
357
|
+
"""
|
|
358
|
+
# We need to override this for hypergeometric functions since
|
|
359
|
+
# the first 2 arguments are tuples and the generic _evalf_try_
|
|
360
|
+
# cannot handle that.
|
|
361
|
+
if not isinstance(a, tuple) or not isinstance(b, tuple):
|
|
362
|
+
return None
|
|
363
|
+
|
|
364
|
+
args = list(a) + list(b) + [z]
|
|
365
|
+
if any(self._is_numerical(x) for x in args):
|
|
366
|
+
if not any(isinstance(x, Expression) for x in args):
|
|
367
|
+
p = get_coercion_model().common_parent(*args)
|
|
368
|
+
return self._evalf_(a, b, z, parent=p)
|
|
369
|
+
|
|
370
|
+
def _evalf_(self, a, b, z, parent=None, algorithm=None):
|
|
371
|
+
"""
|
|
372
|
+
TESTS::
|
|
373
|
+
|
|
374
|
+
sage: hypergeometric([1, 1], [2], -1).n() # needs sage.symbolic
|
|
375
|
+
0.693147180559945
|
|
376
|
+
sage: hypergeometric([], [], RealField(100)(1)) # needs sage.rings.real_mpfr sage.symbolic
|
|
377
|
+
2.7182818284590452353602874714
|
|
378
|
+
"""
|
|
379
|
+
if not isinstance(a, tuple) or not isinstance(b, tuple):
|
|
380
|
+
raise TypeError("The first two parameters must be of type list")
|
|
381
|
+
aa = [rational_param_as_tuple(c) for c in a]
|
|
382
|
+
bb = [rational_param_as_tuple(c) for c in b]
|
|
383
|
+
return _mpmath_utils_call(_mpmath_hyper, aa, bb, z, parent=parent)
|
|
384
|
+
|
|
385
|
+
def _tderivative_(self, a, b, z, *args, **kwargs):
|
|
386
|
+
"""
|
|
387
|
+
EXAMPLES::
|
|
388
|
+
|
|
389
|
+
sage: hypergeometric([1/3, 2/3], [5], x^2).diff(x) # needs sage.symbolic
|
|
390
|
+
4/45*x*hypergeometric((4/3, 5/3), (6,), x^2)
|
|
391
|
+
sage: hypergeometric([1, 2], [x], 2).diff(x) # needs sage.symbolic
|
|
392
|
+
Traceback (most recent call last):
|
|
393
|
+
...
|
|
394
|
+
NotImplementedError: derivative of hypergeometric function with...
|
|
395
|
+
respect to parameters. Try calling .simplify_hypergeometric()...
|
|
396
|
+
first.
|
|
397
|
+
sage: hypergeometric([1/3, 2/3], [5], 2).diff(x) # needs sage.symbolic
|
|
398
|
+
0
|
|
399
|
+
"""
|
|
400
|
+
diff_param = kwargs['diff_param']
|
|
401
|
+
if diff_param in hypergeometric(a, b, 1).variables(): # ignore z
|
|
402
|
+
raise NotImplementedError("derivative of hypergeometric function "
|
|
403
|
+
"with respect to parameters. Try calling"
|
|
404
|
+
" .simplify_hypergeometric() first.")
|
|
405
|
+
t = (reduce(lambda x, y: x * y, a, 1) *
|
|
406
|
+
reduce(lambda x, y: x / y, b, Integer(1)))
|
|
407
|
+
return (t * derivative(z, diff_param) *
|
|
408
|
+
hypergeometric([c + 1 for c in a], [c + 1 for c in b], z))
|
|
409
|
+
|
|
410
|
+
class EvaluationMethods:
|
|
411
|
+
|
|
412
|
+
def _fast_callable_(self, a, b, z, etb):
|
|
413
|
+
"""
|
|
414
|
+
Override the ``fast_callable`` method.
|
|
415
|
+
|
|
416
|
+
OUTPUT:
|
|
417
|
+
|
|
418
|
+
A :class:`~sage.ext.fast_callable.ExpressionCall` representing the
|
|
419
|
+
hypergeometric function in the expression tree.
|
|
420
|
+
|
|
421
|
+
EXAMPLES::
|
|
422
|
+
|
|
423
|
+
sage: # needs sage.symbolic
|
|
424
|
+
sage: h = hypergeometric([], [], x)
|
|
425
|
+
sage: from sage.ext.fast_callable import ExpressionTreeBuilder
|
|
426
|
+
sage: etb = ExpressionTreeBuilder(vars=['x'])
|
|
427
|
+
sage: h._fast_callable_(etb)
|
|
428
|
+
{hypergeometric((), (), x)}(v_0)
|
|
429
|
+
|
|
430
|
+
sage: var('x, y') # needs sage.symbolic
|
|
431
|
+
(x, y)
|
|
432
|
+
sage: f = fast_callable(hypergeometric([y], [], x), vars=[x, y]) # needs sage.symbolic
|
|
433
|
+
sage: f(3, 4) # needs sage.symbolic
|
|
434
|
+
hypergeometric((4,), (), 3)
|
|
435
|
+
"""
|
|
436
|
+
return etb.call(self, *map(etb.var, etb._vars))
|
|
437
|
+
|
|
438
|
+
def sorted_parameters(self, a, b, z):
|
|
439
|
+
"""
|
|
440
|
+
Return with parameters sorted in a canonical order.
|
|
441
|
+
|
|
442
|
+
EXAMPLES::
|
|
443
|
+
|
|
444
|
+
sage: hypergeometric([2, 1, 3], [5, 4], # needs sage.symbolic
|
|
445
|
+
....: 1/2).sorted_parameters()
|
|
446
|
+
hypergeometric((1, 2, 3), (4, 5), 1/2)
|
|
447
|
+
"""
|
|
448
|
+
return hypergeometric(sorted(a), sorted(b), z)
|
|
449
|
+
|
|
450
|
+
def eliminate_parameters(self, a, b, z):
|
|
451
|
+
"""
|
|
452
|
+
Eliminate repeated parameters by pairwise cancellation of identical
|
|
453
|
+
terms in ``a`` and ``b``.
|
|
454
|
+
|
|
455
|
+
EXAMPLES::
|
|
456
|
+
|
|
457
|
+
sage: hypergeometric([1, 1, 2, 5], [5, 1, 4], # needs sage.symbolic
|
|
458
|
+
....: 1/2).eliminate_parameters()
|
|
459
|
+
hypergeometric((1, 2), (4,), 1/2)
|
|
460
|
+
sage: hypergeometric([x], [x], x).eliminate_parameters() # needs sage.symbolic
|
|
461
|
+
hypergeometric((), (), x)
|
|
462
|
+
sage: hypergeometric((5, 4), (4, 4), 3).eliminate_parameters() # needs sage.symbolic
|
|
463
|
+
hypergeometric((5,), (4,), 3)
|
|
464
|
+
"""
|
|
465
|
+
aa = list(a) # tuples are immutable
|
|
466
|
+
bb = list(b)
|
|
467
|
+
q = qq = len(bb)
|
|
468
|
+
i = 0
|
|
469
|
+
while i < qq and aa:
|
|
470
|
+
bbi = bb[i]
|
|
471
|
+
if bbi in aa:
|
|
472
|
+
aa.remove(bbi)
|
|
473
|
+
bb.remove(bbi)
|
|
474
|
+
qq -= 1
|
|
475
|
+
else:
|
|
476
|
+
i += 1
|
|
477
|
+
if qq != q:
|
|
478
|
+
return hypergeometric(aa, bb, z)
|
|
479
|
+
return self
|
|
480
|
+
|
|
481
|
+
def is_termwise_finite(self, a, b, z) -> bool:
|
|
482
|
+
"""
|
|
483
|
+
Determine whether all terms of ``self`` are finite.
|
|
484
|
+
|
|
485
|
+
Any infinite terms or ambiguous terms beyond the first
|
|
486
|
+
zero, if one exists, are ignored.
|
|
487
|
+
|
|
488
|
+
Ambiguous cases (where a term is the product of both zero
|
|
489
|
+
and an infinity) are not considered finite.
|
|
490
|
+
|
|
491
|
+
EXAMPLES::
|
|
492
|
+
|
|
493
|
+
sage: # needs sage.symbolic
|
|
494
|
+
sage: hypergeometric([2], [3, 4], 5).is_termwise_finite()
|
|
495
|
+
True
|
|
496
|
+
sage: hypergeometric([2], [-3, 4], 5).is_termwise_finite()
|
|
497
|
+
False
|
|
498
|
+
sage: hypergeometric([-2], [-3, 4], 5).is_termwise_finite()
|
|
499
|
+
True
|
|
500
|
+
sage: hypergeometric([-3], [-3, 4],
|
|
501
|
+
....: 5).is_termwise_finite() # ambiguous
|
|
502
|
+
False
|
|
503
|
+
|
|
504
|
+
sage: # needs sage.symbolic
|
|
505
|
+
sage: hypergeometric([0], [-1], 5).is_termwise_finite()
|
|
506
|
+
True
|
|
507
|
+
sage: hypergeometric([0], [0],
|
|
508
|
+
....: 5).is_termwise_finite() # ambiguous
|
|
509
|
+
False
|
|
510
|
+
sage: hypergeometric([1], [2], Infinity).is_termwise_finite()
|
|
511
|
+
False
|
|
512
|
+
sage: (hypergeometric([0], [0], Infinity)
|
|
513
|
+
....: .is_termwise_finite()) # ambiguous
|
|
514
|
+
False
|
|
515
|
+
sage: (hypergeometric([0], [], Infinity)
|
|
516
|
+
....: .is_termwise_finite()) # ambiguous
|
|
517
|
+
False
|
|
518
|
+
"""
|
|
519
|
+
if z == 0:
|
|
520
|
+
return 0 not in b
|
|
521
|
+
if abs(z) == Infinity:
|
|
522
|
+
return False
|
|
523
|
+
for bb in b:
|
|
524
|
+
if bb in ZZ and bb <= 0:
|
|
525
|
+
if any((aa in ZZ) and (bb < aa <= 0) for aa in a):
|
|
526
|
+
continue
|
|
527
|
+
return False
|
|
528
|
+
return True
|
|
529
|
+
|
|
530
|
+
def is_terminating(self, a, b, z):
|
|
531
|
+
r"""
|
|
532
|
+
Determine whether the series represented by ``self`` terminates
|
|
533
|
+
after a finite number of terms.
|
|
534
|
+
|
|
535
|
+
This happens if any of the
|
|
536
|
+
numerator parameters are nonnegative integers (with no
|
|
537
|
+
preceding nonnegative denominator parameters), or `z = 0`.
|
|
538
|
+
|
|
539
|
+
If terminating, the series represents a polynomial of `z`.
|
|
540
|
+
|
|
541
|
+
EXAMPLES::
|
|
542
|
+
|
|
543
|
+
sage: hypergeometric([1, 2], [3, 4], x).is_terminating() # needs sage.symbolic
|
|
544
|
+
False
|
|
545
|
+
sage: hypergeometric([1, -2], [3, 4], x).is_terminating() # needs sage.symbolic
|
|
546
|
+
True
|
|
547
|
+
sage: hypergeometric([1, -2], [], x).is_terminating() # needs sage.symbolic
|
|
548
|
+
True
|
|
549
|
+
"""
|
|
550
|
+
if z == 0:
|
|
551
|
+
return True
|
|
552
|
+
for aa in a:
|
|
553
|
+
if (aa in ZZ) and (aa <= 0):
|
|
554
|
+
return self.is_termwise_finite()
|
|
555
|
+
return False
|
|
556
|
+
|
|
557
|
+
def is_absolutely_convergent(self, a, b, z):
|
|
558
|
+
r"""
|
|
559
|
+
Determine whether ``self`` converges absolutely as an infinite
|
|
560
|
+
series. ``False`` is returned if not all terms are finite.
|
|
561
|
+
|
|
562
|
+
EXAMPLES:
|
|
563
|
+
|
|
564
|
+
Degree giving infinite radius of convergence::
|
|
565
|
+
|
|
566
|
+
sage: hypergeometric([2, 3], [4, 5], # needs sage.symbolic
|
|
567
|
+
....: 6).is_absolutely_convergent()
|
|
568
|
+
True
|
|
569
|
+
sage: hypergeometric([2, 3], [-4, 5], # needs sage.symbolic
|
|
570
|
+
....: 6).is_absolutely_convergent() # undefined
|
|
571
|
+
False
|
|
572
|
+
sage: (hypergeometric([2, 3], [-4, 5], Infinity) # needs sage.symbolic
|
|
573
|
+
....: .is_absolutely_convergent()) # undefined
|
|
574
|
+
False
|
|
575
|
+
|
|
576
|
+
Ordinary geometric series (unit radius of convergence)::
|
|
577
|
+
|
|
578
|
+
sage: # needs sage.symbolic
|
|
579
|
+
sage: hypergeometric([1], [], 1/2).is_absolutely_convergent()
|
|
580
|
+
True
|
|
581
|
+
sage: hypergeometric([1], [], 2).is_absolutely_convergent()
|
|
582
|
+
False
|
|
583
|
+
sage: hypergeometric([1], [], 1).is_absolutely_convergent()
|
|
584
|
+
False
|
|
585
|
+
sage: hypergeometric([1], [], -1).is_absolutely_convergent()
|
|
586
|
+
False
|
|
587
|
+
sage: hypergeometric([1], [], -1).n() # Sum still exists
|
|
588
|
+
0.500000000000000
|
|
589
|
+
|
|
590
|
+
Degree `p = q+1` (unit radius of convergence)::
|
|
591
|
+
|
|
592
|
+
sage: # needs sage.symbolic
|
|
593
|
+
sage: hypergeometric([2, 3], [4], 6).is_absolutely_convergent()
|
|
594
|
+
False
|
|
595
|
+
sage: hypergeometric([2, 3], [4], 1).is_absolutely_convergent()
|
|
596
|
+
False
|
|
597
|
+
sage: hypergeometric([2, 3], [5], 1).is_absolutely_convergent()
|
|
598
|
+
False
|
|
599
|
+
sage: hypergeometric([2, 3], [6], 1).is_absolutely_convergent()
|
|
600
|
+
True
|
|
601
|
+
sage: hypergeometric([-2, 3], [4],
|
|
602
|
+
....: 5).is_absolutely_convergent()
|
|
603
|
+
True
|
|
604
|
+
sage: hypergeometric([2, -3], [4],
|
|
605
|
+
....: 5).is_absolutely_convergent()
|
|
606
|
+
True
|
|
607
|
+
sage: hypergeometric([2, -3], [-4],
|
|
608
|
+
....: 5).is_absolutely_convergent()
|
|
609
|
+
True
|
|
610
|
+
sage: hypergeometric([2, -3], [-1],
|
|
611
|
+
....: 5).is_absolutely_convergent()
|
|
612
|
+
False
|
|
613
|
+
|
|
614
|
+
Degree giving zero radius of convergence::
|
|
615
|
+
|
|
616
|
+
sage: hypergeometric([1, 2, 3], [4], # needs sage.symbolic
|
|
617
|
+
....: 2).is_absolutely_convergent()
|
|
618
|
+
False
|
|
619
|
+
sage: hypergeometric([1, 2, 3], [4], # needs sage.symbolic
|
|
620
|
+
....: 1/2).is_absolutely_convergent()
|
|
621
|
+
False
|
|
622
|
+
sage: (hypergeometric([1, 2, -3], [4], 1/2) # needs sage.symbolic
|
|
623
|
+
....: .is_absolutely_convergent()) # polynomial
|
|
624
|
+
True
|
|
625
|
+
"""
|
|
626
|
+
p, q = len(a), len(b)
|
|
627
|
+
if not self.is_termwise_finite():
|
|
628
|
+
return False
|
|
629
|
+
if p <= q:
|
|
630
|
+
return True
|
|
631
|
+
if self.is_terminating():
|
|
632
|
+
return True
|
|
633
|
+
if p == q + 1:
|
|
634
|
+
if abs(z) < 1:
|
|
635
|
+
return True
|
|
636
|
+
if abs(z) == 1:
|
|
637
|
+
if real_part(sum(b) - sum(a)) > 0:
|
|
638
|
+
return True
|
|
639
|
+
return False
|
|
640
|
+
|
|
641
|
+
def terms(self, a, b, z, n=None):
|
|
642
|
+
"""
|
|
643
|
+
Generate the terms of ``self`` (optionally only ``n`` terms).
|
|
644
|
+
|
|
645
|
+
EXAMPLES::
|
|
646
|
+
|
|
647
|
+
sage: list(hypergeometric([-2, 1], [3, 4], x).terms()) # needs sage.symbolic
|
|
648
|
+
[1, -1/6*x, 1/120*x^2]
|
|
649
|
+
sage: list(hypergeometric([-2, 1], [3, 4], x).terms(2)) # needs sage.symbolic
|
|
650
|
+
[1, -1/6*x]
|
|
651
|
+
sage: list(hypergeometric([-2, 1], [3, 4], x).terms(0)) # needs sage.symbolic
|
|
652
|
+
[]
|
|
653
|
+
"""
|
|
654
|
+
if n is None:
|
|
655
|
+
n = Infinity
|
|
656
|
+
t = Integer(1)
|
|
657
|
+
k = 1
|
|
658
|
+
while k <= n:
|
|
659
|
+
yield t
|
|
660
|
+
for aa in a:
|
|
661
|
+
t *= (aa + k - 1)
|
|
662
|
+
for bb in b:
|
|
663
|
+
t /= (bb + k - 1)
|
|
664
|
+
t *= z
|
|
665
|
+
if t == 0:
|
|
666
|
+
break
|
|
667
|
+
t /= k
|
|
668
|
+
k += 1
|
|
669
|
+
|
|
670
|
+
def deflated(self, a, b, z):
|
|
671
|
+
r"""
|
|
672
|
+
Rewrite as a linear combination of functions of strictly lower
|
|
673
|
+
degree by eliminating all parameters ``a[i]`` and ``b[j]`` such
|
|
674
|
+
that ``a[i]`` = ``b[i]`` + ``m`` for nonnegative integer ``m``.
|
|
675
|
+
|
|
676
|
+
EXAMPLES::
|
|
677
|
+
|
|
678
|
+
sage: # needs sage.symbolic
|
|
679
|
+
sage: x = hypergeometric([6, 1], [3, 4, 5], 10)
|
|
680
|
+
sage: y = x.deflated(); y
|
|
681
|
+
1/252*hypergeometric((4,), (7, 8), 10)
|
|
682
|
+
+ 1/12*hypergeometric((3,), (6, 7), 10)
|
|
683
|
+
+ 1/2*hypergeometric((2,), (5, 6), 10)
|
|
684
|
+
+ hypergeometric((1,), (4, 5), 10)
|
|
685
|
+
sage: x.n(); y.n()
|
|
686
|
+
2.87893612686782
|
|
687
|
+
2.87893612686782
|
|
688
|
+
|
|
689
|
+
sage: # needs sage.symbolic
|
|
690
|
+
sage: x = hypergeometric([6, 7], [3, 4, 5], 10)
|
|
691
|
+
sage: y = x.deflated(); y
|
|
692
|
+
25/27216*hypergeometric((), (11,), 10)
|
|
693
|
+
+ 25/648*hypergeometric((), (10,), 10)
|
|
694
|
+
+ 265/504*hypergeometric((), (9,), 10)
|
|
695
|
+
+ 181/63*hypergeometric((), (8,), 10)
|
|
696
|
+
+ 19/3*hypergeometric((), (7,), 10)
|
|
697
|
+
+ 5*hypergeometric((), (6,), 10)
|
|
698
|
+
+ hypergeometric((), (5,), 10)
|
|
699
|
+
sage: x.n(); y.n()
|
|
700
|
+
63.0734110716969
|
|
701
|
+
63.0734110716969
|
|
702
|
+
"""
|
|
703
|
+
return sum(map(prod, self._deflated()))
|
|
704
|
+
|
|
705
|
+
def _deflated(self, a, b, z):
|
|
706
|
+
"""
|
|
707
|
+
Private helper to return list of deflated terms.
|
|
708
|
+
|
|
709
|
+
EXAMPLES::
|
|
710
|
+
|
|
711
|
+
sage: # needs sage.symbolic
|
|
712
|
+
sage: x = hypergeometric([5], [4], 3)
|
|
713
|
+
sage: y = x.deflated(); y
|
|
714
|
+
7/4*hypergeometric((), (), 3)
|
|
715
|
+
sage: x.n(); y.n()
|
|
716
|
+
35.1496896155784
|
|
717
|
+
35.1496896155784
|
|
718
|
+
"""
|
|
719
|
+
new = self.eliminate_parameters()
|
|
720
|
+
aa = new.operands()[0].operands()
|
|
721
|
+
bb = new.operands()[1].operands()
|
|
722
|
+
for i, aaa in enumerate(aa):
|
|
723
|
+
for j, bbb in enumerate(bb):
|
|
724
|
+
m = aaa - bbb
|
|
725
|
+
if m in ZZ and m > 0:
|
|
726
|
+
aaaa = aa[:i] + aa[i + 1:]
|
|
727
|
+
bbbb = bb[:j] + bb[j + 1:]
|
|
728
|
+
terms = []
|
|
729
|
+
for k in range(m + 1):
|
|
730
|
+
# TODO: could rewrite prefactors as recurrence
|
|
731
|
+
term = binomial(m, k)
|
|
732
|
+
for c in aaaa:
|
|
733
|
+
term *= rising_factorial(c, k)
|
|
734
|
+
for c in bbbb:
|
|
735
|
+
term /= rising_factorial(c, k)
|
|
736
|
+
term *= z ** k
|
|
737
|
+
term /= rising_factorial(aaa - m, k)
|
|
738
|
+
F = hypergeometric([c + k for c in aaaa],
|
|
739
|
+
[c + k for c in bbbb], z)
|
|
740
|
+
unique = []
|
|
741
|
+
counts = []
|
|
742
|
+
for c, f in F._deflated():
|
|
743
|
+
if f in unique:
|
|
744
|
+
counts[unique.index(f)] += c
|
|
745
|
+
else:
|
|
746
|
+
unique.append(f)
|
|
747
|
+
counts.append(c)
|
|
748
|
+
Fterms = zip(counts, unique)
|
|
749
|
+
terms += [(term * termG, G) for (termG, G) in
|
|
750
|
+
Fterms]
|
|
751
|
+
return terms
|
|
752
|
+
return ((1, new),)
|
|
753
|
+
|
|
754
|
+
|
|
755
|
+
hypergeometric = Hypergeometric()
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
def closed_form(hyp):
|
|
759
|
+
"""
|
|
760
|
+
Try to evaluate ``hyp`` in closed form using elementary
|
|
761
|
+
(and other simple) functions.
|
|
762
|
+
|
|
763
|
+
It may be necessary to call :meth:`Hypergeometric.deflated` first to
|
|
764
|
+
find some closed forms.
|
|
765
|
+
|
|
766
|
+
EXAMPLES::
|
|
767
|
+
|
|
768
|
+
sage: # needs sage.symbolic
|
|
769
|
+
sage: from sage.functions.hypergeometric import closed_form
|
|
770
|
+
sage: var('a b c z')
|
|
771
|
+
(a, b, c, z)
|
|
772
|
+
sage: closed_form(hypergeometric([1], [], 1 + z))
|
|
773
|
+
-1/z
|
|
774
|
+
sage: closed_form(hypergeometric([], [], 1 + z))
|
|
775
|
+
e^(z + 1)
|
|
776
|
+
sage: closed_form(hypergeometric([], [1/2], 4))
|
|
777
|
+
cosh(4)
|
|
778
|
+
sage: closed_form(hypergeometric([], [3/2], 4))
|
|
779
|
+
1/4*sinh(4)
|
|
780
|
+
sage: closed_form(hypergeometric([], [5/2], 4))
|
|
781
|
+
3/16*cosh(4) - 3/64*sinh(4)
|
|
782
|
+
sage: closed_form(hypergeometric([], [-3/2], 4))
|
|
783
|
+
19/3*cosh(4) - 4*sinh(4)
|
|
784
|
+
sage: closed_form(hypergeometric([-3, 1], [var('a')], z))
|
|
785
|
+
-3*z/a + 6*z^2/((a + 1)*a) - 6*z^3/((a + 2)*(a + 1)*a) + 1
|
|
786
|
+
sage: closed_form(hypergeometric([-3, 1/3], [-4], z))
|
|
787
|
+
7/162*z^3 + 1/9*z^2 + 1/4*z + 1
|
|
788
|
+
sage: closed_form(hypergeometric([], [], z))
|
|
789
|
+
e^z
|
|
790
|
+
sage: closed_form(hypergeometric([a], [], z))
|
|
791
|
+
1/((-z + 1)^a)
|
|
792
|
+
sage: closed_form(hypergeometric([1, 1, 2], [1, 1], z))
|
|
793
|
+
(z - 1)^(-2)
|
|
794
|
+
sage: closed_form(hypergeometric([2, 3], [1], x))
|
|
795
|
+
-1/(x - 1)^3 + 3*x/(x - 1)^4
|
|
796
|
+
sage: closed_form(hypergeometric([1/2], [3/2], -5))
|
|
797
|
+
1/10*sqrt(5)*sqrt(pi)*erf(sqrt(5))
|
|
798
|
+
sage: closed_form(hypergeometric([2], [5], 3))
|
|
799
|
+
4
|
|
800
|
+
sage: closed_form(hypergeometric([2], [5], 5))
|
|
801
|
+
48/625*e^5 + 612/625
|
|
802
|
+
sage: closed_form(hypergeometric([1/2, 7/2], [3/2], z))
|
|
803
|
+
1/5*z^2/(-z + 1)^(5/2) + 2/3*z/(-z + 1)^(3/2) + 1/sqrt(-z + 1)
|
|
804
|
+
sage: closed_form(hypergeometric([1/2, 1], [2], z))
|
|
805
|
+
-2*(sqrt(-z + 1) - 1)/z
|
|
806
|
+
sage: closed_form(hypergeometric([1, 1], [2], z))
|
|
807
|
+
-log(-z + 1)/z
|
|
808
|
+
sage: closed_form(hypergeometric([1, 1], [3], z))
|
|
809
|
+
-2*((z - 1)*log(-z + 1)/z - 1)/z
|
|
810
|
+
sage: closed_form(hypergeometric([1, 1, 1], [2, 2], x))
|
|
811
|
+
hypergeometric((1, 1, 1), (2, 2), x)
|
|
812
|
+
"""
|
|
813
|
+
if hyp.is_terminating():
|
|
814
|
+
return sum(hyp.terms())
|
|
815
|
+
|
|
816
|
+
new = hyp.eliminate_parameters()
|
|
817
|
+
|
|
818
|
+
def _closed_form(hyp):
|
|
819
|
+
a, b, z = hyp.operands()
|
|
820
|
+
a, b = a.operands(), b.operands()
|
|
821
|
+
p, q = len(a), len(b)
|
|
822
|
+
|
|
823
|
+
if z == 0:
|
|
824
|
+
return Integer(1)
|
|
825
|
+
if p == q == 0:
|
|
826
|
+
return exp(z)
|
|
827
|
+
if p == 1 and q == 0:
|
|
828
|
+
return (1 - z) ** (-a[0])
|
|
829
|
+
|
|
830
|
+
if p == 0 and q == 1:
|
|
831
|
+
# TODO: make this require only linear time
|
|
832
|
+
def _0f1(b, z):
|
|
833
|
+
F12 = cosh(2 * sqrt(z))
|
|
834
|
+
F32 = sinh(2 * sqrt(z)) / (2 * sqrt(z))
|
|
835
|
+
if 2 * b == 1:
|
|
836
|
+
return F12
|
|
837
|
+
if 2 * b == 3:
|
|
838
|
+
return F32
|
|
839
|
+
if 2 * b > 3:
|
|
840
|
+
return ((b - 2) * (b - 1) / z * (_0f1(b - 2, z) -
|
|
841
|
+
_0f1(b - 1, z)))
|
|
842
|
+
if 2 * b < 1:
|
|
843
|
+
return (_0f1(b + 1, z) + z / (b * (b + 1)) *
|
|
844
|
+
_0f1(b + 2, z))
|
|
845
|
+
raise ValueError
|
|
846
|
+
# Can evaluate 0F1 in terms of elementary functions when
|
|
847
|
+
# the parameter is a half-integer
|
|
848
|
+
if 2 * b[0] in ZZ and b[0] not in ZZ:
|
|
849
|
+
return _0f1(b[0], z)
|
|
850
|
+
|
|
851
|
+
# Confluent hypergeometric function
|
|
852
|
+
if p == 1 and q == 1:
|
|
853
|
+
aa, bb = a[0], b[0]
|
|
854
|
+
if aa * 2 == 1 and bb * 2 == 3:
|
|
855
|
+
t = sqrt(-z)
|
|
856
|
+
return sqrt(pi) / 2 * erf(t) / t
|
|
857
|
+
if a == 1 and b == 2:
|
|
858
|
+
return (exp(z) - 1) / z
|
|
859
|
+
n, m = aa, bb
|
|
860
|
+
if n in ZZ and m in ZZ and m > 0 and n > 0:
|
|
861
|
+
rf = rising_factorial
|
|
862
|
+
if m <= n:
|
|
863
|
+
return (exp(z) * sum(rf(m - n, k) * (-z) ** k /
|
|
864
|
+
factorial(k) / rf(m, k) for k in
|
|
865
|
+
range(n - m + 1)))
|
|
866
|
+
else:
|
|
867
|
+
T = sum(rf(n - m + 1, k) * z ** k /
|
|
868
|
+
(factorial(k) * rf(2 - m, k)) for k in
|
|
869
|
+
range(m - n))
|
|
870
|
+
U = sum(rf(1 - n, k) * (-z) ** k /
|
|
871
|
+
(factorial(k) * rf(2 - m, k)) for k in
|
|
872
|
+
range(n))
|
|
873
|
+
return (factorial(m - 2) * rf(1 - m, n) *
|
|
874
|
+
z ** (1 - m) / factorial(n - 1) *
|
|
875
|
+
(T - exp(z) * U))
|
|
876
|
+
|
|
877
|
+
if p == 2 and q == 1:
|
|
878
|
+
R12 = QQ((1, 2))
|
|
879
|
+
R32 = QQ((3, 2))
|
|
880
|
+
|
|
881
|
+
def _2f1(a, b, c, z):
|
|
882
|
+
"""
|
|
883
|
+
Evaluation of 2F1(a, b; c; z), assuming a, b, c positive
|
|
884
|
+
integers or half-integers
|
|
885
|
+
"""
|
|
886
|
+
if b == c:
|
|
887
|
+
return (1 - z) ** (-a)
|
|
888
|
+
if a == c:
|
|
889
|
+
return (1 - z) ** (-b)
|
|
890
|
+
if a == 0 or b == 0:
|
|
891
|
+
return Integer(1)
|
|
892
|
+
if a > b:
|
|
893
|
+
a, b = b, a
|
|
894
|
+
if b >= 2:
|
|
895
|
+
F1 = _2f1(a, b - 1, c, z)
|
|
896
|
+
F2 = _2f1(a, b - 2, c, z)
|
|
897
|
+
q = (b - 1) * (z - 1)
|
|
898
|
+
return (((c - 2 * b + 2 + (b - a - 1) * z) * F1 +
|
|
899
|
+
(b - c - 1) * F2) / q)
|
|
900
|
+
if c > 2:
|
|
901
|
+
# how to handle this case?
|
|
902
|
+
if a - c + 1 == 0 or b - c + 1 == 0:
|
|
903
|
+
raise NotImplementedError
|
|
904
|
+
F1 = _2f1(a, b, c - 1, z)
|
|
905
|
+
F2 = _2f1(a, b, c - 2, z)
|
|
906
|
+
r1 = (c - 1) * (2 - c - (a + b - 2 * c + 3) * z)
|
|
907
|
+
r2 = (c - 1) * (c - 2) * (1 - z)
|
|
908
|
+
q = (a - c + 1) * (b - c + 1) * z
|
|
909
|
+
return (r1 * F1 + r2 * F2) / q
|
|
910
|
+
|
|
911
|
+
if (a, b, c) == (R12, 1, 2):
|
|
912
|
+
return (2 - 2 * sqrt(1 - z)) / z
|
|
913
|
+
if (a, b, c) == (1, 1, 2):
|
|
914
|
+
return -log(1 - z) / z
|
|
915
|
+
if (a, b, c) == (1, R32, R12):
|
|
916
|
+
return (1 + z) / (1 - z) ** 2
|
|
917
|
+
if (a, b, c) == (1, R32, 2):
|
|
918
|
+
return 2 * (1 / sqrt(1 - z) - 1) / z
|
|
919
|
+
if (a, b, c) == (R32, 2, R12):
|
|
920
|
+
return (1 + 3 * z) / (1 - z) ** 3
|
|
921
|
+
if (a, b, c) == (R32, 2, 1):
|
|
922
|
+
return (2 + z) / (2 * (sqrt(1 - z) * (1 - z) ** 2))
|
|
923
|
+
if (a, b, c) == (2, 2, 1):
|
|
924
|
+
return (1 + z) / (1 - z) ** 3
|
|
925
|
+
raise NotImplementedError
|
|
926
|
+
aa, bb = a
|
|
927
|
+
cc, = b
|
|
928
|
+
if z == 1:
|
|
929
|
+
return (gamma(cc) * gamma(cc - aa - bb) / gamma(cc - aa) /
|
|
930
|
+
gamma(cc - bb))
|
|
931
|
+
if all((cf * 2) in ZZ and cf > 0 for cf in (aa, bb, cc)):
|
|
932
|
+
try:
|
|
933
|
+
return _2f1(aa, bb, cc, z)
|
|
934
|
+
except NotImplementedError:
|
|
935
|
+
pass
|
|
936
|
+
return hyp
|
|
937
|
+
return sum([coeff * _closed_form(pfq) for coeff, pfq in new._deflated()])
|
|
938
|
+
|
|
939
|
+
|
|
940
|
+
class Hypergeometric_M(BuiltinFunction):
|
|
941
|
+
r"""
|
|
942
|
+
The confluent hypergeometric function of the first kind,
|
|
943
|
+
`y = M(a,b,z)`, is defined to be the solution to Kummer's differential
|
|
944
|
+
equation
|
|
945
|
+
|
|
946
|
+
.. MATH::
|
|
947
|
+
|
|
948
|
+
zy'' + (b-z)y' - ay = 0.
|
|
949
|
+
|
|
950
|
+
This is not the same as Kummer's `U`-hypergeometric function, though it
|
|
951
|
+
satisfies the same DE that `M` does.
|
|
952
|
+
|
|
953
|
+
.. warning::
|
|
954
|
+
|
|
955
|
+
In the literature, both are called "Kummer confluent
|
|
956
|
+
hypergeometric" functions.
|
|
957
|
+
|
|
958
|
+
EXAMPLES::
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
sage: hypergeometric_M(1, 1, 1.) # needs mpmath
|
|
962
|
+
2.71828182845905
|
|
963
|
+
|
|
964
|
+
sage: # needs sage.symbolic
|
|
965
|
+
sage: hypergeometric_M(1, 1, 1)
|
|
966
|
+
hypergeometric_M(1, 1, 1)
|
|
967
|
+
sage: hypergeometric_M(1, 1, 1).n(70) # needs mpmath
|
|
968
|
+
2.7182818284590452354
|
|
969
|
+
sage: hypergeometric_M(1, 1, 1).simplify_hypergeometric()
|
|
970
|
+
e
|
|
971
|
+
sage: hypergeometric_M(1, 3/2, 1).simplify_hypergeometric()
|
|
972
|
+
1/2*sqrt(pi)*erf(1)*e
|
|
973
|
+
sage: hypergeometric_M(1, 1/2, x).simplify_hypergeometric()
|
|
974
|
+
(-I*sqrt(pi)*x*erf(I*sqrt(-x))*e^x + sqrt(-x))/sqrt(-x)
|
|
975
|
+
"""
|
|
976
|
+
def __init__(self):
|
|
977
|
+
r"""
|
|
978
|
+
TESTS::
|
|
979
|
+
|
|
980
|
+
sage: maxima(hypergeometric_M(1,1,x)) # needs sage.symbolic
|
|
981
|
+
kummer_m(1,1,_SAGE_VAR_x)
|
|
982
|
+
sage: latex(hypergeometric_M(1,1,x)) # needs sage.symbolic
|
|
983
|
+
M\left(1, 1, x\right)
|
|
984
|
+
"""
|
|
985
|
+
BuiltinFunction.__init__(self, 'hypergeometric_M', nargs=3,
|
|
986
|
+
conversions={'mathematica':
|
|
987
|
+
'Hypergeometric1F1',
|
|
988
|
+
'maple': 'KummerM',
|
|
989
|
+
'maxima': 'kummer_m',
|
|
990
|
+
'fricas': 'kummerM'},
|
|
991
|
+
latex_name='M')
|
|
992
|
+
|
|
993
|
+
def _eval_(self, a, b, z, **kwargs):
|
|
994
|
+
"""
|
|
995
|
+
TESTS::
|
|
996
|
+
|
|
997
|
+
sage: a, b = var('a,b') # needs sage.symbolic
|
|
998
|
+
sage: hypergeometric_M(a, b, 0) # needs sage.symbolic
|
|
999
|
+
1
|
|
1000
|
+
"""
|
|
1001
|
+
if not isinstance(z, Expression) and z == 0:
|
|
1002
|
+
return Integer(1)
|
|
1003
|
+
return
|
|
1004
|
+
|
|
1005
|
+
def _evalf_(self, a, b, z, parent=None, algorithm=None):
|
|
1006
|
+
"""
|
|
1007
|
+
TESTS::
|
|
1008
|
+
|
|
1009
|
+
sage: hypergeometric_M(1,1,1).n() # needs mpmath sage.symbolic
|
|
1010
|
+
2.71828182845905
|
|
1011
|
+
"""
|
|
1012
|
+
return _mpmath_utils_call(_mpmath_hyp1f1, a, b, z, parent=parent)
|
|
1013
|
+
|
|
1014
|
+
def _derivative_(self, a, b, z, diff_param):
|
|
1015
|
+
"""
|
|
1016
|
+
TESTS::
|
|
1017
|
+
|
|
1018
|
+
sage: diff(hypergeometric_M(1, 1, x), x, 3) # needs sage.symbolic
|
|
1019
|
+
hypergeometric_M(4, 4, x)
|
|
1020
|
+
sage: diff(hypergeometric_M(x, 1, 1), x, 3) # needs sage.symbolic
|
|
1021
|
+
Traceback (most recent call last):
|
|
1022
|
+
...
|
|
1023
|
+
NotImplementedError: derivative of hypergeometric function with respect to parameters
|
|
1024
|
+
"""
|
|
1025
|
+
if diff_param == 2:
|
|
1026
|
+
return (a / b) * hypergeometric_M(a + 1, b + 1, z)
|
|
1027
|
+
raise NotImplementedError('derivative of hypergeometric function '
|
|
1028
|
+
'with respect to parameters')
|
|
1029
|
+
|
|
1030
|
+
class EvaluationMethods:
|
|
1031
|
+
def generalized(self, a, b, z):
|
|
1032
|
+
"""
|
|
1033
|
+
Return as a generalized hypergeometric function.
|
|
1034
|
+
|
|
1035
|
+
EXAMPLES::
|
|
1036
|
+
|
|
1037
|
+
sage: var('a b z') # needs sage.symbolic
|
|
1038
|
+
(a, b, z)
|
|
1039
|
+
sage: hypergeometric_M(a, b, z).generalized() # needs sage.symbolic
|
|
1040
|
+
hypergeometric((a,), (b,), z)
|
|
1041
|
+
"""
|
|
1042
|
+
return hypergeometric([a], [b], z)
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
hypergeometric_M = Hypergeometric_M()
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
class Hypergeometric_U(BuiltinFunction):
|
|
1049
|
+
r"""
|
|
1050
|
+
The confluent hypergeometric function of the second kind,
|
|
1051
|
+
`y = U(a,b,z)`, is defined to be the solution to Kummer's differential
|
|
1052
|
+
equation
|
|
1053
|
+
|
|
1054
|
+
.. MATH::
|
|
1055
|
+
|
|
1056
|
+
zy'' + (b-z)y' - ay = 0.
|
|
1057
|
+
|
|
1058
|
+
This satisfies `U(a,b,z) \sim z^{-a}`, as
|
|
1059
|
+
`z\rightarrow \infty`, and is sometimes denoted
|
|
1060
|
+
`z^{-a}{}_2F_0(a,1+a-b;;-1/z)`. This is not the same as Kummer's
|
|
1061
|
+
`M`-hypergeometric function, denoted sometimes as
|
|
1062
|
+
`_1F_1(\alpha,\beta,z)`, though it satisfies the same DE that
|
|
1063
|
+
`U` does.
|
|
1064
|
+
|
|
1065
|
+
.. warning::
|
|
1066
|
+
|
|
1067
|
+
In the literature, both are called "Kummer confluent
|
|
1068
|
+
hypergeometric" functions.
|
|
1069
|
+
|
|
1070
|
+
EXAMPLES::
|
|
1071
|
+
|
|
1072
|
+
sage: # needs mpmath
|
|
1073
|
+
sage: hypergeometric_U(1, 1, 1)
|
|
1074
|
+
hypergeometric_U(1, 1, 1)
|
|
1075
|
+
sage: hypergeometric_U(1, 1, 1.)
|
|
1076
|
+
0.596347362323194
|
|
1077
|
+
|
|
1078
|
+
sage: # needs sage.symbolic
|
|
1079
|
+
sage: hypergeometric_U(1, 1, 1).n(70) # needs mpmath
|
|
1080
|
+
0.59634736232319407434
|
|
1081
|
+
sage: hypergeometric_U(10^4, 1/3, 1).n() # needs sage.libs.pari
|
|
1082
|
+
6.60377008885811e-35745
|
|
1083
|
+
sage: hypergeometric_U(1, 2, 2).simplify_hypergeometric()
|
|
1084
|
+
1/2
|
|
1085
|
+
|
|
1086
|
+
sage: hypergeometric_U(2 + I, 2, 1).n() # needs sage.symbolic
|
|
1087
|
+
0.183481989942099 - 0.458685959185190*I
|
|
1088
|
+
sage: hypergeometric_U(1, 3, x).simplify_hypergeometric() # needs sage.symbolic
|
|
1089
|
+
(x + 1)/x^2
|
|
1090
|
+
"""
|
|
1091
|
+
def __init__(self):
|
|
1092
|
+
r"""
|
|
1093
|
+
TESTS::
|
|
1094
|
+
|
|
1095
|
+
sage: maxima(hypergeometric_U(1, 1, x)) # needs sage.symbolic
|
|
1096
|
+
kummer_u(1,1,_SAGE_VAR_x)
|
|
1097
|
+
sage: latex(hypergeometric_U(1, 1, x)) # needs sage.symbolic
|
|
1098
|
+
U\left(1, 1, x\right)
|
|
1099
|
+
"""
|
|
1100
|
+
BuiltinFunction.__init__(self, 'hypergeometric_U', nargs=3,
|
|
1101
|
+
conversions={'mathematica':
|
|
1102
|
+
'HypergeometricU',
|
|
1103
|
+
'maple': 'KummerU',
|
|
1104
|
+
'maxima': 'kummer_u',
|
|
1105
|
+
'fricas': 'kummerU'},
|
|
1106
|
+
latex_name='U')
|
|
1107
|
+
|
|
1108
|
+
def _eval_(self, a, b, z, **kwargs):
|
|
1109
|
+
return
|
|
1110
|
+
|
|
1111
|
+
def _evalf_(self, a, b, z, parent=None, algorithm=None):
|
|
1112
|
+
"""
|
|
1113
|
+
TESTS::
|
|
1114
|
+
|
|
1115
|
+
sage: hypergeometric_U(1, 1, 1).n() # needs mpmath sage.symbolic
|
|
1116
|
+
0.596347362323194
|
|
1117
|
+
"""
|
|
1118
|
+
return _mpmath_utils_call(_mpmath_hyperu, a, b, z, parent=parent)
|
|
1119
|
+
|
|
1120
|
+
def _derivative_(self, a, b, z, diff_param):
|
|
1121
|
+
"""
|
|
1122
|
+
TESTS::
|
|
1123
|
+
|
|
1124
|
+
sage: diff(hypergeometric_U(1, 1, x), x, 3) # needs sage.symbolic
|
|
1125
|
+
-6*hypergeometric_U(4, 4, x)
|
|
1126
|
+
sage: diff(hypergeometric_U(x, 1, 1), x, 3) # needs sage.symbolic
|
|
1127
|
+
Traceback (most recent call last):
|
|
1128
|
+
...
|
|
1129
|
+
NotImplementedError: derivative of hypergeometric function with respect to parameters
|
|
1130
|
+
"""
|
|
1131
|
+
if diff_param == 2:
|
|
1132
|
+
return -a * hypergeometric_U(a + 1, b + 1, z)
|
|
1133
|
+
raise NotImplementedError('derivative of hypergeometric function '
|
|
1134
|
+
'with respect to parameters')
|
|
1135
|
+
|
|
1136
|
+
class EvaluationMethods:
|
|
1137
|
+
def generalized(self, a, b, z):
|
|
1138
|
+
"""
|
|
1139
|
+
Return in terms of the generalized hypergeometric function.
|
|
1140
|
+
|
|
1141
|
+
EXAMPLES::
|
|
1142
|
+
|
|
1143
|
+
sage: # needs sage.symbolic
|
|
1144
|
+
sage: var('a b z')
|
|
1145
|
+
(a, b, z)
|
|
1146
|
+
sage: hypergeometric_U(a, b, z).generalized()
|
|
1147
|
+
hypergeometric((a, a - b + 1), (), -1/z)/z^a
|
|
1148
|
+
sage: hypergeometric_U(1, 3, 1/2).generalized()
|
|
1149
|
+
2*hypergeometric((1, -1), (), -2)
|
|
1150
|
+
sage: hypergeometric_U(3, I, 2).generalized()
|
|
1151
|
+
1/8*hypergeometric((3, -I + 4), (), -1/2)
|
|
1152
|
+
"""
|
|
1153
|
+
return z ** (-a) * hypergeometric([a, a - b + 1], [], -z ** (-1))
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
hypergeometric_U = Hypergeometric_U()
|