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,1529 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-categories
|
|
2
|
+
r"""
|
|
3
|
+
Exponential integrals
|
|
4
|
+
|
|
5
|
+
AUTHORS:
|
|
6
|
+
|
|
7
|
+
- Benjamin Jones (2011-06-12)
|
|
8
|
+
|
|
9
|
+
This module provides easy access to many exponential integral
|
|
10
|
+
special functions. It utilizes Maxima's `special functions package`_ and
|
|
11
|
+
the `mpmath library`_.
|
|
12
|
+
|
|
13
|
+
REFERENCES:
|
|
14
|
+
|
|
15
|
+
- [AS1964]_ Abramowitz and Stegun: *Handbook of Mathematical Functions*
|
|
16
|
+
- :wikipedia:`Exponential_integral`
|
|
17
|
+
- Online Encyclopedia of Special Function: http://algo.inria.fr/esf/index.html
|
|
18
|
+
- NIST Digital Library of Mathematical Functions: https://dlmf.nist.gov/
|
|
19
|
+
- Maxima `special functions package`_
|
|
20
|
+
- `mpmath library`_
|
|
21
|
+
|
|
22
|
+
.. _`special functions package`: http://maxima.sourceforge.net/docs/manual/en/maxima_15.html
|
|
23
|
+
.. _`mpmath library`: https://github.com/fredrik-johansson/mpmath/
|
|
24
|
+
|
|
25
|
+
AUTHORS:
|
|
26
|
+
|
|
27
|
+
- Benjamin Jones
|
|
28
|
+
|
|
29
|
+
Implementations of the classes ``Function_exp_integral_*``.
|
|
30
|
+
|
|
31
|
+
- David Joyner and William Stein
|
|
32
|
+
|
|
33
|
+
Authors of the code which was moved from special.py and trans.py.
|
|
34
|
+
Implementation of :meth:`exp_int` (from sage/functions/special.py).
|
|
35
|
+
Implementation of :meth:`exponential_integral_1` (from
|
|
36
|
+
sage/functions/transcendental.py).
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
# ****************************************************************************
|
|
40
|
+
# Copyright (C) 2011 Benjamin Jones <benjaminfjones@gmail.com>
|
|
41
|
+
#
|
|
42
|
+
# This program is free software: you can redistribute it and/or modify
|
|
43
|
+
# it under the terms of the GNU General Public License as published by
|
|
44
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
45
|
+
# (at your option) any later version.
|
|
46
|
+
# https://www.gnu.org/licenses/
|
|
47
|
+
# ****************************************************************************
|
|
48
|
+
|
|
49
|
+
import math
|
|
50
|
+
|
|
51
|
+
from sage.misc.lazy_import import lazy_import
|
|
52
|
+
from sage.rings.infinity import Infinity
|
|
53
|
+
from sage.rings.integer_ring import ZZ
|
|
54
|
+
from sage.structure.element import Expression, parent
|
|
55
|
+
from sage.symbolic.function import BuiltinFunction
|
|
56
|
+
|
|
57
|
+
lazy_import('sage.functions.log', ['exp', 'log'])
|
|
58
|
+
lazy_import('sage.functions.trig', ['sin', 'cos'])
|
|
59
|
+
lazy_import('sage.functions.hyperbolic', ['sinh', 'cosh'])
|
|
60
|
+
|
|
61
|
+
lazy_import('sage.misc.latex', 'latex')
|
|
62
|
+
lazy_import('sage.rings.real_mpfr', 'RealField')
|
|
63
|
+
|
|
64
|
+
lazy_import('sage.symbolic.ring', 'SR')
|
|
65
|
+
|
|
66
|
+
lazy_import('sage.libs.mpmath.utils', 'call', as_='_mpmath_utils_call')
|
|
67
|
+
lazy_import('mpmath',
|
|
68
|
+
['chi', 'ci', 'e1', 'ei', 'expint', 'ei', 'li', 'shi', 'si'],
|
|
69
|
+
as_=['_mpmath_chi', '_mpmath_ci', '_mpmath_e1', '_mpmath_ei', '_mpmath_expint',
|
|
70
|
+
'_mpmath_ei', '_mpmath_li', '_mpmath_shi', '_mpmath_si'])
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class Function_exp_integral_e(BuiltinFunction):
|
|
74
|
+
r"""
|
|
75
|
+
The generalized complex exponential integral `E_n(z)` defined by
|
|
76
|
+
|
|
77
|
+
.. MATH::
|
|
78
|
+
|
|
79
|
+
E_n(z) = \int_1^{\infty} \frac{e^{-z t}}{t^n} \; dt
|
|
80
|
+
|
|
81
|
+
for complex numbers `n` and `z`, see [AS1964]_ 5.1.4.
|
|
82
|
+
|
|
83
|
+
The special case where `n = 1` is denoted in Sage by
|
|
84
|
+
``exp_integral_e1``.
|
|
85
|
+
|
|
86
|
+
EXAMPLES:
|
|
87
|
+
|
|
88
|
+
Numerical evaluation is handled using mpmath::
|
|
89
|
+
|
|
90
|
+
sage: N(exp_integral_e(1, 1)) # needs sage.symbolic
|
|
91
|
+
0.219383934395520
|
|
92
|
+
sage: exp_integral_e(1, RealField(100)(1)) # needs sage.symbolic
|
|
93
|
+
0.21938393439552027367716377546
|
|
94
|
+
|
|
95
|
+
We can compare this to PARI's evaluation of
|
|
96
|
+
:meth:`exponential_integral_1`::
|
|
97
|
+
|
|
98
|
+
sage: N(exponential_integral_1(1)) # needs sage.symbolic
|
|
99
|
+
0.219383934395520
|
|
100
|
+
|
|
101
|
+
We can verify one case of [AS1964]_ 5.1.45, i.e.
|
|
102
|
+
`E_n(z) = z^{n-1}\Gamma(1-n,z)`::
|
|
103
|
+
|
|
104
|
+
sage: N(exp_integral_e(2, 3+I)) # needs sage.symbolic
|
|
105
|
+
0.00354575823814662 - 0.00973200528288687*I
|
|
106
|
+
sage: N((3+I)*gamma(-1, 3+I)) # needs sage.symbolic
|
|
107
|
+
0.00354575823814662 - 0.00973200528288687*I
|
|
108
|
+
|
|
109
|
+
Maxima returns the following improper integral as a multiple of
|
|
110
|
+
``exp_integral_e(1,1)``::
|
|
111
|
+
|
|
112
|
+
sage: uu = integral(e^(-x)*log(x+1), x, 0, oo); uu # needs sage.symbolic
|
|
113
|
+
e*exp_integral_e(1, 1)
|
|
114
|
+
sage: uu.n(digits=30) # needs sage.symbolic
|
|
115
|
+
0.596347362323194074341078499369
|
|
116
|
+
|
|
117
|
+
Symbolic derivatives and integrals are handled by Sage and Maxima::
|
|
118
|
+
|
|
119
|
+
sage: # needs sage.symbolic
|
|
120
|
+
sage: x = var('x')
|
|
121
|
+
sage: f = exp_integral_e(2,x)
|
|
122
|
+
sage: f.diff(x)
|
|
123
|
+
-exp_integral_e(1, x)
|
|
124
|
+
sage: f.integrate(x)
|
|
125
|
+
-exp_integral_e(3, x)
|
|
126
|
+
sage: f = exp_integral_e(-1, x)
|
|
127
|
+
sage: f.integrate(x)
|
|
128
|
+
Ei(-x) - gamma(-1, x)
|
|
129
|
+
|
|
130
|
+
Some special values of ``exp_integral_e`` can be simplified.
|
|
131
|
+
[AS1964]_ 5.1.23::
|
|
132
|
+
|
|
133
|
+
sage: exp_integral_e(0, x) # needs sage.symbolic
|
|
134
|
+
e^(-x)/x
|
|
135
|
+
|
|
136
|
+
[AS1964]_ 5.1.24::
|
|
137
|
+
|
|
138
|
+
sage: # needs sage.symbolic
|
|
139
|
+
sage: exp_integral_e(6, 0)
|
|
140
|
+
1/5
|
|
141
|
+
sage: nn = var('nn')
|
|
142
|
+
sage: assume(nn > 1)
|
|
143
|
+
sage: f = exp_integral_e(nn, 0)
|
|
144
|
+
sage: f.simplify()
|
|
145
|
+
1/(nn - 1)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
ALGORITHM:
|
|
149
|
+
|
|
150
|
+
Numerical evaluation is handled using mpmath, but symbolics are handled
|
|
151
|
+
by Sage and Maxima.
|
|
152
|
+
"""
|
|
153
|
+
def __init__(self):
|
|
154
|
+
"""
|
|
155
|
+
See the docstring for :meth:`Function_exp_integral_e`.
|
|
156
|
+
|
|
157
|
+
EXAMPLES::
|
|
158
|
+
|
|
159
|
+
sage: exp_integral_e(1, 0) # needs sage.symbolic
|
|
160
|
+
exp_integral_e(1, 0)
|
|
161
|
+
sage: exp_integral_e(1, x)._sympy_() # needs sage.symbolic
|
|
162
|
+
expint(1, x)
|
|
163
|
+
"""
|
|
164
|
+
BuiltinFunction.__init__(self, "exp_integral_e", nargs=2,
|
|
165
|
+
conversions=dict(maxima='expintegral_e',
|
|
166
|
+
sympy='expint'))
|
|
167
|
+
|
|
168
|
+
def _eval_(self, n, z):
|
|
169
|
+
"""
|
|
170
|
+
EXAMPLES::
|
|
171
|
+
|
|
172
|
+
sage: exp_integral_e(1.0, x) # needs sage.symbolic
|
|
173
|
+
exp_integral_e(1.00000000000000, x)
|
|
174
|
+
sage: exp_integral_e(x, 1.0) # needs sage.symbolic
|
|
175
|
+
exp_integral_e(x, 1.00000000000000)
|
|
176
|
+
sage: exp_integral_e(3, 0) # needs mpmath
|
|
177
|
+
1/2
|
|
178
|
+
|
|
179
|
+
TESTS:
|
|
180
|
+
|
|
181
|
+
Check that Python ints work (:issue:`14766`)::
|
|
182
|
+
|
|
183
|
+
sage: exp_integral_e(int(3), 0) # needs mpmath
|
|
184
|
+
1/2
|
|
185
|
+
"""
|
|
186
|
+
z_zero = False
|
|
187
|
+
# special case: z == 0 and n > 1
|
|
188
|
+
if isinstance(z, Expression):
|
|
189
|
+
if z.is_trivial_zero():
|
|
190
|
+
z_zero = True # for later
|
|
191
|
+
if n > 1:
|
|
192
|
+
return 1/(n-1)
|
|
193
|
+
else:
|
|
194
|
+
if not z:
|
|
195
|
+
z_zero = True
|
|
196
|
+
if n > 1:
|
|
197
|
+
return 1/(n-1)
|
|
198
|
+
|
|
199
|
+
# special case: n == 0
|
|
200
|
+
if isinstance(n, Expression):
|
|
201
|
+
if n.is_trivial_zero():
|
|
202
|
+
if z_zero:
|
|
203
|
+
return None
|
|
204
|
+
else:
|
|
205
|
+
return exp(-z)/z
|
|
206
|
+
else:
|
|
207
|
+
if not n:
|
|
208
|
+
if z_zero:
|
|
209
|
+
return None
|
|
210
|
+
else:
|
|
211
|
+
return exp(-z)/z
|
|
212
|
+
|
|
213
|
+
return None # leaves the expression unevaluated
|
|
214
|
+
|
|
215
|
+
def _evalf_(self, n, z, parent=None, algorithm=None):
|
|
216
|
+
"""
|
|
217
|
+
EXAMPLES::
|
|
218
|
+
|
|
219
|
+
sage: exp_integral_e(1.0, 1.0) # needs mpmath
|
|
220
|
+
0.219383934395520
|
|
221
|
+
sage: N(exp_integral_e(1, 1+I)) # needs sage.symbolic
|
|
222
|
+
0.000281624451981418 - 0.179324535039359*I
|
|
223
|
+
sage: exp_integral_e(1, RealField(100)(1)) # needs sage.rings.real_mpfr
|
|
224
|
+
0.21938393439552027367716377546
|
|
225
|
+
"""
|
|
226
|
+
return _mpmath_utils_call(_mpmath_expint, n, z, parent=parent)
|
|
227
|
+
|
|
228
|
+
def _print_latex_(self, n, z):
|
|
229
|
+
r"""
|
|
230
|
+
Custom ``_print_latex_`` method.
|
|
231
|
+
|
|
232
|
+
EXAMPLES::
|
|
233
|
+
|
|
234
|
+
sage: latex(exp_integral_e(1, -x - 1)) # needs sage.symbolic
|
|
235
|
+
E_{1}\left(-x - 1\right)
|
|
236
|
+
"""
|
|
237
|
+
return r"E_{{{}}}\left({}\right)".format(latex(n), latex(z))
|
|
238
|
+
|
|
239
|
+
def _derivative_(self, n, z, diff_param=None):
|
|
240
|
+
"""
|
|
241
|
+
If `n` is an integer strictly larger than 0, then the derivative of
|
|
242
|
+
`E_n(z)` with respect to `z` is
|
|
243
|
+
`-E_{n-1}(z)`. See [AS1964]_ 5.1.26.
|
|
244
|
+
|
|
245
|
+
EXAMPLES::
|
|
246
|
+
|
|
247
|
+
sage: # needs sage.symbolic
|
|
248
|
+
sage: x = var('x')
|
|
249
|
+
sage: f = exp_integral_e(2, x)
|
|
250
|
+
sage: f.diff(x)
|
|
251
|
+
-exp_integral_e(1, x)
|
|
252
|
+
sage: f = exp_integral_e(2, sqrt(x))
|
|
253
|
+
sage: f.diff(x)
|
|
254
|
+
-1/2*exp_integral_e(1, sqrt(x))/sqrt(x)
|
|
255
|
+
"""
|
|
256
|
+
if n in ZZ and n > 0:
|
|
257
|
+
return -1*exp_integral_e(n-1, z)
|
|
258
|
+
raise NotImplementedError("The derivative of this function is only implemented for n = 1, 2, 3, ...")
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
exp_integral_e = Function_exp_integral_e()
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
class Function_exp_integral_e1(BuiltinFunction):
|
|
265
|
+
r"""
|
|
266
|
+
The generalized complex exponential integral `E_1(z)` defined by
|
|
267
|
+
|
|
268
|
+
.. MATH::
|
|
269
|
+
|
|
270
|
+
E_1(z) = \int_z^\infty \frac{e^{-t}}{t} \; dt
|
|
271
|
+
|
|
272
|
+
see [AS1964]_ 5.1.4.
|
|
273
|
+
|
|
274
|
+
EXAMPLES::
|
|
275
|
+
|
|
276
|
+
sage: exp_integral_e1(x) # needs sage.symbolic
|
|
277
|
+
exp_integral_e1(x)
|
|
278
|
+
sage: exp_integral_e1(1.0) # needs mpmath
|
|
279
|
+
0.219383934395520
|
|
280
|
+
|
|
281
|
+
Numerical evaluation is handled using mpmath::
|
|
282
|
+
|
|
283
|
+
sage: N(exp_integral_e1(1)) # needs sage.symbolic
|
|
284
|
+
0.219383934395520
|
|
285
|
+
sage: exp_integral_e1(RealField(100)(1)) # needs sage.rings.real_mpfr
|
|
286
|
+
0.21938393439552027367716377546
|
|
287
|
+
|
|
288
|
+
We can compare this to PARI's evaluation of
|
|
289
|
+
:meth:`exponential_integral_1`::
|
|
290
|
+
|
|
291
|
+
sage: N(exp_integral_e1(2.0)) # needs mpmath
|
|
292
|
+
0.0489005107080611
|
|
293
|
+
sage: N(exponential_integral_1(2.0)) # needs sage.libs.pari sage.rings.real_mpfr
|
|
294
|
+
0.0489005107080611
|
|
295
|
+
|
|
296
|
+
Symbolic derivatives and integrals are handled by Sage and Maxima::
|
|
297
|
+
|
|
298
|
+
sage: # needs sage.symbolic
|
|
299
|
+
sage: x = var('x')
|
|
300
|
+
sage: f = exp_integral_e1(x)
|
|
301
|
+
sage: f.diff(x)
|
|
302
|
+
-e^(-x)/x
|
|
303
|
+
sage: f.integrate(x)
|
|
304
|
+
-exp_integral_e(2, x)
|
|
305
|
+
|
|
306
|
+
ALGORITHM:
|
|
307
|
+
|
|
308
|
+
Numerical evaluation is handled using mpmath, but symbolics are handled
|
|
309
|
+
by Sage and Maxima.
|
|
310
|
+
"""
|
|
311
|
+
def __init__(self):
|
|
312
|
+
"""
|
|
313
|
+
See the docstring for :class:`Function_exp_integral_e1`.
|
|
314
|
+
|
|
315
|
+
EXAMPLES::
|
|
316
|
+
|
|
317
|
+
sage: exp_integral_e1(1) # needs sage.symbolic
|
|
318
|
+
exp_integral_e1(1)
|
|
319
|
+
sage: exp_integral_e1(x)._sympy_() # needs sympy sage.symbolic
|
|
320
|
+
expint(1, x)
|
|
321
|
+
"""
|
|
322
|
+
BuiltinFunction.__init__(self, "exp_integral_e1", nargs=1,
|
|
323
|
+
conversions=dict(maxima='expintegral_e1',
|
|
324
|
+
sympy='E1'))
|
|
325
|
+
|
|
326
|
+
def _evalf_(self, z, parent=None, algorithm=None):
|
|
327
|
+
"""
|
|
328
|
+
EXAMPLES::
|
|
329
|
+
|
|
330
|
+
sage: N(exp_integral_e1(1+I)) # needs sage.symbolic
|
|
331
|
+
0.000281624451981418 - 0.179324535039359*I
|
|
332
|
+
sage: exp_integral_e1(RealField(200)(0.5)) # needs sage.rings.real_mpfr
|
|
333
|
+
0.55977359477616081174679593931508523522684689031635351524829
|
|
334
|
+
"""
|
|
335
|
+
return _mpmath_utils_call(_mpmath_e1, z, parent=parent)
|
|
336
|
+
|
|
337
|
+
def _print_latex_(self, z):
|
|
338
|
+
r"""
|
|
339
|
+
Custom ``_print_latex_`` method.
|
|
340
|
+
|
|
341
|
+
EXAMPLES::
|
|
342
|
+
|
|
343
|
+
sage: latex(exp_integral_e1(2)) # needs sage.symbolic
|
|
344
|
+
E_{1}\left(2\right)
|
|
345
|
+
"""
|
|
346
|
+
return r"E_{{1}}\left({}\right)".format(latex(z))
|
|
347
|
+
|
|
348
|
+
def _derivative_(self, z, diff_param=None):
|
|
349
|
+
"""
|
|
350
|
+
The derivative of `E_1(z)` is `-e^{-z}/z`.
|
|
351
|
+
|
|
352
|
+
See [AS1964]_ 5.1.26.
|
|
353
|
+
|
|
354
|
+
EXAMPLES::
|
|
355
|
+
|
|
356
|
+
sage: # needs sage.symbolic
|
|
357
|
+
sage: x = var('x')
|
|
358
|
+
sage: f = exp_integral_e1(x)
|
|
359
|
+
sage: f.diff(x)
|
|
360
|
+
-e^(-x)/x
|
|
361
|
+
sage: f = exp_integral_e1(x^2)
|
|
362
|
+
sage: f.diff(x)
|
|
363
|
+
-2*e^(-x^2)/x
|
|
364
|
+
"""
|
|
365
|
+
return -exp(-z)/z
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
exp_integral_e1 = Function_exp_integral_e1()
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
class Function_log_integral(BuiltinFunction):
|
|
372
|
+
r"""
|
|
373
|
+
The logarithmic integral `\operatorname{li}(z)` defined by
|
|
374
|
+
|
|
375
|
+
.. MATH::
|
|
376
|
+
|
|
377
|
+
\operatorname{li}(x) = \int_0^z \frac{dt}{\ln(t)} = \operatorname{Ei}(\ln(x))
|
|
378
|
+
|
|
379
|
+
for x > 1 and by analytic continuation for complex arguments z (see [AS1964]_ 5.1.3).
|
|
380
|
+
|
|
381
|
+
EXAMPLES:
|
|
382
|
+
|
|
383
|
+
Numerical evaluation for real and complex arguments is handled using mpmath::
|
|
384
|
+
|
|
385
|
+
sage: N(log_integral(3)) # needs sage.symbolic
|
|
386
|
+
2.16358859466719
|
|
387
|
+
sage: N(log_integral(3), digits=30) # needs sage.symbolic
|
|
388
|
+
2.16358859466719197287692236735
|
|
389
|
+
sage: log_integral(ComplexField(100)(3+I)) # needs sage.symbolic
|
|
390
|
+
2.2879892769816826157078450911 + 0.87232935488528370139883806779*I
|
|
391
|
+
sage: log_integral(0) # needs mpmath
|
|
392
|
+
0
|
|
393
|
+
|
|
394
|
+
Symbolic derivatives and integrals are handled by Sage and Maxima::
|
|
395
|
+
|
|
396
|
+
sage: # needs sage.symbolic
|
|
397
|
+
sage: x = var('x')
|
|
398
|
+
sage: f = log_integral(x)
|
|
399
|
+
sage: f.diff(x)
|
|
400
|
+
1/log(x)
|
|
401
|
+
sage: f.integrate(x)
|
|
402
|
+
x*log_integral(x) - Ei(2*log(x))
|
|
403
|
+
|
|
404
|
+
Here is a test from the mpmath documentation. There are
|
|
405
|
+
1,925,320,391,606,803,968,923 many prime numbers less than 1e23. The
|
|
406
|
+
value of ``log_integral(1e23)`` is very close to this::
|
|
407
|
+
|
|
408
|
+
sage: log_integral(1e23) # needs mpmath
|
|
409
|
+
1.92532039161405e21
|
|
410
|
+
|
|
411
|
+
ALGORITHM:
|
|
412
|
+
|
|
413
|
+
Numerical evaluation is handled using mpmath, but symbolics are handled
|
|
414
|
+
by Sage and Maxima.
|
|
415
|
+
|
|
416
|
+
REFERENCES:
|
|
417
|
+
|
|
418
|
+
- :wikipedia:`Logarithmic_integral_function`
|
|
419
|
+
- mpmath documentation: `logarithmic-integral`_
|
|
420
|
+
|
|
421
|
+
.. _`logarithmic-integral`: http://mpmath.org/doc/current/functions/expintegrals.html#logarithmic-integral
|
|
422
|
+
"""
|
|
423
|
+
def __init__(self):
|
|
424
|
+
r"""
|
|
425
|
+
See the docstring for ``Function_log_integral``.
|
|
426
|
+
|
|
427
|
+
EXAMPLES::
|
|
428
|
+
|
|
429
|
+
sage: log_integral(3) # needs sage.symbolic
|
|
430
|
+
log_integral(3)
|
|
431
|
+
sage: log_integral(x)._sympy_() # needs sympy sage.symbolic
|
|
432
|
+
li(x)
|
|
433
|
+
sage: log_integral(x)._fricas_init_() # needs sage.symbolic
|
|
434
|
+
'li(x)'
|
|
435
|
+
|
|
436
|
+
TESTS:
|
|
437
|
+
|
|
438
|
+
Verify that :issue:`28917` is fixed::
|
|
439
|
+
|
|
440
|
+
sage: latex(log_integral(x)) # needs sage.symbolic
|
|
441
|
+
\operatorname{log\_integral}\left(x\right)
|
|
442
|
+
"""
|
|
443
|
+
BuiltinFunction.__init__(self, "log_integral", nargs=1,
|
|
444
|
+
latex_name=r'\operatorname{log\_integral}',
|
|
445
|
+
conversions=dict(maxima='expintegral_li',
|
|
446
|
+
sympy='li',
|
|
447
|
+
fricas='li'))
|
|
448
|
+
|
|
449
|
+
def _eval_(self, z):
|
|
450
|
+
"""
|
|
451
|
+
EXAMPLES::
|
|
452
|
+
|
|
453
|
+
sage: z = var('z') # needs sage.symbolic
|
|
454
|
+
sage: log_integral(z) # needs sage.symbolic
|
|
455
|
+
log_integral(z)
|
|
456
|
+
sage: log_integral(3.0) # needs mpmath
|
|
457
|
+
2.16358859466719
|
|
458
|
+
sage: log_integral(0) # needs mpmath
|
|
459
|
+
0
|
|
460
|
+
"""
|
|
461
|
+
# Special case z = 0
|
|
462
|
+
if isinstance(z, Expression):
|
|
463
|
+
if z.is_trivial_zero():
|
|
464
|
+
return z
|
|
465
|
+
elif not z:
|
|
466
|
+
return z
|
|
467
|
+
|
|
468
|
+
def _evalf_(self, z, parent=None, algorithm=None):
|
|
469
|
+
"""
|
|
470
|
+
EXAMPLES::
|
|
471
|
+
|
|
472
|
+
sage: N(log_integral(1e6)) # needs mpmath
|
|
473
|
+
78627.5491594622
|
|
474
|
+
sage: log_integral(RealField(200)(1e6)) # needs sage.rings.real_mpfr
|
|
475
|
+
78627.549159462181919862910747947261161321874382421767074759
|
|
476
|
+
"""
|
|
477
|
+
return _mpmath_utils_call(_mpmath_li, z, parent=parent)
|
|
478
|
+
|
|
479
|
+
def _derivative_(self, z, diff_param=None):
|
|
480
|
+
r"""
|
|
481
|
+
The derivative of `\operatorname{li}(z) is `1/log(z)`.
|
|
482
|
+
|
|
483
|
+
EXAMPLES::
|
|
484
|
+
|
|
485
|
+
sage: # needs sage.symbolic
|
|
486
|
+
sage: x = var('x')
|
|
487
|
+
sage: f = log_integral(x)
|
|
488
|
+
sage: f.diff(x)
|
|
489
|
+
1/log(x)
|
|
490
|
+
sage: f = log_integral(x^2)
|
|
491
|
+
sage: f.diff(x)
|
|
492
|
+
2*x/log(x^2)
|
|
493
|
+
"""
|
|
494
|
+
return 1/log(z)
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
li = log_integral = Function_log_integral()
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
class Function_log_integral_offset(BuiltinFunction):
|
|
501
|
+
r"""
|
|
502
|
+
The offset logarithmic integral, or Eulerian logarithmic integral,
|
|
503
|
+
`\operatorname{Li}(x)` is defined by
|
|
504
|
+
|
|
505
|
+
.. MATH::
|
|
506
|
+
|
|
507
|
+
\operatorname{Li}(x) = \int_2^x \frac{dt}{\ln(t)} =
|
|
508
|
+
\operatorname{li}(x)-\operatorname{li}(2)
|
|
509
|
+
|
|
510
|
+
for `x \ge 2`.
|
|
511
|
+
|
|
512
|
+
The offset logarithmic integral should also not be confused with the
|
|
513
|
+
polylogarithm (also denoted by `\operatorname{Li}(x)` ), which is
|
|
514
|
+
implemented as :class:`sage.functions.log.Function_polylog`.
|
|
515
|
+
|
|
516
|
+
`\operatorname{Li}(x)` is identical to `\operatorname{li}(x)` except that
|
|
517
|
+
the lower limit of integration is `2` rather than `0` to avoid the
|
|
518
|
+
singularity at `x = 1` of
|
|
519
|
+
|
|
520
|
+
.. MATH::
|
|
521
|
+
|
|
522
|
+
\frac{1}{\ln(t)}
|
|
523
|
+
|
|
524
|
+
See :class:`Function_log_integral` for details of `\operatorname{li}(x)`.
|
|
525
|
+
Thus `\operatorname{Li}(x)` can also be represented by
|
|
526
|
+
|
|
527
|
+
.. MATH::
|
|
528
|
+
|
|
529
|
+
\operatorname{Li}(x) = \operatorname{li}(x)-\operatorname{li}(2)
|
|
530
|
+
|
|
531
|
+
So we have::
|
|
532
|
+
|
|
533
|
+
sage: li(4.5) - li(2.0) - Li(4.5) # needs mpmath
|
|
534
|
+
0.000000000000000
|
|
535
|
+
|
|
536
|
+
`\operatorname{Li}(x)` is extended to complex arguments `z`
|
|
537
|
+
by analytic continuation (see [AS1964]_ 5.1.3)::
|
|
538
|
+
|
|
539
|
+
sage: Li(6.6 + 5.4*I) # needs sage.symbolic
|
|
540
|
+
3.97032201503632 + 2.62311237593572*I
|
|
541
|
+
|
|
542
|
+
The function `\operatorname{Li}` is an approximation for the number of
|
|
543
|
+
primes up to `x`. In fact, the famous Riemann Hypothesis is
|
|
544
|
+
|
|
545
|
+
.. MATH::
|
|
546
|
+
|
|
547
|
+
|\pi(x) - \operatorname{Li}(x)| \leq \sqrt{x} \log(x).
|
|
548
|
+
|
|
549
|
+
For "small" `x`, `\operatorname{Li}(x)` is always slightly bigger
|
|
550
|
+
than `\pi(x)`. However it is a theorem that there are very
|
|
551
|
+
large values of `x` (e.g., around `10^{316}`), such that
|
|
552
|
+
`\exists x: \pi(x) > \operatorname{Li}(x)`. See "A new bound for the
|
|
553
|
+
smallest x with `\pi(x) > \operatorname{li}(x)`",
|
|
554
|
+
Bays and Hudson, Mathematics of Computation, 69 (2000) 1285-1296.
|
|
555
|
+
|
|
556
|
+
.. NOTE::
|
|
557
|
+
|
|
558
|
+
Definite integration returns a part symbolic and part
|
|
559
|
+
numerical result. This is because when Li(x) is evaluated it is
|
|
560
|
+
passed as li(x)-li(2).
|
|
561
|
+
|
|
562
|
+
EXAMPLES:
|
|
563
|
+
|
|
564
|
+
Numerical evaluation for real and complex arguments is handled using mpmath::
|
|
565
|
+
|
|
566
|
+
sage: # needs sage.symbolic
|
|
567
|
+
sage: N(log_integral_offset(3))
|
|
568
|
+
1.11842481454970
|
|
569
|
+
sage: N(log_integral_offset(3), digits=30)
|
|
570
|
+
1.11842481454969918803233347815
|
|
571
|
+
sage: log_integral_offset(ComplexField(100)(3+I))
|
|
572
|
+
1.2428254968641898308632562019 + 0.87232935488528370139883806779*I
|
|
573
|
+
sage: log_integral_offset(2)
|
|
574
|
+
0
|
|
575
|
+
sage: for n in range(1,7): # needs primecountpy
|
|
576
|
+
....: print('%-10s%-10s%-20s'%(10^n, prime_pi(10^n), N(Li(10^n))))
|
|
577
|
+
10 4 5.12043572466980
|
|
578
|
+
100 25 29.0809778039621
|
|
579
|
+
1000 168 176.564494210035
|
|
580
|
+
10000 1229 1245.09205211927
|
|
581
|
+
100000 9592 9628.76383727068
|
|
582
|
+
1000000 78498 78626.5039956821
|
|
583
|
+
|
|
584
|
+
Here is a test from the mpmath documentation.
|
|
585
|
+
There are 1,925,320,391,606,803,968,923 prime numbers less than 1e23.
|
|
586
|
+
The value of ``log_integral_offset(1e23)`` is very close to this::
|
|
587
|
+
|
|
588
|
+
sage: log_integral_offset(1e23) # needs mpmath
|
|
589
|
+
1.92532039161405e21
|
|
590
|
+
|
|
591
|
+
Symbolic derivatives are handled by Sage and integration by Maxima::
|
|
592
|
+
|
|
593
|
+
sage: # needs sage.symbolic
|
|
594
|
+
sage: x = var('x')
|
|
595
|
+
sage: f = log_integral_offset(x)
|
|
596
|
+
sage: f.diff(x)
|
|
597
|
+
1/log(x)
|
|
598
|
+
sage: f.integrate(x)
|
|
599
|
+
-x*log_integral(2) + x*log_integral(x) - Ei(2*log(x))
|
|
600
|
+
sage: Li(x).integrate(x, 2.0, 4.5).n(digits=10)
|
|
601
|
+
3.186411697
|
|
602
|
+
sage: N(f.integrate(x, 2.0, 3.0)) # abs tol 1e-15
|
|
603
|
+
0.601621785860587
|
|
604
|
+
|
|
605
|
+
ALGORITHM:
|
|
606
|
+
|
|
607
|
+
Numerical evaluation is handled using mpmath, but symbolics are handled
|
|
608
|
+
by Sage and Maxima.
|
|
609
|
+
|
|
610
|
+
REFERENCES:
|
|
611
|
+
|
|
612
|
+
- :wikipedia:`Logarithmic_integral_function`
|
|
613
|
+
- mpmath documentation: `logarithmic-integral`_
|
|
614
|
+
|
|
615
|
+
.. _`logarithmic-integral`: http://mpmath.org/doc/current/functions/expintegrals.html#logarithmic-integral
|
|
616
|
+
"""
|
|
617
|
+
|
|
618
|
+
def __init__(self):
|
|
619
|
+
r"""
|
|
620
|
+
See the docstring for ``Function_log_integral_offset``.
|
|
621
|
+
|
|
622
|
+
EXAMPLES::
|
|
623
|
+
|
|
624
|
+
sage: log_integral_offset(3) # needs sage.symbolic
|
|
625
|
+
log_integral(3) - log_integral(2)
|
|
626
|
+
sage: log_integral_offset(x, hold=True)._sympy_() # needs sympy sage.symbolic
|
|
627
|
+
Li(x)
|
|
628
|
+
|
|
629
|
+
TESTS:
|
|
630
|
+
|
|
631
|
+
Verify that the problem described in :issue:`28917` no longer appears here::
|
|
632
|
+
|
|
633
|
+
sage: latex(log_integral_offset)
|
|
634
|
+
\operatorname{log\_integral\_offset}
|
|
635
|
+
"""
|
|
636
|
+
BuiltinFunction.__init__(self, "log_integral_offset", nargs=1,
|
|
637
|
+
latex_name=r'\operatorname{log\_integral\_offset}',
|
|
638
|
+
conversions=dict(sympy='Li'))
|
|
639
|
+
|
|
640
|
+
def _eval_(self, z):
|
|
641
|
+
"""
|
|
642
|
+
EXAMPLES::
|
|
643
|
+
|
|
644
|
+
sage: z = var('z') # needs sage.symbolic
|
|
645
|
+
sage: log_integral_offset(z) # needs sage.symbolic
|
|
646
|
+
-log_integral(2) + log_integral(z)
|
|
647
|
+
sage: log_integral_offset(3.0) # needs mpmath
|
|
648
|
+
1.11842481454970
|
|
649
|
+
sage: log_integral_offset(2) # needs mpmath
|
|
650
|
+
0
|
|
651
|
+
"""
|
|
652
|
+
if z == 2:
|
|
653
|
+
return SR(0)
|
|
654
|
+
return li(z)-li(2)
|
|
655
|
+
# If we return:(li(z)-li(2)) we get correct symbolic integration.
|
|
656
|
+
# But on definite integration it returns x.xxxx-li(2).
|
|
657
|
+
|
|
658
|
+
def _evalf_(self, z, parent=None, algorithm=None):
|
|
659
|
+
"""
|
|
660
|
+
EXAMPLES::
|
|
661
|
+
|
|
662
|
+
sage: N(log_integral_offset(1e6)) # needs mpmath
|
|
663
|
+
78626.5039956821
|
|
664
|
+
sage: log_integral_offset(RealField(200)(1e6)) # needs sage.rings.real_mpfr
|
|
665
|
+
78626.503995682064427078066159058066548185351766843615873183
|
|
666
|
+
sage: li(4.5) - li(2.0) - Li(4.5) # needs mpmath
|
|
667
|
+
0.000000000000000
|
|
668
|
+
"""
|
|
669
|
+
return _mpmath_utils_call(_mpmath_li, z, offset=True, parent=parent)
|
|
670
|
+
|
|
671
|
+
def _derivative_(self, z, diff_param=None):
|
|
672
|
+
r"""
|
|
673
|
+
The derivative of `\operatorname{Li}(z) is `1/log(z)`.
|
|
674
|
+
|
|
675
|
+
EXAMPLES::
|
|
676
|
+
|
|
677
|
+
sage: # needs sage.symbolic
|
|
678
|
+
sage: x = var('x')
|
|
679
|
+
sage: f = log_integral_offset(x)
|
|
680
|
+
sage: f.diff(x)
|
|
681
|
+
1/log(x)
|
|
682
|
+
sage: f = log_integral_offset(x^2)
|
|
683
|
+
sage: f.diff(x)
|
|
684
|
+
2*x/log(x^2)
|
|
685
|
+
"""
|
|
686
|
+
return 1/log(z)
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
Li = log_integral_offset = Function_log_integral_offset()
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
class Function_sin_integral(BuiltinFunction):
|
|
693
|
+
r"""
|
|
694
|
+
The trigonometric integral `\operatorname{Si}(z)` defined by
|
|
695
|
+
|
|
696
|
+
.. MATH::
|
|
697
|
+
|
|
698
|
+
\operatorname{Si}(z) = \int_0^z \frac{\sin(t)}{t} \; dt,
|
|
699
|
+
|
|
700
|
+
see [AS1964]_ 5.2.1.
|
|
701
|
+
|
|
702
|
+
EXAMPLES:
|
|
703
|
+
|
|
704
|
+
Numerical evaluation for real and complex arguments is handled using mpmath::
|
|
705
|
+
|
|
706
|
+
sage: sin_integral(0) # needs mpmath
|
|
707
|
+
0
|
|
708
|
+
sage: sin_integral(0.0) # needs mpmath
|
|
709
|
+
0.000000000000000
|
|
710
|
+
sage: sin_integral(3.0) # needs mpmath
|
|
711
|
+
1.84865252799947
|
|
712
|
+
sage: N(sin_integral(3), digits=30) # needs sage.symbolic
|
|
713
|
+
1.84865252799946825639773025111
|
|
714
|
+
sage: sin_integral(ComplexField(100)(3+I)) # needs sage.symbolic
|
|
715
|
+
2.0277151656451253616038525998 + 0.015210926166954211913653130271*I
|
|
716
|
+
|
|
717
|
+
The alias ``Si`` can be used instead of ``sin_integral``::
|
|
718
|
+
|
|
719
|
+
sage: Si(3.0) # needs mpmath
|
|
720
|
+
1.84865252799947
|
|
721
|
+
|
|
722
|
+
The limit of `\operatorname{Si}(z)` as `z \to \infty` is `\pi/2`::
|
|
723
|
+
|
|
724
|
+
sage: N(sin_integral(1e23)) # needs mpmath
|
|
725
|
+
1.57079632679490
|
|
726
|
+
sage: N(pi/2) # needs sage.symbolic
|
|
727
|
+
1.57079632679490
|
|
728
|
+
|
|
729
|
+
At 200 bits of precision `\operatorname{Si}(10^{23})` agrees with `\pi/2` up to
|
|
730
|
+
`10^{-24}`::
|
|
731
|
+
|
|
732
|
+
sage: sin_integral(RealField(200)(1e23)) # needs sage.rings.real_mpfr
|
|
733
|
+
1.5707963267948966192313288218697837425815368604836679189519
|
|
734
|
+
sage: N(pi/2, prec=200) # needs sage.symbolic
|
|
735
|
+
1.5707963267948966192313216916397514420985846996875529104875
|
|
736
|
+
|
|
737
|
+
The exponential sine integral is analytic everywhere::
|
|
738
|
+
|
|
739
|
+
sage: sin_integral(-1.0) # needs mpmath
|
|
740
|
+
-0.946083070367183
|
|
741
|
+
sage: sin_integral(-2.0) # needs mpmath
|
|
742
|
+
-1.60541297680269
|
|
743
|
+
sage: sin_integral(-1e23) # needs mpmath
|
|
744
|
+
-1.57079632679490
|
|
745
|
+
|
|
746
|
+
Symbolic derivatives and integrals are handled by Sage and Maxima::
|
|
747
|
+
|
|
748
|
+
sage: # needs sage.symbolic
|
|
749
|
+
sage: x = var('x')
|
|
750
|
+
sage: f = sin_integral(x)
|
|
751
|
+
sage: f.diff(x)
|
|
752
|
+
sin(x)/x
|
|
753
|
+
sage: f.integrate(x)
|
|
754
|
+
x*sin_integral(x) + cos(x)
|
|
755
|
+
sage: integrate(sin(x)/x, x)
|
|
756
|
+
-1/2*I*Ei(I*x) + 1/2*I*Ei(-I*x)
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
Compare values of the functions `\operatorname{Si}(x)` and
|
|
760
|
+
`f(x) = (1/2)i \cdot \operatorname{Ei}(-ix) - (1/2)i \cdot
|
|
761
|
+
\operatorname{Ei}(ix) - \pi/2`, which are both anti-derivatives of
|
|
762
|
+
`\sin(x)/x`, at some random positive real numbers::
|
|
763
|
+
|
|
764
|
+
sage: f(x) = 1/2*I*Ei(-I*x) - 1/2*I*Ei(I*x) - pi/2 # needs sage.symbolic
|
|
765
|
+
sage: g(x) = sin_integral(x) # needs sage.symbolic
|
|
766
|
+
sage: R = [abs(RDF.random_element()) for i in range(100)]
|
|
767
|
+
sage: all(abs(f(x) - g(x)) < 1e-10 for x in R) # needs sage.symbolic
|
|
768
|
+
True
|
|
769
|
+
|
|
770
|
+
The Nielsen spiral is the parametric plot of (Si(t), Ci(t))::
|
|
771
|
+
|
|
772
|
+
sage: # needs sage.symbolic
|
|
773
|
+
sage: x = var('x')
|
|
774
|
+
sage: f(x) = sin_integral(x)
|
|
775
|
+
sage: g(x) = cos_integral(x)
|
|
776
|
+
sage: P = parametric_plot([f, g], (x, 0.5 ,20)) # needs sage.plot
|
|
777
|
+
sage: show(P, frame=True, axes=False) # needs sage.plot
|
|
778
|
+
|
|
779
|
+
ALGORITHM:
|
|
780
|
+
|
|
781
|
+
Numerical evaluation is handled using mpmath, but symbolics are handled
|
|
782
|
+
by Sage and Maxima.
|
|
783
|
+
|
|
784
|
+
REFERENCES:
|
|
785
|
+
|
|
786
|
+
- :wikipedia:`Trigonometric_integral`
|
|
787
|
+
- mpmath documentation: `si`_
|
|
788
|
+
|
|
789
|
+
.. _`si`: http://mpmath.org/doc/current/functions/expintegrals.html#si
|
|
790
|
+
"""
|
|
791
|
+
def __init__(self):
|
|
792
|
+
"""
|
|
793
|
+
See the docstring for ``Function_sin_integral``.
|
|
794
|
+
|
|
795
|
+
EXAMPLES::
|
|
796
|
+
|
|
797
|
+
sage: # needs sage.symbolic
|
|
798
|
+
sage: sin_integral(1)
|
|
799
|
+
sin_integral(1)
|
|
800
|
+
sage: sin_integral(x)._sympy_() # needs sympy
|
|
801
|
+
Si(x)
|
|
802
|
+
sage: sin_integral(x)._fricas_init_()
|
|
803
|
+
'Si(x)'
|
|
804
|
+
sage: sin_integral(x)._giac_() # needs giac
|
|
805
|
+
Si(sageVARx)
|
|
806
|
+
"""
|
|
807
|
+
BuiltinFunction.__init__(self, "sin_integral", nargs=1,
|
|
808
|
+
latex_name=r'\operatorname{Si}',
|
|
809
|
+
conversions=dict(maxima='expintegral_si',
|
|
810
|
+
sympy='Si',
|
|
811
|
+
fricas='Si', giac='Si'))
|
|
812
|
+
|
|
813
|
+
def _eval_(self, z):
|
|
814
|
+
"""
|
|
815
|
+
EXAMPLES::
|
|
816
|
+
|
|
817
|
+
sage: z = var('z') # needs sage.symbolic
|
|
818
|
+
sage: sin_integral(z) # needs sage.symbolic
|
|
819
|
+
sin_integral(z)
|
|
820
|
+
sage: sin_integral(3.0) # needs mpmath
|
|
821
|
+
1.84865252799947
|
|
822
|
+
sage: sin_integral(0) # needs mpmath
|
|
823
|
+
0
|
|
824
|
+
"""
|
|
825
|
+
if isinstance(z, Expression):
|
|
826
|
+
if z.is_trivial_zero():
|
|
827
|
+
return z
|
|
828
|
+
elif not z:
|
|
829
|
+
return z
|
|
830
|
+
|
|
831
|
+
def _evalf_(self, z, parent=None, algorithm=None):
|
|
832
|
+
r"""
|
|
833
|
+
EXAMPLES:
|
|
834
|
+
|
|
835
|
+
The limit `\operatorname{Si}(z)` as `z \to \infty` is `\pi/2`::
|
|
836
|
+
|
|
837
|
+
sage: N(sin_integral(1e23) - pi/2) # needs sage.symbolic
|
|
838
|
+
0.000000000000000
|
|
839
|
+
|
|
840
|
+
At 200 bits of precision `\operatorname{Si}(10^{23})` agrees with `\pi/2` up to
|
|
841
|
+
`10^{-24}`::
|
|
842
|
+
|
|
843
|
+
sage: sin_integral(RealField(200)(1e23)) # needs sage.rings.real_mpfr
|
|
844
|
+
1.5707963267948966192313288218697837425815368604836679189519
|
|
845
|
+
sage: N(pi/2, prec=200) # needs sage.symbolic
|
|
846
|
+
1.5707963267948966192313216916397514420985846996875529104875
|
|
847
|
+
|
|
848
|
+
The exponential sine integral is analytic everywhere, even on the
|
|
849
|
+
negative real axis::
|
|
850
|
+
|
|
851
|
+
sage: sin_integral(-1.0) # needs mpmath
|
|
852
|
+
-0.946083070367183
|
|
853
|
+
sage: sin_integral(-2.0) # needs mpmath
|
|
854
|
+
-1.60541297680269
|
|
855
|
+
sage: sin_integral(-1e23) # needs mpmath
|
|
856
|
+
-1.57079632679490
|
|
857
|
+
"""
|
|
858
|
+
return _mpmath_utils_call(_mpmath_si, z, parent=parent)
|
|
859
|
+
|
|
860
|
+
def _derivative_(self, z, diff_param=None):
|
|
861
|
+
r"""
|
|
862
|
+
The derivative of `\operatorname{Si}(z)` is `\sin(z)/z` if `z`
|
|
863
|
+
is not zero. The derivative at `z = 0` is `1` (but this
|
|
864
|
+
exception is not currently implemented).
|
|
865
|
+
|
|
866
|
+
EXAMPLES::
|
|
867
|
+
|
|
868
|
+
sage: # needs sage.symbolic
|
|
869
|
+
sage: x = var('x')
|
|
870
|
+
sage: f = sin_integral(x)
|
|
871
|
+
sage: f.diff(x)
|
|
872
|
+
sin(x)/x
|
|
873
|
+
sage: f = sin_integral(x^2)
|
|
874
|
+
sage: f.diff(x)
|
|
875
|
+
2*sin(x^2)/x
|
|
876
|
+
"""
|
|
877
|
+
return sin(z)/z
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
Si = sin_integral = Function_sin_integral()
|
|
881
|
+
|
|
882
|
+
|
|
883
|
+
class Function_cos_integral(BuiltinFunction):
|
|
884
|
+
r"""
|
|
885
|
+
The trigonometric integral `\operatorname{Ci}(z)` defined by
|
|
886
|
+
|
|
887
|
+
.. MATH::
|
|
888
|
+
|
|
889
|
+
\operatorname{Ci}(z) = \gamma + \log(z) + \int_0^z \frac{\cos(t)-1}{t} \; dt,
|
|
890
|
+
|
|
891
|
+
where `\gamma` is the Euler gamma constant (``euler_gamma`` in Sage),
|
|
892
|
+
see [AS1964]_ 5.2.1.
|
|
893
|
+
|
|
894
|
+
EXAMPLES::
|
|
895
|
+
|
|
896
|
+
sage: z = var('z') # needs sage.symbolic
|
|
897
|
+
sage: cos_integral(z) # needs sage.symbolic
|
|
898
|
+
cos_integral(z)
|
|
899
|
+
sage: cos_integral(3.0) # needs mpmath
|
|
900
|
+
0.119629786008000
|
|
901
|
+
sage: cos_integral(0) # needs sage.symbolic
|
|
902
|
+
cos_integral(0)
|
|
903
|
+
sage: N(cos_integral(0)) # needs mpmath
|
|
904
|
+
-infinity
|
|
905
|
+
|
|
906
|
+
Numerical evaluation for real and complex arguments is handled using mpmath::
|
|
907
|
+
|
|
908
|
+
sage: cos_integral(3.0) # needs mpmath
|
|
909
|
+
0.119629786008000
|
|
910
|
+
|
|
911
|
+
The alias ``Ci`` can be used instead of ``cos_integral``::
|
|
912
|
+
|
|
913
|
+
sage: Ci(3.0) # needs mpmath
|
|
914
|
+
0.119629786008000
|
|
915
|
+
|
|
916
|
+
Compare ``cos_integral(3.0)`` to the definition of the value using
|
|
917
|
+
numerical integration::
|
|
918
|
+
|
|
919
|
+
sage: a = numerical_integral((cos(x)-1)/x, 0, 3)[0] # needs sage.symbolic
|
|
920
|
+
sage: abs(N(euler_gamma + log(3)) + a - N(cos_integral(3.0))) < 1e-14 # needs sage.symbolic
|
|
921
|
+
True
|
|
922
|
+
|
|
923
|
+
Arbitrary precision and complex arguments are handled::
|
|
924
|
+
|
|
925
|
+
sage: N(cos_integral(3), digits=30) # needs sage.symbolic
|
|
926
|
+
0.119629786008000327626472281177
|
|
927
|
+
sage: cos_integral(ComplexField(100)(3+I)) # needs sage.symbolic
|
|
928
|
+
0.078134230477495714401983633057 - 0.37814733904787920181190368789*I
|
|
929
|
+
|
|
930
|
+
The limit `\operatorname{Ci}(z)` as `z \to \infty` is zero::
|
|
931
|
+
|
|
932
|
+
sage: N(cos_integral(1e23)) # needs mpmath
|
|
933
|
+
-3.24053937643003e-24
|
|
934
|
+
|
|
935
|
+
Symbolic derivatives and integrals are handled by Sage and Maxima::
|
|
936
|
+
|
|
937
|
+
sage: # needs sage.symbolic
|
|
938
|
+
sage: x = var('x')
|
|
939
|
+
sage: f = cos_integral(x)
|
|
940
|
+
sage: f.diff(x)
|
|
941
|
+
cos(x)/x
|
|
942
|
+
sage: f.integrate(x)
|
|
943
|
+
x*cos_integral(x) - sin(x)
|
|
944
|
+
|
|
945
|
+
The Nielsen spiral is the parametric plot of (Si(t), Ci(t))::
|
|
946
|
+
|
|
947
|
+
sage: # needs sage.symbolic
|
|
948
|
+
sage: t = var('t')
|
|
949
|
+
sage: f(t) = sin_integral(t)
|
|
950
|
+
sage: g(t) = cos_integral(t)
|
|
951
|
+
sage: P = parametric_plot([f, g], (t, 0.5 ,20)) # needs sage.plot
|
|
952
|
+
sage: show(P, frame=True, axes=False) # needs sage.plot
|
|
953
|
+
|
|
954
|
+
ALGORITHM:
|
|
955
|
+
|
|
956
|
+
Numerical evaluation is handled using mpmath, but symbolics are handled
|
|
957
|
+
by Sage and Maxima.
|
|
958
|
+
|
|
959
|
+
REFERENCES:
|
|
960
|
+
|
|
961
|
+
- :wikipedia:`Trigonometric_integral`
|
|
962
|
+
- mpmath documentation: `ci`_
|
|
963
|
+
|
|
964
|
+
.. _`ci`: http://mpmath.org/doc/current/functions/expintegrals.html#ci
|
|
965
|
+
"""
|
|
966
|
+
def __init__(self):
|
|
967
|
+
"""
|
|
968
|
+
See the docstring for :class:`Function_cos_integral`.
|
|
969
|
+
|
|
970
|
+
EXAMPLES::
|
|
971
|
+
|
|
972
|
+
sage: # needs sage.symbolic
|
|
973
|
+
sage: cos_integral(1)
|
|
974
|
+
cos_integral(1)
|
|
975
|
+
sage: cos_integral(x)._sympy_() # needs sympy
|
|
976
|
+
Ci(x)
|
|
977
|
+
sage: cos_integral(x)._fricas_init_()
|
|
978
|
+
'Ci(x)'
|
|
979
|
+
sage: cos_integral(x)._giac_() # needs giac
|
|
980
|
+
Ci(sageVARx)
|
|
981
|
+
"""
|
|
982
|
+
BuiltinFunction.__init__(self, "cos_integral", nargs=1,
|
|
983
|
+
latex_name=r'\operatorname{Ci}',
|
|
984
|
+
conversions=dict(maxima='expintegral_ci',
|
|
985
|
+
sympy='Ci',
|
|
986
|
+
fricas='Ci', giac='Ci'))
|
|
987
|
+
|
|
988
|
+
def _evalf_(self, z, parent=None, algorithm=None):
|
|
989
|
+
"""
|
|
990
|
+
EXAMPLES::
|
|
991
|
+
|
|
992
|
+
sage: N(cos_integral(1e23)) < 1e-20 # needs mpmath
|
|
993
|
+
True
|
|
994
|
+
sage: N(cos_integral(10^-10), digits=30) # needs sage.symbolic
|
|
995
|
+
-22.4486352650389239795759024568
|
|
996
|
+
sage: cos_integral(ComplexField(100)(I)) # needs sage.symbolic
|
|
997
|
+
0.83786694098020824089467857943 + 1.5707963267948966192313216916*I
|
|
998
|
+
"""
|
|
999
|
+
return _mpmath_utils_call(_mpmath_ci, z, parent=parent)
|
|
1000
|
+
|
|
1001
|
+
def _derivative_(self, z, diff_param=None):
|
|
1002
|
+
r"""
|
|
1003
|
+
The derivative of `\operatorname{Ci}(z)` is `\cos(z)/z` if `z` is not zero.
|
|
1004
|
+
|
|
1005
|
+
EXAMPLES::
|
|
1006
|
+
|
|
1007
|
+
sage: # needs sage.symbolic
|
|
1008
|
+
sage: x = var('x')
|
|
1009
|
+
sage: f = cos_integral(x)
|
|
1010
|
+
sage: f.diff(x)
|
|
1011
|
+
cos(x)/x
|
|
1012
|
+
sage: f = cos_integral(x^2)
|
|
1013
|
+
sage: f.diff(x)
|
|
1014
|
+
2*cos(x^2)/x
|
|
1015
|
+
"""
|
|
1016
|
+
return cos(z)/z
|
|
1017
|
+
|
|
1018
|
+
|
|
1019
|
+
Ci = cos_integral = Function_cos_integral()
|
|
1020
|
+
|
|
1021
|
+
|
|
1022
|
+
class Function_sinh_integral(BuiltinFunction):
|
|
1023
|
+
r"""
|
|
1024
|
+
The trigonometric integral `\operatorname{Shi}(z)` defined by
|
|
1025
|
+
|
|
1026
|
+
.. MATH::
|
|
1027
|
+
|
|
1028
|
+
\operatorname{Shi}(z) = \int_0^z \frac{\sinh(t)}{t} \; dt,
|
|
1029
|
+
|
|
1030
|
+
see [AS1964]_ 5.2.3.
|
|
1031
|
+
|
|
1032
|
+
EXAMPLES:
|
|
1033
|
+
|
|
1034
|
+
Numerical evaluation for real and complex arguments is handled using mpmath::
|
|
1035
|
+
|
|
1036
|
+
sage: sinh_integral(3.0) # needs mpmath
|
|
1037
|
+
4.97344047585981
|
|
1038
|
+
sage: sinh_integral(1.0) # needs mpmath
|
|
1039
|
+
1.05725087537573
|
|
1040
|
+
sage: sinh_integral(-1.0) # needs mpmath
|
|
1041
|
+
-1.05725087537573
|
|
1042
|
+
|
|
1043
|
+
The alias ``Shi`` can be used instead of ``sinh_integral``::
|
|
1044
|
+
|
|
1045
|
+
sage: Shi(3.0) # needs mpmath
|
|
1046
|
+
4.97344047585981
|
|
1047
|
+
|
|
1048
|
+
Compare ``sinh_integral(3.0)`` to the definition of the value using
|
|
1049
|
+
numerical integration::
|
|
1050
|
+
|
|
1051
|
+
sage: a = numerical_integral(sinh(x)/x, 0, 3)[0] # needs sage.symbolic
|
|
1052
|
+
sage: abs(a - N(sinh_integral(3))) < 1e-14 # needs sage.symbolic
|
|
1053
|
+
True
|
|
1054
|
+
|
|
1055
|
+
Arbitrary precision and complex arguments are handled::
|
|
1056
|
+
|
|
1057
|
+
sage: N(sinh_integral(3), digits=30) # needs sage.symbolic
|
|
1058
|
+
4.97344047585980679771041838252
|
|
1059
|
+
sage: sinh_integral(ComplexField(100)(3+I)) # needs sage.symbolic
|
|
1060
|
+
3.9134623660329374406788354078 + 3.0427678212908839256360163759*I
|
|
1061
|
+
|
|
1062
|
+
The limit `\operatorname{Shi}(z)` as `z \to \infty` is `\infty`::
|
|
1063
|
+
|
|
1064
|
+
sage: N(sinh_integral(Infinity)) # needs mpmath
|
|
1065
|
+
+infinity
|
|
1066
|
+
|
|
1067
|
+
Symbolic derivatives and integrals are handled by Sage and Maxima::
|
|
1068
|
+
|
|
1069
|
+
sage: x = var('x') # needs sage.symbolic
|
|
1070
|
+
sage: f = sinh_integral(x) # needs sage.symbolic
|
|
1071
|
+
sage: f.diff(x) # needs sage.symbolic
|
|
1072
|
+
sinh(x)/x
|
|
1073
|
+
|
|
1074
|
+
sage: f.integrate(x) # needs sage.symbolic
|
|
1075
|
+
x*sinh_integral(x) - cosh(x)
|
|
1076
|
+
|
|
1077
|
+
Note that due to some problems with the way Maxima handles these
|
|
1078
|
+
expressions, definite integrals can sometimes give unexpected
|
|
1079
|
+
results (typically when using inexact endpoints) due to
|
|
1080
|
+
inconsistent branching::
|
|
1081
|
+
|
|
1082
|
+
sage: integrate(sinh_integral(x), x, 0, 1/2) # needs sage.symbolic
|
|
1083
|
+
-cosh(1/2) + 1/2*sinh_integral(1/2) + 1
|
|
1084
|
+
sage: integrate(sinh_integral(x), x, 0, 1/2).n() # correct # needs sage.symbolic
|
|
1085
|
+
0.125872409703453
|
|
1086
|
+
sage: integrate(sinh_integral(x), x, 0, 0.5).n() # fixed in maxima 5.29.1 # needs sage.symbolic
|
|
1087
|
+
0.125872409703453
|
|
1088
|
+
|
|
1089
|
+
ALGORITHM:
|
|
1090
|
+
|
|
1091
|
+
Numerical evaluation is handled using mpmath, but symbolics are handled
|
|
1092
|
+
by Sage and Maxima.
|
|
1093
|
+
|
|
1094
|
+
REFERENCES:
|
|
1095
|
+
|
|
1096
|
+
- :wikipedia:`Trigonometric_integral`
|
|
1097
|
+
- mpmath documentation: `shi`_
|
|
1098
|
+
|
|
1099
|
+
.. _`shi`: http://mpmath.org/doc/current/functions/expintegrals.html#shi
|
|
1100
|
+
"""
|
|
1101
|
+
def __init__(self):
|
|
1102
|
+
"""
|
|
1103
|
+
See the docstring for ``Function_sinh_integral``.
|
|
1104
|
+
|
|
1105
|
+
EXAMPLES::
|
|
1106
|
+
|
|
1107
|
+
sage: sinh_integral(1) # needs sage.symbolic
|
|
1108
|
+
sinh_integral(1)
|
|
1109
|
+
sage: sinh_integral(x)._sympy_() # needs sympy sage.symbolic
|
|
1110
|
+
Shi(x)
|
|
1111
|
+
"""
|
|
1112
|
+
BuiltinFunction.__init__(self, "sinh_integral", nargs=1,
|
|
1113
|
+
latex_name=r'\operatorname{Shi}',
|
|
1114
|
+
conversions=dict(maxima='expintegral_shi',
|
|
1115
|
+
sympy='Shi',
|
|
1116
|
+
fricas='Shi'))
|
|
1117
|
+
|
|
1118
|
+
def _eval_(self, z):
|
|
1119
|
+
"""
|
|
1120
|
+
EXAMPLES::
|
|
1121
|
+
|
|
1122
|
+
sage: z = var('z') # needs sage.symbolic
|
|
1123
|
+
sage: sinh_integral(z) # needs sage.symbolic
|
|
1124
|
+
sinh_integral(z)
|
|
1125
|
+
sage: sinh_integral(3.0) # needs mpmath
|
|
1126
|
+
4.97344047585981
|
|
1127
|
+
sage: sinh_integral(0) # needs mpmath
|
|
1128
|
+
0
|
|
1129
|
+
"""
|
|
1130
|
+
# special case: z = 0
|
|
1131
|
+
if isinstance(z, Expression):
|
|
1132
|
+
if z.is_trivial_zero():
|
|
1133
|
+
return z
|
|
1134
|
+
elif not z:
|
|
1135
|
+
return z
|
|
1136
|
+
|
|
1137
|
+
def _evalf_(self, z, parent=None, algorithm=None):
|
|
1138
|
+
"""
|
|
1139
|
+
EXAMPLES::
|
|
1140
|
+
|
|
1141
|
+
sage: N(sinh_integral(10^-10), digits=30) # needs sage.symbolic
|
|
1142
|
+
1.00000000000000000000055555556e-10
|
|
1143
|
+
sage: sinh_integral(ComplexField(100)(I)) # needs sage.symbolic
|
|
1144
|
+
0.94608307036718301494135331382*I
|
|
1145
|
+
"""
|
|
1146
|
+
return _mpmath_utils_call(_mpmath_shi, z, parent=parent)
|
|
1147
|
+
|
|
1148
|
+
def _derivative_(self, z, diff_param=None):
|
|
1149
|
+
r"""
|
|
1150
|
+
The derivative of `\operatorname{Shi}(z)` is `\sinh(z)/z`.
|
|
1151
|
+
|
|
1152
|
+
EXAMPLES::
|
|
1153
|
+
|
|
1154
|
+
sage: # needs sage.symbolic
|
|
1155
|
+
sage: x = var('x')
|
|
1156
|
+
sage: f = sinh_integral(x)
|
|
1157
|
+
sage: f.diff(x)
|
|
1158
|
+
sinh(x)/x
|
|
1159
|
+
sage: f = sinh_integral(ln(x))
|
|
1160
|
+
sage: f.diff(x)
|
|
1161
|
+
1/2*(x^2 - 1)/(x^2*log(x))
|
|
1162
|
+
"""
|
|
1163
|
+
return sinh(z)/z
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
Shi = sinh_integral = Function_sinh_integral()
|
|
1167
|
+
|
|
1168
|
+
|
|
1169
|
+
class Function_cosh_integral(BuiltinFunction):
|
|
1170
|
+
r"""
|
|
1171
|
+
The trigonometric integral `\operatorname{Chi}(z)` defined by
|
|
1172
|
+
|
|
1173
|
+
.. MATH::
|
|
1174
|
+
|
|
1175
|
+
\operatorname{Chi}(z) = \gamma + \log(z) + \int_0^z \frac{\cosh(t)-1}{t} \; dt,
|
|
1176
|
+
|
|
1177
|
+
see [AS1964]_ 5.2.4.
|
|
1178
|
+
|
|
1179
|
+
EXAMPLES::
|
|
1180
|
+
|
|
1181
|
+
sage: z = var('z') # needs sage.symbolic
|
|
1182
|
+
sage: cosh_integral(z) # needs sage.symbolic
|
|
1183
|
+
cosh_integral(z)
|
|
1184
|
+
sage: cosh_integral(3.0) # needs mpmath
|
|
1185
|
+
4.96039209476561
|
|
1186
|
+
|
|
1187
|
+
Numerical evaluation for real and complex arguments is handled using mpmath::
|
|
1188
|
+
|
|
1189
|
+
sage: cosh_integral(1.0) # needs mpmath
|
|
1190
|
+
0.837866940980208
|
|
1191
|
+
|
|
1192
|
+
The alias ``Chi`` can be used instead of ``cosh_integral``::
|
|
1193
|
+
|
|
1194
|
+
sage: Chi(1.0) # needs mpmath
|
|
1195
|
+
0.837866940980208
|
|
1196
|
+
|
|
1197
|
+
Here is an example from the mpmath documentation::
|
|
1198
|
+
|
|
1199
|
+
sage: f(x) = cosh_integral(x) # needs sage.symbolic
|
|
1200
|
+
sage: find_root(f, 0.1, 1.0) # needs scipy sage.symbolic
|
|
1201
|
+
0.523822571389...
|
|
1202
|
+
|
|
1203
|
+
Compare ``cosh_integral(3.0)`` to the definition of the value using
|
|
1204
|
+
numerical integration::
|
|
1205
|
+
|
|
1206
|
+
sage: a = numerical_integral((cosh(x)-1)/x, 0, 3)[0] # needs sage.symbolic
|
|
1207
|
+
sage: abs(N(euler_gamma + log(3)) + a - N(cosh_integral(3.0))) < 1e-14 # needs sage.symbolic
|
|
1208
|
+
True
|
|
1209
|
+
|
|
1210
|
+
Arbitrary precision and complex arguments are handled::
|
|
1211
|
+
|
|
1212
|
+
sage: N(cosh_integral(3), digits=30) # needs sage.symbolic
|
|
1213
|
+
4.96039209476560976029791763669
|
|
1214
|
+
sage: cosh_integral(ComplexField(100)(3+I)) # needs sage.symbolic
|
|
1215
|
+
3.9096723099686417127843516794 + 3.0547519627014217273323873274*I
|
|
1216
|
+
|
|
1217
|
+
The limit of `\operatorname{Chi}(z)` as `z \to \infty` is `\infty`::
|
|
1218
|
+
|
|
1219
|
+
sage: N(cosh_integral(Infinity)) # needs mpmath
|
|
1220
|
+
+infinity
|
|
1221
|
+
|
|
1222
|
+
Symbolic derivatives and integrals are handled by Sage and Maxima::
|
|
1223
|
+
|
|
1224
|
+
sage: # needs sage.symbolic
|
|
1225
|
+
sage: x = var('x')
|
|
1226
|
+
sage: f = cosh_integral(x)
|
|
1227
|
+
sage: f.diff(x)
|
|
1228
|
+
cosh(x)/x
|
|
1229
|
+
sage: f.integrate(x)
|
|
1230
|
+
x*cosh_integral(x) - sinh(x)
|
|
1231
|
+
|
|
1232
|
+
ALGORITHM:
|
|
1233
|
+
|
|
1234
|
+
Numerical evaluation is handled using mpmath, but symbolics are handled
|
|
1235
|
+
by Sage and Maxima.
|
|
1236
|
+
|
|
1237
|
+
REFERENCES:
|
|
1238
|
+
|
|
1239
|
+
- :wikipedia:`Trigonometric_integral`
|
|
1240
|
+
- mpmath documentation: `chi`_
|
|
1241
|
+
|
|
1242
|
+
.. _`chi`: http://mpmath.org/doc/current/functions/expintegrals.html#chi
|
|
1243
|
+
"""
|
|
1244
|
+
def __init__(self):
|
|
1245
|
+
"""
|
|
1246
|
+
See the docstring for ``Function_cosh_integral``.
|
|
1247
|
+
|
|
1248
|
+
EXAMPLES::
|
|
1249
|
+
|
|
1250
|
+
sage: cosh_integral(1) # needs sage.symbolic
|
|
1251
|
+
cosh_integral(1)
|
|
1252
|
+
sage: cosh_integral(x)._sympy_() # needs sage.symbolic
|
|
1253
|
+
Chi(x)
|
|
1254
|
+
"""
|
|
1255
|
+
BuiltinFunction.__init__(self, "cosh_integral", nargs=1,
|
|
1256
|
+
latex_name=r'\operatorname{Chi}',
|
|
1257
|
+
conversions=dict(maxima='expintegral_chi',
|
|
1258
|
+
sympy='Chi',
|
|
1259
|
+
fricas='Chi'))
|
|
1260
|
+
|
|
1261
|
+
def _evalf_(self, z, parent=None, algorithm=None):
|
|
1262
|
+
"""
|
|
1263
|
+
EXAMPLES::
|
|
1264
|
+
|
|
1265
|
+
sage: N(cosh_integral(10^-10), digits=30) # needs sage.symbolic
|
|
1266
|
+
-22.4486352650389239795709024568
|
|
1267
|
+
sage: cosh_integral(ComplexField(100)(I)) # needs sage.symbolic
|
|
1268
|
+
0.33740392290096813466264620389 + 1.5707963267948966192313216916*I
|
|
1269
|
+
"""
|
|
1270
|
+
return _mpmath_utils_call(_mpmath_chi, z, parent=parent)
|
|
1271
|
+
|
|
1272
|
+
def _derivative_(self, z, diff_param=None):
|
|
1273
|
+
r"""
|
|
1274
|
+
The derivative of `\operatorname{Chi}(z)` is `\cosh(z)/z`.
|
|
1275
|
+
|
|
1276
|
+
EXAMPLES::
|
|
1277
|
+
|
|
1278
|
+
sage: # needs sage.symbolic
|
|
1279
|
+
sage: x = var('x')
|
|
1280
|
+
sage: f = cosh_integral(x)
|
|
1281
|
+
sage: f.diff(x)
|
|
1282
|
+
cosh(x)/x
|
|
1283
|
+
sage: f = cosh_integral(ln(x))
|
|
1284
|
+
sage: f.diff(x)
|
|
1285
|
+
1/2*(x^2 + 1)/(x^2*log(x))
|
|
1286
|
+
"""
|
|
1287
|
+
return cosh(z)/z
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
Chi = cosh_integral = Function_cosh_integral()
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
###################################################################
|
|
1294
|
+
# Code below here was moved from sage/functions/transcendental.py
|
|
1295
|
+
# This occurred as part of Issue #11143.
|
|
1296
|
+
###################################################################
|
|
1297
|
+
|
|
1298
|
+
# This class has a name which is not specific enough
|
|
1299
|
+
# see Function_exp_integral_e above, for example, which
|
|
1300
|
+
# is the "generalized" exponential integral function. We
|
|
1301
|
+
# are leaving the name the same for backwards compatibility
|
|
1302
|
+
# purposes.
|
|
1303
|
+
class Function_exp_integral(BuiltinFunction):
|
|
1304
|
+
r"""
|
|
1305
|
+
The generalized complex exponential integral Ei(z) defined by
|
|
1306
|
+
|
|
1307
|
+
.. MATH::
|
|
1308
|
+
|
|
1309
|
+
\operatorname{Ei}(x) = \int_{-\infty}^x \frac{e^t}{t} \; dt
|
|
1310
|
+
|
|
1311
|
+
for x > 0 and for complex arguments by analytic continuation,
|
|
1312
|
+
see [AS1964]_ 5.1.2.
|
|
1313
|
+
|
|
1314
|
+
EXAMPLES::
|
|
1315
|
+
|
|
1316
|
+
sage: # needs sage.symbolic
|
|
1317
|
+
sage: Ei(10)
|
|
1318
|
+
Ei(10)
|
|
1319
|
+
sage: Ei(I)
|
|
1320
|
+
Ei(I)
|
|
1321
|
+
sage: Ei(3+I)
|
|
1322
|
+
Ei(I + 3)
|
|
1323
|
+
sage: Ei(10r)
|
|
1324
|
+
Ei(10)
|
|
1325
|
+
|
|
1326
|
+
sage: Ei(1.3) # needs mpmath
|
|
1327
|
+
2.72139888023202
|
|
1328
|
+
sage: Ei(1.3r) # needs mpmath
|
|
1329
|
+
2.7213988802320235
|
|
1330
|
+
|
|
1331
|
+
The branch cut for this function is along the negative real axis::
|
|
1332
|
+
|
|
1333
|
+
sage: Ei(-3 + 0.1*I) # needs sage.symbolic
|
|
1334
|
+
-0.0129379427181693 + 3.13993830250942*I
|
|
1335
|
+
sage: Ei(-3 - 0.1*I) # needs sage.symbolic
|
|
1336
|
+
-0.0129379427181693 - 3.13993830250942*I
|
|
1337
|
+
|
|
1338
|
+
The precision for the result is deduced from the precision of the
|
|
1339
|
+
input. Convert the input to a higher precision explicitly if a
|
|
1340
|
+
result with higher precision is desired::
|
|
1341
|
+
|
|
1342
|
+
sage: Ei(RealField(300)(1.1)) # needs sage.rings.real_mpfr
|
|
1343
|
+
2.16737827956340282358378734233807621497112737591639704719499002090327541763352339357795426
|
|
1344
|
+
|
|
1345
|
+
ALGORITHM: Uses mpmath.
|
|
1346
|
+
|
|
1347
|
+
TESTS:
|
|
1348
|
+
|
|
1349
|
+
Show that the evaluation and limit issue in :issue:`13271` is fixed::
|
|
1350
|
+
|
|
1351
|
+
sage: # needs sage.symbolic
|
|
1352
|
+
sage: var('Z')
|
|
1353
|
+
Z
|
|
1354
|
+
sage: (Ei(-Z)).limit(Z=oo)
|
|
1355
|
+
0
|
|
1356
|
+
sage: (Ei(-Z)).limit(Z=1000)
|
|
1357
|
+
Ei(-1000)
|
|
1358
|
+
sage: (Ei(-Z)).limit(Z=1000).n()
|
|
1359
|
+
-5.07089306023517e-438
|
|
1360
|
+
"""
|
|
1361
|
+
def __init__(self):
|
|
1362
|
+
"""
|
|
1363
|
+
TESTS::
|
|
1364
|
+
|
|
1365
|
+
sage: Ei(10) # needs sage.symbolic
|
|
1366
|
+
Ei(10)
|
|
1367
|
+
sage: Ei(x)._sympy_() # needs sympy sage.symbolic
|
|
1368
|
+
Ei(x)
|
|
1369
|
+
"""
|
|
1370
|
+
BuiltinFunction.__init__(self, "Ei",
|
|
1371
|
+
conversions=dict(maxima='expintegral_ei',
|
|
1372
|
+
sympy='Ei',
|
|
1373
|
+
fricas='Ei'))
|
|
1374
|
+
|
|
1375
|
+
def _evalf_(self, x, parent=None, algorithm=None):
|
|
1376
|
+
"""
|
|
1377
|
+
EXAMPLES::
|
|
1378
|
+
|
|
1379
|
+
sage: # needs sage.symbolic
|
|
1380
|
+
sage: Ei(10).n()
|
|
1381
|
+
2492.22897624188
|
|
1382
|
+
sage: Ei(20).n()
|
|
1383
|
+
2.56156526640566e7
|
|
1384
|
+
sage: Ei(I).n()
|
|
1385
|
+
0.337403922900968 + 2.51687939716208*I
|
|
1386
|
+
sage: Ei(3+I).n()
|
|
1387
|
+
7.82313467600158 + 6.09751978399231*I
|
|
1388
|
+
"""
|
|
1389
|
+
return _mpmath_utils_call(_mpmath_ei, x, parent=parent)
|
|
1390
|
+
|
|
1391
|
+
def _derivative_(self, x, diff_param=None):
|
|
1392
|
+
"""
|
|
1393
|
+
EXAMPLES::
|
|
1394
|
+
|
|
1395
|
+
sage: # needs sage.symbolic
|
|
1396
|
+
sage: Ei(x).diff(x)
|
|
1397
|
+
e^x/x
|
|
1398
|
+
sage: Ei(x).diff(x).subs(x=1)
|
|
1399
|
+
e
|
|
1400
|
+
sage: Ei(x^2).diff(x)
|
|
1401
|
+
2*e^(x^2)/x
|
|
1402
|
+
sage: f = function('f')
|
|
1403
|
+
sage: Ei(f(x)).diff(x)
|
|
1404
|
+
e^f(x)*diff(f(x), x)/f(x)
|
|
1405
|
+
"""
|
|
1406
|
+
return exp(x)/x
|
|
1407
|
+
|
|
1408
|
+
|
|
1409
|
+
Ei = exp_integral_ei = Function_exp_integral()
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
# moved here from sage/functions/transcendental.py
|
|
1413
|
+
def exponential_integral_1(x, n=0):
|
|
1414
|
+
r"""
|
|
1415
|
+
Return the exponential integral `E_1(x)`. If the optional
|
|
1416
|
+
argument `n` is given, computes list of the first
|
|
1417
|
+
`n` values of the exponential integral
|
|
1418
|
+
`E_1(x m)`.
|
|
1419
|
+
|
|
1420
|
+
The exponential integral `E_1(x)` is
|
|
1421
|
+
|
|
1422
|
+
.. MATH::
|
|
1423
|
+
|
|
1424
|
+
E_1(x) = \int_{x}^{\infty} \frac{e^{-t}}{t} \; dt
|
|
1425
|
+
|
|
1426
|
+
INPUT:
|
|
1427
|
+
|
|
1428
|
+
- ``x`` -- a positive real number
|
|
1429
|
+
|
|
1430
|
+
- ``n`` -- (default: 0) a nonnegative integer; if
|
|
1431
|
+
nonzero, then return a list of values ``E_1(x*m)`` for m =
|
|
1432
|
+
1,2,3,...,n. This is useful, e.g., when computing derivatives of
|
|
1433
|
+
`L`-functions.
|
|
1434
|
+
|
|
1435
|
+
OUTPUT:
|
|
1436
|
+
|
|
1437
|
+
A real number if n is 0 (the default) or a list of reals if n > 0.
|
|
1438
|
+
The precision is the same as the input, with a default of 53 bits
|
|
1439
|
+
in case the input is exact.
|
|
1440
|
+
|
|
1441
|
+
EXAMPLES::
|
|
1442
|
+
|
|
1443
|
+
sage: # needs sage.libs.pari sage.rings.real_mpfr
|
|
1444
|
+
sage: exponential_integral_1(2)
|
|
1445
|
+
0.0489005107080611
|
|
1446
|
+
sage: exponential_integral_1(2, 4) # abs tol 1e-18
|
|
1447
|
+
[0.0489005107080611, 0.00377935240984891, 0.000360082452162659, 0.0000376656228439245]
|
|
1448
|
+
sage: exponential_integral_1(40, 5)
|
|
1449
|
+
[0.000000000000000, 2.22854325868847e-37, 6.33732515501151e-55,
|
|
1450
|
+
2.02336191509997e-72, 6.88522610630764e-90]
|
|
1451
|
+
sage: r = exponential_integral_1(RealField(150)(1)); r
|
|
1452
|
+
0.21938393439552027367716377546012164903104729
|
|
1453
|
+
sage: parent(r)
|
|
1454
|
+
Real Field with 150 bits of precision
|
|
1455
|
+
sage: exponential_integral_1(RealField(150)(100))
|
|
1456
|
+
3.6835977616820321802351926205081189876552201e-46
|
|
1457
|
+
|
|
1458
|
+
sage: exponential_integral_1(0)
|
|
1459
|
+
+Infinity
|
|
1460
|
+
|
|
1461
|
+
TESTS:
|
|
1462
|
+
|
|
1463
|
+
The relative error for a single value should be less than 1 ulp::
|
|
1464
|
+
|
|
1465
|
+
sage: for prec in [20..1000]: # long time (22s on sage.math, 2013), needs sage.libs.pari
|
|
1466
|
+
....: R = RealField(prec)
|
|
1467
|
+
....: S = RealField(prec+64)
|
|
1468
|
+
....: for t in range(8): # Try 8 values for each precision
|
|
1469
|
+
....: a = R.random_element(-15,10).exp()
|
|
1470
|
+
....: x = exponential_integral_1(a)
|
|
1471
|
+
....: y = exponential_integral_1(S(a))
|
|
1472
|
+
....: e = float(abs(S(x) - y)/x.ulp())
|
|
1473
|
+
....: if e >= 1.0:
|
|
1474
|
+
....: print("exponential_integral_1(%s) with precision %s has error of %s ulp"%(a, prec, e))
|
|
1475
|
+
|
|
1476
|
+
The absolute error for a vector should be less than `2^{-p} c`, where
|
|
1477
|
+
`p` is the precision in bits of `x` and `c = 2` ``max(1, exponential_integral_1(x))``::
|
|
1478
|
+
|
|
1479
|
+
sage: for prec in [20..128]: # long time (15s on sage.math, 2013), needs sage.libs.pari
|
|
1480
|
+
....: R = RealField(prec)
|
|
1481
|
+
....: S = RealField(prec+64)
|
|
1482
|
+
....: a = R.random_element(-15,10).exp()
|
|
1483
|
+
....: n = 2^ZZ.random_element(14)
|
|
1484
|
+
....: x = exponential_integral_1(a, n)
|
|
1485
|
+
....: y = exponential_integral_1(S(a), n)
|
|
1486
|
+
....: c = RDF(4 * max(1.0, y[0]))
|
|
1487
|
+
....: for i in range(n):
|
|
1488
|
+
....: e = float(abs(S(x[i]) - y[i]) << prec)
|
|
1489
|
+
....: if e >= c:
|
|
1490
|
+
....: print("exponential_integral_1(%s, %s)[%s] with precision %s has error of %s >= %s"%(a, n, i, prec, e, c))
|
|
1491
|
+
|
|
1492
|
+
ALGORITHM: use the PARI C-library function :pari:`eint1`.
|
|
1493
|
+
|
|
1494
|
+
REFERENCE:
|
|
1495
|
+
|
|
1496
|
+
- See Proposition 5.6.12 of Cohen's book "A Course in
|
|
1497
|
+
Computational Algebraic Number Theory".
|
|
1498
|
+
"""
|
|
1499
|
+
if isinstance(x, Expression):
|
|
1500
|
+
if x.is_trivial_zero():
|
|
1501
|
+
return Infinity
|
|
1502
|
+
else:
|
|
1503
|
+
raise NotImplementedError("Use the symbolic exponential integral " +
|
|
1504
|
+
"function: exp_integral_e1.")
|
|
1505
|
+
|
|
1506
|
+
# x == 0 => return Infinity
|
|
1507
|
+
if not x:
|
|
1508
|
+
return Infinity
|
|
1509
|
+
|
|
1510
|
+
# Figure out output precision
|
|
1511
|
+
try:
|
|
1512
|
+
prec = parent(x).precision()
|
|
1513
|
+
except AttributeError:
|
|
1514
|
+
prec = 53
|
|
1515
|
+
|
|
1516
|
+
R = RealField(prec)
|
|
1517
|
+
if n <= 0:
|
|
1518
|
+
# Add extra bits to the input.
|
|
1519
|
+
# (experimentally verified -- Jeroen Demeyer)
|
|
1520
|
+
inprec = prec + 5 + math.ceil(math.log(prec))
|
|
1521
|
+
x = RealField(inprec)(x).__pari__()
|
|
1522
|
+
return R(x.eint1())
|
|
1523
|
+
else:
|
|
1524
|
+
# PARI's algorithm is less precise as n grows larger:
|
|
1525
|
+
# add extra bits.
|
|
1526
|
+
# (experimentally verified -- Jeroen Demeyer)
|
|
1527
|
+
inprec = prec + 1 + math.ceil(1.4427 * math.log(n))
|
|
1528
|
+
x = RealField(inprec)(x).__pari__()
|
|
1529
|
+
return [R(z) for z in x.eint1(n)]
|