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
sage/functions/jacobi.py
ADDED
|
@@ -0,0 +1,1705 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-categories
|
|
2
|
+
r"""
|
|
3
|
+
Jacobi elliptic functions
|
|
4
|
+
|
|
5
|
+
This module implements the 12 Jacobi elliptic functions, along with their
|
|
6
|
+
inverses and the Jacobi amplitude function.
|
|
7
|
+
|
|
8
|
+
Jacobi elliptic functions can be thought of as generalizations
|
|
9
|
+
of both ordinary and hyperbolic trig functions. There are twelve
|
|
10
|
+
Jacobian elliptic functions. Each of the twelve corresponds to an
|
|
11
|
+
arrow drawn from one corner of a rectangle to another.
|
|
12
|
+
|
|
13
|
+
::
|
|
14
|
+
|
|
15
|
+
n ------------------- d
|
|
16
|
+
| |
|
|
17
|
+
| |
|
|
18
|
+
| |
|
|
19
|
+
s ------------------- c
|
|
20
|
+
|
|
21
|
+
Each of the corners of the rectangle are labeled, by convention, ``s``,
|
|
22
|
+
``c``, ``d``, and ``n``. The rectangle is understood to be lying on the complex
|
|
23
|
+
plane, so that ``s`` is at the origin, ``c`` is on the real axis, and ``n`` is
|
|
24
|
+
on the imaginary axis. The twelve Jacobian elliptic functions are
|
|
25
|
+
then `\operatorname{pq}(x)`, where ``p`` and ``q`` are one of the letters
|
|
26
|
+
``s``, ``c``, ``d``, ``n``.
|
|
27
|
+
|
|
28
|
+
The Jacobian elliptic functions are then the unique
|
|
29
|
+
doubly-periodic, meromorphic functions satisfying the following
|
|
30
|
+
three properties:
|
|
31
|
+
|
|
32
|
+
#. There is a simple zero at the corner ``p``, and a simple pole at the
|
|
33
|
+
corner ``q``.
|
|
34
|
+
#. The step from ``p`` to ``q`` is equal to half the period of the function
|
|
35
|
+
`\operatorname{pq}(x)`; that is, the function `\operatorname{pq}(x)` is
|
|
36
|
+
periodic in the direction ``pq``, with the period being twice the distance
|
|
37
|
+
from ``p`` to ``q``. `\operatorname{pq}(x)` is periodic in the other two
|
|
38
|
+
directions as well, with a period such that the distance from ``p`` to one
|
|
39
|
+
of the other corners is a quarter period.
|
|
40
|
+
#. If the function `\operatorname{pq}(x)` is expanded in terms of `x` at one of
|
|
41
|
+
the corners, the leading term in the expansion has a coefficient of 1.
|
|
42
|
+
In other words, the leading term of the expansion of `\operatorname{pq}(x)`
|
|
43
|
+
at the corner ``p`` is `x`; the leading term of the expansion at the corner
|
|
44
|
+
``q`` is `1/x`, and the leading term of an expansion at the other two
|
|
45
|
+
corners is 1.
|
|
46
|
+
|
|
47
|
+
We can write
|
|
48
|
+
|
|
49
|
+
.. MATH::
|
|
50
|
+
|
|
51
|
+
\operatorname{pq}(x) = \frac{\operatorname{pr}(x)}{\operatorname{qr}(x)}
|
|
52
|
+
|
|
53
|
+
where ``p``, ``q``, and ``r`` are any of the
|
|
54
|
+
letters ``s``, ``c``, ``d``, ``n``, with
|
|
55
|
+
the understanding that `\mathrm{ss} = \mathrm{cc} = \mathrm{dd}
|
|
56
|
+
= \mathrm{nn} = 1`.
|
|
57
|
+
|
|
58
|
+
Let
|
|
59
|
+
|
|
60
|
+
.. MATH::
|
|
61
|
+
|
|
62
|
+
u = \int_0^{\phi} \frac{d\theta} {\sqrt {1-m \sin^2 \theta}},
|
|
63
|
+
|
|
64
|
+
then the *Jacobi elliptic function* `\operatorname{sn}(u)` is given by
|
|
65
|
+
|
|
66
|
+
.. MATH::
|
|
67
|
+
|
|
68
|
+
\operatorname{sn}{u} = \sin{\phi}
|
|
69
|
+
|
|
70
|
+
and `\operatorname{cn}(u)` is given by
|
|
71
|
+
|
|
72
|
+
.. MATH::
|
|
73
|
+
|
|
74
|
+
\operatorname{cn}{u} = \cos{\phi}
|
|
75
|
+
|
|
76
|
+
and
|
|
77
|
+
|
|
78
|
+
.. MATH::
|
|
79
|
+
|
|
80
|
+
\operatorname{dn}{u} = \sqrt{1 - m\sin^2 \phi}.
|
|
81
|
+
|
|
82
|
+
To emphasize the dependence on `m`, one can write
|
|
83
|
+
`\operatorname{sn}(u|m)` for example (and similarly for `\mathrm{cn}` and
|
|
84
|
+
`\mathrm{dn}`). This is the notation used below.
|
|
85
|
+
|
|
86
|
+
For a given `k` with `0 < k < 1` they therefore are
|
|
87
|
+
solutions to the following nonlinear ordinary differential
|
|
88
|
+
equations:
|
|
89
|
+
|
|
90
|
+
- `\operatorname{sn}\,(x;k)` solves the differential equations
|
|
91
|
+
|
|
92
|
+
.. MATH::
|
|
93
|
+
|
|
94
|
+
\frac{d^2 y}{dx^2} + (1+k^2) y - 2 k^2 y^3 = 0
|
|
95
|
+
\quad \text{ and } \quad
|
|
96
|
+
\left(\frac{dy}{dx}\right)^2 = (1-y^2) (1-k^2 y^2).
|
|
97
|
+
|
|
98
|
+
- `\operatorname{cn}(x;k)` solves the differential equations
|
|
99
|
+
|
|
100
|
+
.. MATH::
|
|
101
|
+
|
|
102
|
+
\frac{d^2 y}{dx^2} + (1-2k^2) y + 2 k^2 y^3 = 0
|
|
103
|
+
\quad \text{ and } \quad
|
|
104
|
+
\left(\frac{dy}{dx}\right)^2 = (1-y^2)(1-k^2 + k^2 y^2).
|
|
105
|
+
|
|
106
|
+
- `\operatorname{dn}(x;k)` solves the differential equations
|
|
107
|
+
|
|
108
|
+
.. MATH::
|
|
109
|
+
|
|
110
|
+
\frac{d^2 y}{dx^2} - (2 - k^2) y + 2 y^3 = 0
|
|
111
|
+
\quad \text{ and } \quad
|
|
112
|
+
\left(\frac{dy}{dx}\right)^2 = y^2 (1 - k^2 - y^2).
|
|
113
|
+
|
|
114
|
+
If `K(m)` denotes the complete elliptic integral of the
|
|
115
|
+
first kind (named ``elliptic_kc`` in Sage), the elliptic functions
|
|
116
|
+
`\operatorname{sn}(x|m)` and `\operatorname{cn}(x|m)` have real periods
|
|
117
|
+
`4K(m)`, whereas `\operatorname{dn}(x|m)` has a period
|
|
118
|
+
`2K(m)`. The limit `m \rightarrow 0` gives
|
|
119
|
+
`K(0) = \pi/2` and trigonometric functions:
|
|
120
|
+
`\operatorname{sn}(x|0) = \sin{x}`, `\operatorname{cn}(x|0) = \cos{x}`,
|
|
121
|
+
`\operatorname{dn}(x|0) = 1`. The limit `m \rightarrow 1` gives
|
|
122
|
+
`K(1) \rightarrow \infty` and hyperbolic functions:
|
|
123
|
+
`\operatorname{sn}(x|1) = \tanh{x}`,
|
|
124
|
+
`\operatorname{cn}(x|1) = \operatorname{sech}{x}`,
|
|
125
|
+
`\operatorname{dn}(x|1) = \operatorname{sech}{x}`.
|
|
126
|
+
|
|
127
|
+
REFERENCES:
|
|
128
|
+
|
|
129
|
+
- :wikipedia:`Jacobi%27s_elliptic_functions`
|
|
130
|
+
|
|
131
|
+
- [KS2002]_
|
|
132
|
+
|
|
133
|
+
AUTHORS:
|
|
134
|
+
|
|
135
|
+
- David Joyner (2006): initial version
|
|
136
|
+
|
|
137
|
+
- Eviatar Bach (2013): complete rewrite, new numerical evaluation, and
|
|
138
|
+
addition of the Jacobi amplitude function
|
|
139
|
+
"""
|
|
140
|
+
# ****************************************************************************
|
|
141
|
+
# Copyright (C) 2006 David Joyner <wdj@usna.edu>
|
|
142
|
+
# Copyright (C) 2013 Eviatar Bach <eviatarbach@gmail.com>
|
|
143
|
+
#
|
|
144
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
145
|
+
# as published by the Free Software Foundation; either version 2 of
|
|
146
|
+
# the License, or (at your option) any later version.
|
|
147
|
+
# https://www.gnu.org/licenses/
|
|
148
|
+
# ****************************************************************************
|
|
149
|
+
from sage.functions.hyperbolic import (arctanh, arccosh, arcsinh, arcsech,
|
|
150
|
+
arccsch, arccoth, cosh, coth, sech,
|
|
151
|
+
csch, tanh, sinh)
|
|
152
|
+
from sage.functions.special import elliptic_e, elliptic_kc
|
|
153
|
+
from sage.functions.trig import (arctan, arcsin, arccos, arccot, arcsec,
|
|
154
|
+
arccsc, csc, sec, sin, cos, tan, cot)
|
|
155
|
+
from sage.misc.lazy_import import lazy_import
|
|
156
|
+
from sage.rings.integer import Integer
|
|
157
|
+
from sage.rings.rational_field import QQ
|
|
158
|
+
from sage.symbolic.function import BuiltinFunction
|
|
159
|
+
|
|
160
|
+
lazy_import('sage.misc.latex', 'latex')
|
|
161
|
+
|
|
162
|
+
lazy_import('sage.libs.mpmath.utils', 'call', as_='_mpmath_utils_call')
|
|
163
|
+
lazy_import('mpmath', 'ellipfun', as_='_mpmath_ellipfun')
|
|
164
|
+
|
|
165
|
+
HALF = QQ((1, 2))
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
class Jacobi(BuiltinFunction):
|
|
169
|
+
"""
|
|
170
|
+
Base class for the Jacobi elliptic functions.
|
|
171
|
+
"""
|
|
172
|
+
def __init__(self, kind):
|
|
173
|
+
r"""
|
|
174
|
+
Initialize ``self``.
|
|
175
|
+
|
|
176
|
+
EXAMPLES::
|
|
177
|
+
|
|
178
|
+
sage: from sage.functions.jacobi import Jacobi
|
|
179
|
+
sage: Jacobi('sn')
|
|
180
|
+
jacobi_sn
|
|
181
|
+
|
|
182
|
+
TESTS::
|
|
183
|
+
|
|
184
|
+
sage: N(jacobi("sn", I, 1/2)) # abs tol 1e-12 # needs sage.symbolic
|
|
185
|
+
-8.59454886300046e-73 + 1.34737147138542*I
|
|
186
|
+
|
|
187
|
+
sage: # optional - fricas, needs sage.symbolic
|
|
188
|
+
sage: CN = fricas(jacobi('cn',x, 2)); CN
|
|
189
|
+
jacobiCn(x,2)
|
|
190
|
+
sage: fricas.series(CN, x=0)
|
|
191
|
+
1 2 3 4 17 6 79 8 1381 10 11
|
|
192
|
+
1 - - x + - x - -- x + --- x - ----- x + O(x )
|
|
193
|
+
2 8 80 640 19200
|
|
194
|
+
sage: fricas(jacobi('sn',x, 2))
|
|
195
|
+
jacobiSn(x,2)
|
|
196
|
+
sage: fricas(jacobi('dn',x, 2))
|
|
197
|
+
jacobiDn(x,2)
|
|
198
|
+
"""
|
|
199
|
+
if kind not in ['nd', 'ns', 'nc', 'dn', 'ds', 'dc', 'sn', 'sd',
|
|
200
|
+
'sc', 'cn', 'cd', 'cs']:
|
|
201
|
+
raise ValueError("kind must be one of 'nd', 'ns', 'nc', 'dn', "
|
|
202
|
+
"'ds', 'dc', 'sn', 'sd', 'sc', 'cn', 'cd', 'cs'.")
|
|
203
|
+
self.kind = kind
|
|
204
|
+
BuiltinFunction.__init__(self,
|
|
205
|
+
name=f'jacobi_{kind}', nargs=2, evalf_params_first=False,
|
|
206
|
+
conversions=dict(maple=('Jacobi{}'.format(kind.upper())),
|
|
207
|
+
mathematica=('Jacobi{}'.format(kind.upper())),
|
|
208
|
+
fricas=('jacobi{}'.format(kind.capitalize())),
|
|
209
|
+
maxima=('jacobi_{}'.format(kind))))
|
|
210
|
+
|
|
211
|
+
def _eval_(self, x, m):
|
|
212
|
+
r"""
|
|
213
|
+
TESTS:
|
|
214
|
+
|
|
215
|
+
Check that the simplifications are correct::
|
|
216
|
+
|
|
217
|
+
sage: # needs mpmath sage.symbolic
|
|
218
|
+
sage: from sage.libs.mpmath.all import almosteq
|
|
219
|
+
sage: almosteq(n(jacobi_nd(8, 0, hold=True)), n(jacobi_nd(8, 0)))
|
|
220
|
+
True
|
|
221
|
+
sage: almosteq(n(jacobi_nd(1, 1, hold=True)), n(jacobi_nd(1, 1)))
|
|
222
|
+
True
|
|
223
|
+
sage: almosteq(n(jacobi_nd(0, -5, hold=True)), n(jacobi_nd(0, -5)))
|
|
224
|
+
True
|
|
225
|
+
sage: almosteq(n(jacobi_ns(-4, 0, hold=True)), n(jacobi_ns(-4, 0)))
|
|
226
|
+
True
|
|
227
|
+
sage: almosteq(n(jacobi_ns(-2, 1, hold=True)), n(jacobi_ns(-2, 1)))
|
|
228
|
+
True
|
|
229
|
+
sage: almosteq(n(jacobi_nc(2, 0, hold=True)), n(jacobi_nc(2, 0)))
|
|
230
|
+
True
|
|
231
|
+
sage: almosteq(n(jacobi_nc(1, 1, hold=True)), n(jacobi_nc(1, 1)))
|
|
232
|
+
True
|
|
233
|
+
sage: almosteq(n(jacobi_nc(0, 0, hold=True)), n(jacobi_nc(0, 0)))
|
|
234
|
+
True
|
|
235
|
+
sage: almosteq(n(jacobi_dn(-10, 0, hold=True)), n(jacobi_dn(-10, 0)))
|
|
236
|
+
True
|
|
237
|
+
sage: almosteq(n(jacobi_dn(-1, 1, hold=True)), n(jacobi_dn(-1, 1)))
|
|
238
|
+
True
|
|
239
|
+
sage: almosteq(n(jacobi_dn(0, 3, hold=True)), n(jacobi_dn(0, 3)))
|
|
240
|
+
True
|
|
241
|
+
sage: almosteq(n(jacobi_ds(2, 0, hold=True)), n(jacobi_ds(2, 0)))
|
|
242
|
+
True
|
|
243
|
+
sage: almosteq(n(jacobi_dc(-1, 0, hold=True)), n(jacobi_dc(-1, 0)))
|
|
244
|
+
True
|
|
245
|
+
sage: almosteq(n(jacobi_dc(-8, 1, hold=True)), n(jacobi_dc(-8, 1)))
|
|
246
|
+
True
|
|
247
|
+
sage: almosteq(n(jacobi_dc(0, -10, hold=True)), n(jacobi_dc(0, -10)))
|
|
248
|
+
True
|
|
249
|
+
sage: almosteq(n(jacobi_sn(-7, 0, hold=True)), n(jacobi_sn(-7, 0)))
|
|
250
|
+
True
|
|
251
|
+
sage: almosteq(n(jacobi_sn(-3, 1, hold=True)), n(jacobi_sn(-3, 1)))
|
|
252
|
+
True
|
|
253
|
+
sage: almosteq(n(jacobi_sn(0, -6, hold=True)), n(jacobi_sn(0, -6)))
|
|
254
|
+
True
|
|
255
|
+
sage: almosteq(n(jacobi_sd(4, 0, hold=True)), n(jacobi_sd(4, 0)))
|
|
256
|
+
True
|
|
257
|
+
sage: almosteq(n(jacobi_sd(0, 1, hold=True)), n(jacobi_sd(0, 1)))
|
|
258
|
+
True
|
|
259
|
+
sage: almosteq(n(jacobi_sd(0, 3, hold=True)), n(jacobi_sd(0, 3)))
|
|
260
|
+
True
|
|
261
|
+
sage: almosteq(n(jacobi_sc(-9, 0, hold=True)), n(jacobi_sc(-9, 0)))
|
|
262
|
+
True
|
|
263
|
+
sage: almosteq(n(jacobi_sc(0, 1, hold=True)), n(jacobi_sc(0, 1)))
|
|
264
|
+
True
|
|
265
|
+
sage: almosteq(n(jacobi_sc(0, -10, hold=True)), n(jacobi_sc(0, -10)))
|
|
266
|
+
True
|
|
267
|
+
sage: almosteq(n(jacobi_cn(-2, 0, hold=True)), n(jacobi_cn(-2, 0)))
|
|
268
|
+
True
|
|
269
|
+
sage: almosteq(n(jacobi_cn(6, 1, hold=True)), n(jacobi_cn(6, 1)))
|
|
270
|
+
True
|
|
271
|
+
sage: almosteq(n(jacobi_cn(0, -10, hold=True)), n(jacobi_cn(0, -10)))
|
|
272
|
+
True
|
|
273
|
+
sage: almosteq(n(jacobi_cd(9, 0, hold=True)), n(jacobi_cd(9, 0)))
|
|
274
|
+
True
|
|
275
|
+
sage: almosteq(n(jacobi_cd(-8, 1, hold=True)), n(jacobi_cd(-8, 1)))
|
|
276
|
+
True
|
|
277
|
+
sage: almosteq(n(jacobi_cd(0, 1, hold=True)), n(jacobi_cd(0, 1)))
|
|
278
|
+
True
|
|
279
|
+
sage: almosteq(n(jacobi_cs(-9, 0, hold=True)), n(jacobi_cs(-9, 0)))
|
|
280
|
+
True
|
|
281
|
+
sage: almosteq(n(jacobi_cs(-6, 1, hold=True)), n(jacobi_cs(-6, 1)))
|
|
282
|
+
True
|
|
283
|
+
"""
|
|
284
|
+
if self.kind == 'nd':
|
|
285
|
+
if m == 0:
|
|
286
|
+
return Integer(1)
|
|
287
|
+
elif m == 1:
|
|
288
|
+
return cosh(x)
|
|
289
|
+
elif x == 0:
|
|
290
|
+
return Integer(1)
|
|
291
|
+
elif self.kind == 'ns':
|
|
292
|
+
if m == 0:
|
|
293
|
+
return csc(x)
|
|
294
|
+
elif m == 1:
|
|
295
|
+
return coth(x)
|
|
296
|
+
elif self.kind == 'nc':
|
|
297
|
+
if m == 0:
|
|
298
|
+
return sec(x)
|
|
299
|
+
elif m == 1:
|
|
300
|
+
return cosh(x)
|
|
301
|
+
elif x == 0:
|
|
302
|
+
return Integer(1)
|
|
303
|
+
elif self.kind == 'dn':
|
|
304
|
+
if m == 0:
|
|
305
|
+
return Integer(1)
|
|
306
|
+
elif m == 1:
|
|
307
|
+
return sech(x)
|
|
308
|
+
elif x == 0:
|
|
309
|
+
return Integer(1)
|
|
310
|
+
elif self.kind == 'ds':
|
|
311
|
+
if m == 0:
|
|
312
|
+
return csc(x)
|
|
313
|
+
elif self.kind == 'dc':
|
|
314
|
+
if m == 0:
|
|
315
|
+
return sec(x)
|
|
316
|
+
elif m == 1:
|
|
317
|
+
return Integer(1)
|
|
318
|
+
elif x == 0:
|
|
319
|
+
return Integer(1)
|
|
320
|
+
elif self.kind == 'sn':
|
|
321
|
+
if m == 0:
|
|
322
|
+
return sin(x)
|
|
323
|
+
elif m == 1:
|
|
324
|
+
return tanh(x)
|
|
325
|
+
elif x == 0:
|
|
326
|
+
return Integer(0)
|
|
327
|
+
elif self.kind == 'sd':
|
|
328
|
+
if m == 0:
|
|
329
|
+
return sin(x)
|
|
330
|
+
elif m == 1:
|
|
331
|
+
return sinh(x)
|
|
332
|
+
elif x == 0:
|
|
333
|
+
return Integer(0)
|
|
334
|
+
elif self.kind == 'sc':
|
|
335
|
+
if m == 0:
|
|
336
|
+
return tan(x)
|
|
337
|
+
elif m == 1:
|
|
338
|
+
return sinh(x)
|
|
339
|
+
elif x == 0:
|
|
340
|
+
return Integer(0)
|
|
341
|
+
elif self.kind == 'cn':
|
|
342
|
+
if m == 0:
|
|
343
|
+
return cos(x)
|
|
344
|
+
elif m == 1:
|
|
345
|
+
return sech(x)
|
|
346
|
+
elif x == 0:
|
|
347
|
+
return Integer(1)
|
|
348
|
+
elif self.kind == 'cd':
|
|
349
|
+
if m == 0:
|
|
350
|
+
return cos(x)
|
|
351
|
+
elif m == 1:
|
|
352
|
+
return Integer(1)
|
|
353
|
+
elif x == 0:
|
|
354
|
+
return Integer(1)
|
|
355
|
+
elif self.kind == 'cs':
|
|
356
|
+
if m == 0:
|
|
357
|
+
return cot(x)
|
|
358
|
+
elif m == 1:
|
|
359
|
+
return csch(x)
|
|
360
|
+
return
|
|
361
|
+
|
|
362
|
+
def _evalf_(self, x, m, parent=None, algorithm=None):
|
|
363
|
+
r"""
|
|
364
|
+
TESTS::
|
|
365
|
+
|
|
366
|
+
sage: jacobi_sn(3, 4).n(100) # needs mpmath sage.symbolic
|
|
367
|
+
-0.33260000892770027112809652714 + 1.7077912301715219199143891076e-33*I
|
|
368
|
+
sage: jacobi_dn(I, I).n() # needs mpmath sage.symbolic
|
|
369
|
+
0.874189950651018 + 0.667346865048825*I
|
|
370
|
+
"""
|
|
371
|
+
return _mpmath_utils_call(_mpmath_ellipfun, self.kind, x, m, parent=parent)
|
|
372
|
+
|
|
373
|
+
def _derivative_(self, x, m, diff_param):
|
|
374
|
+
r"""
|
|
375
|
+
TESTS:
|
|
376
|
+
|
|
377
|
+
sn, cn, and dn are analytic for all real ``x``, so we can check
|
|
378
|
+
that the derivatives are correct by computing the series::
|
|
379
|
+
|
|
380
|
+
sage: # needs mpmath sage.symbolic
|
|
381
|
+
sage: from mpmath import almosteq
|
|
382
|
+
sage: a = 0.9327542442482303
|
|
383
|
+
sage: b = 0.7402326293643771
|
|
384
|
+
sage: almosteq(jacobi_sn(x, b).series(x, 10).subs(x=a),
|
|
385
|
+
....: jacobi_sn(a, b), abs_eps=0.01)
|
|
386
|
+
True
|
|
387
|
+
sage: almosteq(jacobi_cn(x, b).series(x, 10).subs(x=a),
|
|
388
|
+
....: jacobi_cn(a, b), abs_eps=0.01)
|
|
389
|
+
True
|
|
390
|
+
sage: almosteq(jacobi_dn(x, b).series(x, 10).subs(x=a),
|
|
391
|
+
....: jacobi_dn(a, b), abs_eps=0.01)
|
|
392
|
+
True
|
|
393
|
+
"""
|
|
394
|
+
if diff_param == 0:
|
|
395
|
+
# From Wolfram Functions Site
|
|
396
|
+
if self.kind == 'cd':
|
|
397
|
+
return (m - Integer(1)) * jacobi_nd(x, m) * jacobi_sd(x, m)
|
|
398
|
+
elif self.kind == 'cn':
|
|
399
|
+
return -jacobi_sn(x, m) * jacobi_dn(x, m)
|
|
400
|
+
elif self.kind == 'cs':
|
|
401
|
+
return -jacobi_ds(x, m) * jacobi_ns(x, m)
|
|
402
|
+
elif self.kind == 'dc':
|
|
403
|
+
return (Integer(1) - m) * jacobi_nc(x, m) * jacobi_sc(x, m)
|
|
404
|
+
elif self.kind == 'dn':
|
|
405
|
+
return -m * jacobi_sn(x, m) * jacobi_cn(x, m)
|
|
406
|
+
elif self.kind == 'ds':
|
|
407
|
+
return -jacobi_cs(x, m) * jacobi_ns(x, m)
|
|
408
|
+
elif self.kind == 'nc':
|
|
409
|
+
return jacobi_dc(x, m) * jacobi_sc(x, m)
|
|
410
|
+
elif self.kind == 'nd':
|
|
411
|
+
return m * jacobi_cd(x, m) * jacobi_sd(x, m)
|
|
412
|
+
elif self.kind == 'ns':
|
|
413
|
+
return -jacobi_cs(x, m) * jacobi_ds(x, m)
|
|
414
|
+
elif self.kind == 'sc':
|
|
415
|
+
return jacobi_dc(x, m) * jacobi_nc(x, m)
|
|
416
|
+
elif self.kind == 'sd':
|
|
417
|
+
return jacobi_cd(x, m) * jacobi_nd(x, m)
|
|
418
|
+
elif self.kind == 'sn':
|
|
419
|
+
return jacobi_cn(x, m) * jacobi_dn(x, m)
|
|
420
|
+
elif diff_param == 1:
|
|
421
|
+
# From Maxima
|
|
422
|
+
if self.kind == 'nd':
|
|
423
|
+
return (HALF*((x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
424
|
+
(m - Integer(1)))*jacobi_sn(x, m)*jacobi_cn(x, m) -
|
|
425
|
+
jacobi_dn(x, m)*jacobi_sn(x, m)**Integer(2)/(m - Integer(1))) /
|
|
426
|
+
jacobi_dn(x, m)**Integer(2))
|
|
427
|
+
elif self.kind == 'ns':
|
|
428
|
+
return (HALF*(jacobi_sn(x, m)*jacobi_cn(x, m)**Integer(2)/(m - Integer(1)) -
|
|
429
|
+
(x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
430
|
+
(m - Integer(1)))*jacobi_dn(x, m)*jacobi_cn(x, m)/m) /
|
|
431
|
+
jacobi_sn(x, m)**Integer(2))
|
|
432
|
+
elif self.kind == 'nc':
|
|
433
|
+
return (-HALF*(jacobi_sn(x, m)**Integer(2)*jacobi_cn(x, m)/(m - Integer(1)) -
|
|
434
|
+
(x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
435
|
+
(m - Integer(1)))*jacobi_dn(x, m) *
|
|
436
|
+
jacobi_sn(x, m)/m)/jacobi_cn(x, m)**Integer(2))
|
|
437
|
+
elif self.kind == 'dn':
|
|
438
|
+
return (-HALF*(x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
439
|
+
(m - Integer(1)))*jacobi_sn(x, m)*jacobi_cn(x, m) +
|
|
440
|
+
HALF*jacobi_dn(x, m)*jacobi_sn(x, m)**Integer(2)/(m - Integer(1)))
|
|
441
|
+
elif self.kind == 'ds':
|
|
442
|
+
return (HALF*(jacobi_sn(x, m)*jacobi_cn(x, m)**Integer(2)/(m - Integer(1)) -
|
|
443
|
+
(x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
444
|
+
(m - Integer(1)))*jacobi_dn(x, m)*jacobi_cn(x, m)/m) *
|
|
445
|
+
jacobi_dn(x, m)/jacobi_sn(x, m)**Integer(2) -
|
|
446
|
+
HALF*((x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
447
|
+
(m - Integer(1)))*jacobi_sn(x, m)*jacobi_cn(x, m) -
|
|
448
|
+
jacobi_dn(x, m)*jacobi_sn(x, m)**Integer(2)/(m - Integer(1))) /
|
|
449
|
+
jacobi_sn(x, m))
|
|
450
|
+
elif self.kind == 'dc':
|
|
451
|
+
return (-HALF*(jacobi_sn(x, m)**Integer(2)*jacobi_cn(x, m)/(m - Integer(1)) -
|
|
452
|
+
(x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
453
|
+
(m - Integer(1)))*jacobi_dn(x, m) *
|
|
454
|
+
jacobi_sn(x, m)/m)*jacobi_dn(x, m) /
|
|
455
|
+
jacobi_cn(x, m)**Integer(2) -
|
|
456
|
+
HALF*((x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
457
|
+
(m - Integer(1)))*jacobi_sn(x, m)*jacobi_cn(x, m) -
|
|
458
|
+
jacobi_dn(x, m)*jacobi_sn(x, m)**Integer(2)/(m - Integer(1))) /
|
|
459
|
+
jacobi_cn(x, m))
|
|
460
|
+
elif self.kind == 'sn':
|
|
461
|
+
return (-HALF*jacobi_sn(x, m)*jacobi_cn(x, m)**Integer(2)/(m - Integer(1)) +
|
|
462
|
+
HALF*(x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
463
|
+
(m - Integer(1)))*jacobi_dn(x, m)*jacobi_cn(x, m)/m)
|
|
464
|
+
elif self.kind == 'sd':
|
|
465
|
+
return (-HALF*(jacobi_sn(x, m)*jacobi_cn(x, m)**Integer(2)/(m - Integer(1)) -
|
|
466
|
+
(x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
467
|
+
(m - Integer(1)))*jacobi_dn(x, m)*jacobi_cn(x, m)/m) /
|
|
468
|
+
jacobi_dn(x, m) + HALF *
|
|
469
|
+
((x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
470
|
+
(m - Integer(1)))*jacobi_sn(x, m)*jacobi_cn(x, m) -
|
|
471
|
+
jacobi_dn(x, m)*jacobi_sn(x, m)**Integer(2)/(m - Integer(1))) *
|
|
472
|
+
jacobi_sn(x, m)/jacobi_dn(x, m)**Integer(2))
|
|
473
|
+
elif self.kind == 'sc':
|
|
474
|
+
return (-HALF*(jacobi_sn(x, m)*jacobi_cn(x, m)**Integer(2)/(m - Integer(1)) -
|
|
475
|
+
(x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
476
|
+
(m - Integer(1)))*jacobi_dn(x, m) *
|
|
477
|
+
jacobi_cn(x, m)/m)/jacobi_cn(x, m) -
|
|
478
|
+
HALF*(jacobi_sn(x, m)**Integer(2)*jacobi_cn(x, m)/(m - Integer(1)) -
|
|
479
|
+
(x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
480
|
+
(m - Integer(1)))*jacobi_dn(x, m)*jacobi_sn(x, m)/m) *
|
|
481
|
+
jacobi_sn(x, m)/jacobi_cn(x, m)**Integer(2))
|
|
482
|
+
elif self.kind == 'cn':
|
|
483
|
+
return (HALF*jacobi_sn(x, m)**Integer(2)*jacobi_cn(x, m)/(m - Integer(1)) -
|
|
484
|
+
HALF*(x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
485
|
+
(m - Integer(1)))*jacobi_dn(x, m)*jacobi_sn(x, m)/m)
|
|
486
|
+
elif self.kind == 'cd':
|
|
487
|
+
return (HALF*(jacobi_sn(x, m)**Integer(2)*jacobi_cn(x, m)/(m - Integer(1)) -
|
|
488
|
+
(x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
489
|
+
(m - Integer(1)))*jacobi_dn(x, m)*jacobi_sn(x, m)/m) /
|
|
490
|
+
jacobi_dn(x, m) +
|
|
491
|
+
HALF*((x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
492
|
+
(m - Integer(1)))*jacobi_sn(x, m)*jacobi_cn(x, m) -
|
|
493
|
+
jacobi_dn(x, m)*jacobi_sn(x, m)**Integer(2)/(m - Integer(1))) *
|
|
494
|
+
jacobi_cn(x, m)/jacobi_dn(x, m)**Integer(2))
|
|
495
|
+
elif self.kind == 'cs':
|
|
496
|
+
return (HALF*(jacobi_sn(x, m)*jacobi_cn(x, m)**Integer(2)/(m - Integer(1)) -
|
|
497
|
+
(x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
498
|
+
(m - Integer(1)))*jacobi_dn(x, m)*jacobi_cn(x, m)/m) *
|
|
499
|
+
jacobi_cn(x, m)/jacobi_sn(x, m)**Integer(2) +
|
|
500
|
+
HALF*(jacobi_sn(x, m)**Integer(2)*jacobi_cn(x, m)/(m - Integer(1)) -
|
|
501
|
+
(x + elliptic_e(arcsin(jacobi_sn(x, m)), m) /
|
|
502
|
+
(m - Integer(1)))*jacobi_dn(x, m)*jacobi_sn(x, m)/m) /
|
|
503
|
+
jacobi_sn(x, m))
|
|
504
|
+
|
|
505
|
+
def _latex_(self):
|
|
506
|
+
r"""
|
|
507
|
+
TESTS::
|
|
508
|
+
|
|
509
|
+
sage: latex(jacobi_sn)
|
|
510
|
+
\operatorname{sn}
|
|
511
|
+
"""
|
|
512
|
+
return r"\operatorname{{{}}}".format(self.kind)
|
|
513
|
+
|
|
514
|
+
def _print_latex_(self, x, m):
|
|
515
|
+
r"""
|
|
516
|
+
TESTS::
|
|
517
|
+
|
|
518
|
+
sage: latex(jacobi_sn(x, 3)) # needs sage.symbolic
|
|
519
|
+
\operatorname{sn}\left(x\middle|3\right)
|
|
520
|
+
"""
|
|
521
|
+
return r"\operatorname{{{}}}\left({}\middle|{}\right)".format(self.kind,
|
|
522
|
+
latex(x),
|
|
523
|
+
latex(m))
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
jacobi_nd = Jacobi('nd')
|
|
527
|
+
jacobi_ns = Jacobi('ns')
|
|
528
|
+
jacobi_nc = Jacobi('nc')
|
|
529
|
+
jacobi_dn = Jacobi('dn')
|
|
530
|
+
jacobi_ds = Jacobi('ds')
|
|
531
|
+
jacobi_dc = Jacobi('dc')
|
|
532
|
+
jacobi_sn = Jacobi('sn')
|
|
533
|
+
jacobi_sd = Jacobi('sd')
|
|
534
|
+
jacobi_sc = Jacobi('sc')
|
|
535
|
+
jacobi_cn = Jacobi('cn')
|
|
536
|
+
jacobi_cd = Jacobi('cd')
|
|
537
|
+
jacobi_cs = Jacobi('cs')
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
class InverseJacobi(BuiltinFunction):
|
|
541
|
+
r"""
|
|
542
|
+
Base class for the inverse Jacobi elliptic functions.
|
|
543
|
+
"""
|
|
544
|
+
def __init__(self, kind):
|
|
545
|
+
r"""
|
|
546
|
+
Initialize ``self``.
|
|
547
|
+
|
|
548
|
+
EXAMPLES::
|
|
549
|
+
|
|
550
|
+
sage: from sage.functions.jacobi import InverseJacobi
|
|
551
|
+
sage: InverseJacobi('sn')
|
|
552
|
+
inverse_jacobi_sn
|
|
553
|
+
"""
|
|
554
|
+
if kind not in ['nd', 'ns', 'nc', 'dn', 'ds', 'dc', 'sn', 'sd',
|
|
555
|
+
'sc', 'cn', 'cd', 'cs']:
|
|
556
|
+
raise ValueError("kind must be one of 'nd', 'ns', 'nc', 'dn', "
|
|
557
|
+
"'ds', 'dc', 'sn', 'sd', 'sc', 'cn', 'cd', 'cs'.")
|
|
558
|
+
self.kind = kind
|
|
559
|
+
BuiltinFunction.__init__(self,
|
|
560
|
+
name=f'inverse_jacobi_{kind}', nargs=2, evalf_params_first=False,
|
|
561
|
+
conversions=dict(maple=('InverseJacobi{}'.format(kind.upper())),
|
|
562
|
+
mathematica=f'InverseJacobi{kind.upper()}',
|
|
563
|
+
maxima=(f'inverse_jacobi_{kind}')))
|
|
564
|
+
|
|
565
|
+
def _eval_(self, x, m):
|
|
566
|
+
r"""
|
|
567
|
+
TESTS:
|
|
568
|
+
|
|
569
|
+
Check that the simplifications are correct::
|
|
570
|
+
|
|
571
|
+
sage: # needs mpmath sage.symbolic
|
|
572
|
+
sage: from mpmath import almosteq
|
|
573
|
+
sage: almosteq(n(inverse_jacobi_cd(1, -8, hold=True)),
|
|
574
|
+
....: n(inverse_jacobi_cd(1, -8)))
|
|
575
|
+
True
|
|
576
|
+
sage: almosteq(n(inverse_jacobi_cn(0, -5, hold=True)),
|
|
577
|
+
....: n(inverse_jacobi_cn(0, -5)))
|
|
578
|
+
True
|
|
579
|
+
sage: almosteq(n(inverse_jacobi_cn(1, -8, hold=True)),
|
|
580
|
+
....: n(inverse_jacobi_cn(1, -8)))
|
|
581
|
+
True
|
|
582
|
+
sage: almosteq(n(inverse_jacobi_cs(7, 1, hold=True)),
|
|
583
|
+
....: n(inverse_jacobi_cs(7, 1)))
|
|
584
|
+
True
|
|
585
|
+
sage: almosteq(n(inverse_jacobi_dc(3, 0, hold=True)),
|
|
586
|
+
....: n(inverse_jacobi_dc(3, 0)))
|
|
587
|
+
True
|
|
588
|
+
sage: almosteq(n(inverse_jacobi_dc(1, 7, hold=True)),
|
|
589
|
+
....: n(inverse_jacobi_dc(1, 7)))
|
|
590
|
+
True
|
|
591
|
+
sage: almosteq(n(inverse_jacobi_dn(1, -1, hold=True)),
|
|
592
|
+
....: n(inverse_jacobi_dn(1, -1)))
|
|
593
|
+
True
|
|
594
|
+
sage: almosteq(n(inverse_jacobi_ds(7, 0, hold=True)),
|
|
595
|
+
....: n(inverse_jacobi_ds(7, 0)))
|
|
596
|
+
True
|
|
597
|
+
sage: almosteq(n(inverse_jacobi_ds(5, 1, hold=True)),
|
|
598
|
+
....: n(inverse_jacobi_ds(5, 1)))
|
|
599
|
+
True
|
|
600
|
+
sage: almosteq(n(inverse_jacobi_nc(-2, 0, hold=True)),
|
|
601
|
+
....: n(inverse_jacobi_nc(-2, 0)))
|
|
602
|
+
True
|
|
603
|
+
sage: almosteq(n(inverse_jacobi_nc(-1, 1, hold=True)),
|
|
604
|
+
....: n(inverse_jacobi_nc(-1, 1)))
|
|
605
|
+
True
|
|
606
|
+
sage: almosteq(n(inverse_jacobi_nc(1, 4, hold=True)),
|
|
607
|
+
....: n(inverse_jacobi_nc(1, 4)))
|
|
608
|
+
True
|
|
609
|
+
sage: almosteq(n(inverse_jacobi_nd(9, 1, hold=True)),
|
|
610
|
+
....: n(inverse_jacobi_nd(9, 1)))
|
|
611
|
+
True
|
|
612
|
+
sage: almosteq(n(inverse_jacobi_nd(1, -9, hold=True)),
|
|
613
|
+
....: n(inverse_jacobi_nd(1, -9)))
|
|
614
|
+
True
|
|
615
|
+
sage: almosteq(n(inverse_jacobi_ns(-6, 0, hold=True)),
|
|
616
|
+
....: n(inverse_jacobi_ns(-6, 0)))
|
|
617
|
+
True
|
|
618
|
+
sage: almosteq(n(inverse_jacobi_ns(6, 1, hold=True)),
|
|
619
|
+
....: n(inverse_jacobi_ns(6, 1)))
|
|
620
|
+
True
|
|
621
|
+
sage: almosteq(n(inverse_jacobi_sc(9, 0, hold=True)),
|
|
622
|
+
....: n(inverse_jacobi_sc(9, 0)))
|
|
623
|
+
True
|
|
624
|
+
sage: almosteq(n(inverse_jacobi_sc(8, 1, hold=True)),
|
|
625
|
+
....: n(inverse_jacobi_sc(8, 1)))
|
|
626
|
+
True
|
|
627
|
+
sage: almosteq(n(inverse_jacobi_sc(0, -8, hold=True)),
|
|
628
|
+
....: n(inverse_jacobi_sc(0, -8)))
|
|
629
|
+
True
|
|
630
|
+
sage: almosteq(n(inverse_jacobi_sd(-1, 0, hold=True)),
|
|
631
|
+
....: n(inverse_jacobi_sd(-1, 0)))
|
|
632
|
+
True
|
|
633
|
+
sage: almosteq(n(inverse_jacobi_sd(-2, 1, hold=True)),
|
|
634
|
+
....: n(inverse_jacobi_sd(-2, 1)))
|
|
635
|
+
True
|
|
636
|
+
sage: almosteq(n(inverse_jacobi_sd(0, -2, hold=True)),
|
|
637
|
+
....: n(inverse_jacobi_sd(0, -2)))
|
|
638
|
+
True
|
|
639
|
+
sage: almosteq(n(inverse_jacobi_sn(0, 0, hold=True)),
|
|
640
|
+
....: n(inverse_jacobi_sn(0, 0)))
|
|
641
|
+
True
|
|
642
|
+
sage: almosteq(n(inverse_jacobi_sn(0, 6, hold=True)),
|
|
643
|
+
....: n(inverse_jacobi_sn(0, 6)))
|
|
644
|
+
True
|
|
645
|
+
"""
|
|
646
|
+
if self.kind == 'cd':
|
|
647
|
+
if m == 0:
|
|
648
|
+
return arccos(x)
|
|
649
|
+
elif x == 1:
|
|
650
|
+
return Integer(0)
|
|
651
|
+
elif self.kind == 'cn':
|
|
652
|
+
if m == 0:
|
|
653
|
+
return arccos(x)
|
|
654
|
+
elif m == 1:
|
|
655
|
+
return arcsech(x)
|
|
656
|
+
elif x == 0:
|
|
657
|
+
return elliptic_kc(m)
|
|
658
|
+
elif x == 1:
|
|
659
|
+
return Integer(0)
|
|
660
|
+
elif self.kind == 'cs':
|
|
661
|
+
if m == 0:
|
|
662
|
+
return arccot(x)
|
|
663
|
+
elif m == 1:
|
|
664
|
+
return arccsch(x)
|
|
665
|
+
elif self.kind == 'dc':
|
|
666
|
+
if m == 0:
|
|
667
|
+
return arcsec(x)
|
|
668
|
+
elif x == 1:
|
|
669
|
+
return Integer(0)
|
|
670
|
+
elif self.kind == 'dn':
|
|
671
|
+
if m == 1:
|
|
672
|
+
return arcsech(x)
|
|
673
|
+
elif x == 1:
|
|
674
|
+
return Integer(0)
|
|
675
|
+
elif self.kind == 'ds':
|
|
676
|
+
if m == 0:
|
|
677
|
+
return arccsc(x)
|
|
678
|
+
elif m == 1:
|
|
679
|
+
return arccsch(x)
|
|
680
|
+
elif self.kind == 'nc':
|
|
681
|
+
if m == 0:
|
|
682
|
+
return arcsec(x)
|
|
683
|
+
elif m == 1:
|
|
684
|
+
return arccosh(x)
|
|
685
|
+
elif x == 1:
|
|
686
|
+
return Integer(0)
|
|
687
|
+
elif self.kind == 'nd':
|
|
688
|
+
if m == 1:
|
|
689
|
+
return arccosh(x)
|
|
690
|
+
elif x == 1:
|
|
691
|
+
return Integer(0)
|
|
692
|
+
elif self.kind == 'ns':
|
|
693
|
+
if m == 0:
|
|
694
|
+
return arccsc(x)
|
|
695
|
+
elif m == 1:
|
|
696
|
+
return arccoth(x)
|
|
697
|
+
elif self.kind == 'sc':
|
|
698
|
+
if m == 0:
|
|
699
|
+
return arctan(x)
|
|
700
|
+
elif m == 1:
|
|
701
|
+
return arcsinh(x)
|
|
702
|
+
elif x == 0:
|
|
703
|
+
return Integer(0)
|
|
704
|
+
elif self.kind == 'sd':
|
|
705
|
+
if m == 0:
|
|
706
|
+
return arcsin(x)
|
|
707
|
+
elif m == 1:
|
|
708
|
+
return arcsinh(x)
|
|
709
|
+
elif x == 0:
|
|
710
|
+
return Integer(0)
|
|
711
|
+
elif self.kind == 'sn':
|
|
712
|
+
if m == 0:
|
|
713
|
+
return arcsin(x)
|
|
714
|
+
elif m == 1:
|
|
715
|
+
return arctanh(x)
|
|
716
|
+
elif x == 0:
|
|
717
|
+
return Integer(0)
|
|
718
|
+
return
|
|
719
|
+
|
|
720
|
+
def _evalf_(self, x, m, parent=None, algorithm=None):
|
|
721
|
+
r"""
|
|
722
|
+
TESTS::
|
|
723
|
+
|
|
724
|
+
sage: inverse_jacobi_cn(2, 3).n() # needs mpmath
|
|
725
|
+
0.859663746362987*I
|
|
726
|
+
sage: inverse_jacobi_cd(3, 4).n(100) # needs mpmath
|
|
727
|
+
-0.67214752201235862490069823239 + 2.1565156474996432354386749988*I
|
|
728
|
+
"""
|
|
729
|
+
return _mpmath_utils_call(inverse_jacobi_f, self.kind, x, m, parent=parent)
|
|
730
|
+
|
|
731
|
+
def _derivative_(self, x, m, diff_param):
|
|
732
|
+
r"""
|
|
733
|
+
TESTS:
|
|
734
|
+
|
|
735
|
+
Check that ``dy/dx * dx/dy == 1``, where ``y = jacobi_pq(x, m)`` and
|
|
736
|
+
``x = inverse_jacobi_pq(y, m)``::
|
|
737
|
+
|
|
738
|
+
sage: # needs mpmath sage.symbolic
|
|
739
|
+
sage: from mpmath import almosteq
|
|
740
|
+
sage: a = 0.130103220857094
|
|
741
|
+
sage: b = 0.437176765041986
|
|
742
|
+
sage: m = var('m')
|
|
743
|
+
sage: almosteq(abs((diff(jacobi_cd(x, m), x) *
|
|
744
|
+
....: diff(inverse_jacobi_cd(x, m), x).subs(x=jacobi_cd(x, m))).subs(x=a, m=b)),
|
|
745
|
+
....: 1, abs_eps=1e-14)
|
|
746
|
+
True
|
|
747
|
+
sage: almosteq(abs((diff(jacobi_cn(x, m), x) *
|
|
748
|
+
....: diff(inverse_jacobi_cn(x, m), x).subs(x=jacobi_cn(x, m))).subs(x=a, m=b)),
|
|
749
|
+
....: 1, abs_eps=1e-14)
|
|
750
|
+
True
|
|
751
|
+
sage: almosteq(abs((diff(jacobi_cs(x, m), x) *
|
|
752
|
+
....: diff(inverse_jacobi_cs(x, m), x).subs(x=jacobi_cs(x, m))).subs(x=a, m=b)),
|
|
753
|
+
....: 1, abs_eps=1e-14)
|
|
754
|
+
True
|
|
755
|
+
sage: almosteq(abs((diff(jacobi_dc(x, m), x) *
|
|
756
|
+
....: diff(inverse_jacobi_dc(x, m), x).subs(x=jacobi_dc(x, m))).subs(x=a, m=b)),
|
|
757
|
+
....: 1, abs_eps=1e-14)
|
|
758
|
+
True
|
|
759
|
+
sage: almosteq(abs((diff(jacobi_dn(x, m), x) *
|
|
760
|
+
....: diff(inverse_jacobi_dn(x, m), x).subs(x=jacobi_dn(x, m))).subs(x=a, m=b)),
|
|
761
|
+
....: 1, abs_eps=1e-14)
|
|
762
|
+
True
|
|
763
|
+
sage: almosteq(abs((diff(jacobi_ds(x, m), x) *
|
|
764
|
+
....: diff(inverse_jacobi_ds(x, m), x).subs(x=jacobi_ds(x, m))).subs(x=a, m=b)),
|
|
765
|
+
....: 1, abs_eps=1e-14)
|
|
766
|
+
True
|
|
767
|
+
sage: almosteq(abs((diff(jacobi_nc(x, m), x) *
|
|
768
|
+
....: diff(inverse_jacobi_nc(x, m), x).subs(x=jacobi_nc(x, m))).subs(x=a, m=b)),
|
|
769
|
+
....: 1, abs_eps=1e-14)
|
|
770
|
+
True
|
|
771
|
+
sage: almosteq(abs((diff(jacobi_nd(x, m), x) *
|
|
772
|
+
....: diff(inverse_jacobi_nd(x, m), x).subs(x=jacobi_nd(x, m))).subs(x=a, m=b)),
|
|
773
|
+
....: 1, abs_eps=1e-14)
|
|
774
|
+
True
|
|
775
|
+
sage: almosteq(abs((diff(jacobi_ns(x, m), x) *
|
|
776
|
+
....: diff(inverse_jacobi_ns(x, m), x).subs(x=jacobi_ns(x, m))).subs(x=a, m=b)),
|
|
777
|
+
....: 1, abs_eps=1e-14)
|
|
778
|
+
True
|
|
779
|
+
sage: almosteq(abs((diff(jacobi_sc(x, m), x) *
|
|
780
|
+
....: diff(inverse_jacobi_sc(x, m), x).subs(x=jacobi_sc(x, m))).subs(x=a, m=b)),
|
|
781
|
+
....: 1, abs_eps=1e-14)
|
|
782
|
+
True
|
|
783
|
+
sage: almosteq(abs((diff(jacobi_sd(x, m), x) *
|
|
784
|
+
....: diff(inverse_jacobi_sd(x, m), x).subs(x=jacobi_sd(x, m))).subs(x=a, m=b)),
|
|
785
|
+
....: 1, abs_eps=1e-14)
|
|
786
|
+
True
|
|
787
|
+
sage: almosteq(abs((diff(jacobi_sn(x, m), x) *
|
|
788
|
+
....: diff(inverse_jacobi_sn(x, m), x).subs(x=jacobi_sn(x, m))).subs(x=a, m=b)),
|
|
789
|
+
....: 1, abs_eps=1e-14)
|
|
790
|
+
True
|
|
791
|
+
"""
|
|
792
|
+
# From Wolfram Functions Site
|
|
793
|
+
if diff_param == 0:
|
|
794
|
+
if self.kind == 'cd':
|
|
795
|
+
return (jacobi_sn(inverse_jacobi_cd(x, m), m) /
|
|
796
|
+
(x ** Integer(2) - Integer(1)))
|
|
797
|
+
elif self.kind == 'cn':
|
|
798
|
+
return (jacobi_ds(inverse_jacobi_cn(x, m), m) /
|
|
799
|
+
(m * x ** Integer(2) - m + Integer(1)))
|
|
800
|
+
elif self.kind == 'cs':
|
|
801
|
+
return (jacobi_nd(inverse_jacobi_cs(x, m), m) /
|
|
802
|
+
(x ** Integer(2) + Integer(1)))
|
|
803
|
+
elif self.kind == 'dc':
|
|
804
|
+
return (jacobi_sn(inverse_jacobi_dc(x, m), m) /
|
|
805
|
+
(x ** Integer(2) - Integer(1)))
|
|
806
|
+
elif self.kind == 'dn':
|
|
807
|
+
return -(jacobi_cs(inverse_jacobi_dn(x, m), m) /
|
|
808
|
+
(x ** Integer(2) + m - Integer(1)))
|
|
809
|
+
elif self.kind == 'ds':
|
|
810
|
+
return (jacobi_nc(inverse_jacobi_ds(x, m), m) /
|
|
811
|
+
(x ** Integer(2) + m))
|
|
812
|
+
elif self.kind == 'nc':
|
|
813
|
+
return (jacobi_ds(inverse_jacobi_nc(x, m), m) /
|
|
814
|
+
(-m * x ** Integer(2) + x ** Integer(2) + m))
|
|
815
|
+
elif self.kind == 'nd':
|
|
816
|
+
return (jacobi_sc(inverse_jacobi_nd(x, m), m) /
|
|
817
|
+
(x ** Integer(2) - Integer(1)))
|
|
818
|
+
elif self.kind == 'ns':
|
|
819
|
+
return Integer(1) / (jacobi_cs(inverse_jacobi_ns(x, m), m) *
|
|
820
|
+
jacobi_ds(inverse_jacobi_ns(x, m), m))
|
|
821
|
+
elif self.kind == 'sc':
|
|
822
|
+
return (jacobi_nd(inverse_jacobi_sc(x, m), m) /
|
|
823
|
+
(x ** Integer(2) + Integer(1)))
|
|
824
|
+
elif self.kind == 'sd':
|
|
825
|
+
return (jacobi_cn(inverse_jacobi_sd(x, m), m) /
|
|
826
|
+
((m - Integer(1)) * x ** Integer(2) + Integer(1)))
|
|
827
|
+
elif self.kind == 'sn':
|
|
828
|
+
return (jacobi_cd(inverse_jacobi_sn(x, m), m) /
|
|
829
|
+
(Integer(1) - x ** Integer(2)))
|
|
830
|
+
elif diff_param == 1:
|
|
831
|
+
if self.kind == 'cd':
|
|
832
|
+
return ((Integer(1) / (Integer(2) * (Integer(1) - m) * m)) *
|
|
833
|
+
((m - Integer(1)) * inverse_jacobi_cd(x, m) +
|
|
834
|
+
elliptic_e(jacobi_am(inverse_jacobi_cd(x, m), m),
|
|
835
|
+
m)))
|
|
836
|
+
elif self.kind == 'cn':
|
|
837
|
+
return ((-(Integer(1) / (Integer(2) * (-Integer(1) + m) * m))) *
|
|
838
|
+
(elliptic_e(jacobi_am(inverse_jacobi_cn(x, m), m),
|
|
839
|
+
m) + (-Integer(1) + m) *
|
|
840
|
+
inverse_jacobi_cn(x, m) - m * x *
|
|
841
|
+
jacobi_sd(inverse_jacobi_cn(x, m), m)))
|
|
842
|
+
elif self.kind == 'cs':
|
|
843
|
+
return ((-(Integer(1) / (Integer(2) * (-Integer(1) + m) * m * (Integer(1) + x ** Integer(2))))) *
|
|
844
|
+
((Integer(1) + x ** Integer(2)) *
|
|
845
|
+
elliptic_e(jacobi_am(inverse_jacobi_cs(x, m), m),
|
|
846
|
+
m) + (-Integer(1) + m) * (Integer(1) + x ** Integer(2)) *
|
|
847
|
+
inverse_jacobi_cs(x, m) - m * x *
|
|
848
|
+
jacobi_nd(inverse_jacobi_cs(x, m), m)))
|
|
849
|
+
elif self.kind == 'dc':
|
|
850
|
+
return ((Integer(1) / (Integer(2) * (Integer(1) - m) * m)) *
|
|
851
|
+
(elliptic_e(jacobi_am(inverse_jacobi_dc(x, m), m),
|
|
852
|
+
m) - (Integer(1) - m) *
|
|
853
|
+
inverse_jacobi_dc(x, m)))
|
|
854
|
+
elif self.kind == 'dn':
|
|
855
|
+
return ((Integer(1) / (Integer(2) * (Integer(1) - m) * m)) * ((m - Integer(1)) *
|
|
856
|
+
inverse_jacobi_dn(x, m) +
|
|
857
|
+
elliptic_e(jacobi_am(inverse_jacobi_dn(x, m), m), m) -
|
|
858
|
+
x * jacobi_sc(inverse_jacobi_dn(x, m), m)))
|
|
859
|
+
elif self.kind == 'ds':
|
|
860
|
+
return ((-(Integer(1) / (Integer(2) * (-Integer(1) + m) * m))) *
|
|
861
|
+
(elliptic_e(jacobi_am(inverse_jacobi_ds(x, m), m), m) +
|
|
862
|
+
(-Integer(1) + m) * inverse_jacobi_ds(x, m) -
|
|
863
|
+
(m * x * jacobi_nc(inverse_jacobi_ds(x, m), m)) /
|
|
864
|
+
(m + x ** Integer(2))))
|
|
865
|
+
elif self.kind == 'nc':
|
|
866
|
+
return ((Integer(1) / (Integer(2) * (-Integer(1) + m) * m * x)) * ((-x) *
|
|
867
|
+
(elliptic_e(jacobi_am(inverse_jacobi_nc(x, m), m), m) +
|
|
868
|
+
(-Integer(1) + m) * inverse_jacobi_nc(x, m)) + m *
|
|
869
|
+
jacobi_sd(inverse_jacobi_nc(x, m), m)))
|
|
870
|
+
elif self.kind == 'nd':
|
|
871
|
+
return ((Integer(1) / (Integer(2) * (m - Integer(1)) * m)) *
|
|
872
|
+
((Integer(1) - m) * inverse_jacobi_nd(x, m) -
|
|
873
|
+
elliptic_e(jacobi_am(inverse_jacobi_nd(x, m), m), m) +
|
|
874
|
+
(Integer(1) / x) * jacobi_sc(inverse_jacobi_nd(x, m), m)))
|
|
875
|
+
elif self.kind == 'ns':
|
|
876
|
+
return ((Integer(1)/(Integer(2) * (m - Integer(1)) * m)) *
|
|
877
|
+
((Integer(1) - m) * inverse_jacobi_ns(x, m) -
|
|
878
|
+
elliptic_e(jacobi_am(inverse_jacobi_ns(x, m), m), m) +
|
|
879
|
+
(m / x) * jacobi_cd(inverse_jacobi_ns(x, m), m)))
|
|
880
|
+
elif self.kind == 'sc':
|
|
881
|
+
return ((-(Integer(1) / (Integer(2) * (-Integer(1) + m) * m * (Integer(1) + x ** Integer(2))))) *
|
|
882
|
+
((Integer(1) + x ** Integer(2)) *
|
|
883
|
+
elliptic_e(jacobi_am(inverse_jacobi_sc(x, m), m), m) +
|
|
884
|
+
(-Integer(1) + m) * (Integer(1) + x ** Integer(2)) * inverse_jacobi_sc(x, m) -
|
|
885
|
+
m * x * jacobi_nd(inverse_jacobi_sc(x, m), m)))
|
|
886
|
+
elif self.kind == 'sd':
|
|
887
|
+
return ((-(Integer(1) / (Integer(2) * (-Integer(1) + m) * m))) *
|
|
888
|
+
(elliptic_e(jacobi_am(inverse_jacobi_sd(x, m), m), m) +
|
|
889
|
+
(-Integer(1) + m) * inverse_jacobi_sd(x, m) -
|
|
890
|
+
(m * x * jacobi_nc(inverse_jacobi_sd(x, m), m)) /
|
|
891
|
+
(Integer(1) + m * x ** Integer(2))))
|
|
892
|
+
elif self.kind == 'sn':
|
|
893
|
+
return ((Integer(1) / (Integer(2) * (Integer(1) - m) * m)) *
|
|
894
|
+
(elliptic_e(jacobi_am(inverse_jacobi_sn(x, m), m), m) +
|
|
895
|
+
(-Integer(1) + m) * inverse_jacobi_sn(x, m) - m * x *
|
|
896
|
+
jacobi_cd(inverse_jacobi_sn(x, m), m)))
|
|
897
|
+
|
|
898
|
+
def _latex_(self):
|
|
899
|
+
r"""
|
|
900
|
+
TESTS::
|
|
901
|
+
|
|
902
|
+
sage: latex(inverse_jacobi_dn)
|
|
903
|
+
\operatorname{arcdn}
|
|
904
|
+
"""
|
|
905
|
+
return r"\operatorname{{arc{}}}".format(self.kind)
|
|
906
|
+
|
|
907
|
+
def _print_latex_(self, x, m):
|
|
908
|
+
r"""
|
|
909
|
+
TESTS::
|
|
910
|
+
|
|
911
|
+
sage: latex(inverse_jacobi_dn(x, 3)) # needs sage.symbolic
|
|
912
|
+
\operatorname{arcdn}\left(x\middle|3\right)
|
|
913
|
+
"""
|
|
914
|
+
return r"\operatorname{{arc{}}}\left({}\middle|{}\right)".format(self.kind,
|
|
915
|
+
latex(x),
|
|
916
|
+
latex(m))
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
inverse_jacobi_nd = InverseJacobi('nd')
|
|
920
|
+
inverse_jacobi_ns = InverseJacobi('ns')
|
|
921
|
+
inverse_jacobi_nc = InverseJacobi('nc')
|
|
922
|
+
inverse_jacobi_dn = InverseJacobi('dn')
|
|
923
|
+
inverse_jacobi_ds = InverseJacobi('ds')
|
|
924
|
+
inverse_jacobi_dc = InverseJacobi('dc')
|
|
925
|
+
inverse_jacobi_sn = InverseJacobi('sn')
|
|
926
|
+
inverse_jacobi_sd = InverseJacobi('sd')
|
|
927
|
+
inverse_jacobi_sc = InverseJacobi('sc')
|
|
928
|
+
inverse_jacobi_cn = InverseJacobi('cn')
|
|
929
|
+
inverse_jacobi_cd = InverseJacobi('cd')
|
|
930
|
+
inverse_jacobi_cs = InverseJacobi('cs')
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
def jacobi(kind, z, m, **kwargs):
|
|
934
|
+
r"""
|
|
935
|
+
The 12 Jacobi elliptic functions.
|
|
936
|
+
|
|
937
|
+
INPUT:
|
|
938
|
+
|
|
939
|
+
- ``kind`` -- string of the form ``'pq'``, where ``p``, ``q`` are in
|
|
940
|
+
``c``, ``d``, ``n``, ``s``
|
|
941
|
+
- ``z`` -- a complex number
|
|
942
|
+
- ``m`` -- a complex number; note that `m = k^2`, where `k` is
|
|
943
|
+
the elliptic modulus
|
|
944
|
+
|
|
945
|
+
EXAMPLES::
|
|
946
|
+
|
|
947
|
+
sage: # needs mpmath
|
|
948
|
+
sage: jacobi('sn', 1, 1)
|
|
949
|
+
tanh(1)
|
|
950
|
+
sage: jacobi('cd', 1, 1/2)
|
|
951
|
+
jacobi_cd(1, 1/2)
|
|
952
|
+
sage: RDF(jacobi('cd', 1, 1/2))
|
|
953
|
+
0.7240097216593705
|
|
954
|
+
sage: (RDF(jacobi('cn', 1, 1/2)), RDF(jacobi('dn', 1, 1/2)),
|
|
955
|
+
....: RDF(jacobi('cn', 1, 1/2) / jacobi('dn', 1, 1/2)))
|
|
956
|
+
(0.5959765676721407, 0.8231610016315962, 0.7240097216593705)
|
|
957
|
+
|
|
958
|
+
sage: jsn = jacobi('sn', x, 1) # needs sage.symbolic
|
|
959
|
+
sage: P = plot(jsn, 0, 1) # needs sage.plot sage.symbolic
|
|
960
|
+
"""
|
|
961
|
+
if kind == 'nd':
|
|
962
|
+
return jacobi_nd(z, m, **kwargs)
|
|
963
|
+
elif kind == 'ns':
|
|
964
|
+
return jacobi_ns(z, m, **kwargs)
|
|
965
|
+
elif kind == 'nc':
|
|
966
|
+
return jacobi_nc(z, m, **kwargs)
|
|
967
|
+
elif kind == 'dn':
|
|
968
|
+
return jacobi_dn(z, m, **kwargs)
|
|
969
|
+
elif kind == 'ds':
|
|
970
|
+
return jacobi_ds(z, m, **kwargs)
|
|
971
|
+
elif kind == 'dc':
|
|
972
|
+
return jacobi_dc(z, m, **kwargs)
|
|
973
|
+
elif kind == 'sn':
|
|
974
|
+
return jacobi_sn(z, m, **kwargs)
|
|
975
|
+
elif kind == 'sd':
|
|
976
|
+
return jacobi_sd(z, m, **kwargs)
|
|
977
|
+
elif kind == 'sc':
|
|
978
|
+
return jacobi_sc(z, m, **kwargs)
|
|
979
|
+
elif kind == 'cn':
|
|
980
|
+
return jacobi_cn(z, m, **kwargs)
|
|
981
|
+
elif kind == 'cd':
|
|
982
|
+
return jacobi_cd(z, m, **kwargs)
|
|
983
|
+
elif kind == 'cs':
|
|
984
|
+
return jacobi_cs(z, m, **kwargs)
|
|
985
|
+
else:
|
|
986
|
+
raise ValueError("kind must be one of 'nd', 'ns', 'nc', 'dn', "
|
|
987
|
+
"'ds', 'dc', 'sn', 'sd', 'sc', 'cn', 'cd', 'cs'.")
|
|
988
|
+
|
|
989
|
+
|
|
990
|
+
def inverse_jacobi(kind, x, m, **kwargs):
|
|
991
|
+
r"""
|
|
992
|
+
The inverses of the 12 Jacobi elliptic functions. They have the property
|
|
993
|
+
that
|
|
994
|
+
|
|
995
|
+
.. MATH::
|
|
996
|
+
|
|
997
|
+
\operatorname{pq}(\operatorname{arcpq}(x|m)|m) =
|
|
998
|
+
\operatorname{pq}(\operatorname{pq}^{-1}(x|m)|m) = x.
|
|
999
|
+
|
|
1000
|
+
INPUT:
|
|
1001
|
+
|
|
1002
|
+
- ``kind`` -- string of the form ``'pq'``, where ``p``, ``q`` are in
|
|
1003
|
+
``c``, ``d``, ``n``, ``s``
|
|
1004
|
+
- ``x`` -- a real number
|
|
1005
|
+
- ``m`` -- a real number; note that `m = k^2`, where `k` is the elliptic
|
|
1006
|
+
modulus
|
|
1007
|
+
|
|
1008
|
+
EXAMPLES::
|
|
1009
|
+
|
|
1010
|
+
sage: jacobi('dn', inverse_jacobi('dn', 3, 0.4), 0.4) # needs mpmath
|
|
1011
|
+
3.00000000000000
|
|
1012
|
+
sage: inverse_jacobi('dn', 10, 1/10).n(digits=50) # needs mpmath
|
|
1013
|
+
2.4777736267904273296523691232988240759001423661683*I
|
|
1014
|
+
sage: inverse_jacobi_dn(x, 1) # needs sage.symbolic
|
|
1015
|
+
arcsech(x)
|
|
1016
|
+
sage: inverse_jacobi_dn(1, 3) # needs mpmath
|
|
1017
|
+
0
|
|
1018
|
+
|
|
1019
|
+
sage: # needs sage.symbolic
|
|
1020
|
+
sage: m = var('m')
|
|
1021
|
+
sage: z = inverse_jacobi_dn(x, m).series(x, 4).subs(x=0.1, m=0.7)
|
|
1022
|
+
sage: jacobi_dn(z, 0.7)
|
|
1023
|
+
0.0999892750039819...
|
|
1024
|
+
sage: inverse_jacobi_nd(x, 1)
|
|
1025
|
+
arccosh(x)
|
|
1026
|
+
|
|
1027
|
+
sage: # needs mpmath
|
|
1028
|
+
sage: inverse_jacobi_nd(1, 2)
|
|
1029
|
+
0
|
|
1030
|
+
sage: inverse_jacobi_ns(10^-5, 3).n()
|
|
1031
|
+
5.77350269202456e-6 + 1.17142008414677*I
|
|
1032
|
+
sage: jacobi('sn', 1/2, 1/2)
|
|
1033
|
+
jacobi_sn(1/2, 1/2)
|
|
1034
|
+
sage: jacobi('sn', 1/2, 1/2).n()
|
|
1035
|
+
0.470750473655657
|
|
1036
|
+
sage: inverse_jacobi('sn', 0.47, 1/2)
|
|
1037
|
+
0.499098231322220
|
|
1038
|
+
sage: inverse_jacobi('sn', 0.4707504, 0.5)
|
|
1039
|
+
0.499999911466555
|
|
1040
|
+
sage: P = plot(inverse_jacobi('sn', x, 0.5), 0, 1) # needs sage.plot
|
|
1041
|
+
"""
|
|
1042
|
+
if kind == 'nd':
|
|
1043
|
+
return inverse_jacobi_nd(x, m, **kwargs)
|
|
1044
|
+
elif kind == 'ns':
|
|
1045
|
+
return inverse_jacobi_ns(x, m, **kwargs)
|
|
1046
|
+
elif kind == 'nc':
|
|
1047
|
+
return inverse_jacobi_nc(x, m, **kwargs)
|
|
1048
|
+
elif kind == 'dn':
|
|
1049
|
+
return inverse_jacobi_dn(x, m, **kwargs)
|
|
1050
|
+
elif kind == 'ds':
|
|
1051
|
+
return inverse_jacobi_ds(x, m, **kwargs)
|
|
1052
|
+
elif kind == 'dc':
|
|
1053
|
+
return inverse_jacobi_dc(x, m, **kwargs)
|
|
1054
|
+
elif kind == 'sn':
|
|
1055
|
+
return inverse_jacobi_sn(x, m, **kwargs)
|
|
1056
|
+
elif kind == 'sd':
|
|
1057
|
+
return inverse_jacobi_sd(x, m, **kwargs)
|
|
1058
|
+
elif kind == 'sc':
|
|
1059
|
+
return inverse_jacobi_sc(x, m, **kwargs)
|
|
1060
|
+
elif kind == 'cn':
|
|
1061
|
+
return inverse_jacobi_cn(x, m, **kwargs)
|
|
1062
|
+
elif kind == 'cd':
|
|
1063
|
+
return inverse_jacobi_cd(x, m, **kwargs)
|
|
1064
|
+
elif kind == 'cs':
|
|
1065
|
+
return inverse_jacobi_cs(x, m, **kwargs)
|
|
1066
|
+
else:
|
|
1067
|
+
raise ValueError("kind must be one of 'nd', 'ns', 'nc', 'dn', "
|
|
1068
|
+
"'ds', 'dc', 'sn', 'sd', 'sc', 'cn', 'cd', 'cs'.")
|
|
1069
|
+
|
|
1070
|
+
|
|
1071
|
+
class JacobiAmplitude(BuiltinFunction):
|
|
1072
|
+
r"""
|
|
1073
|
+
The Jacobi amplitude function
|
|
1074
|
+
`\operatorname{am}(x|m) = \int_0^x \operatorname{dn}(t|m) dt` for
|
|
1075
|
+
`-K(m) \leq x \leq K(m)`, `F(\operatorname{am}(x|m)|m) = x`.
|
|
1076
|
+
"""
|
|
1077
|
+
def __init__(self):
|
|
1078
|
+
r"""
|
|
1079
|
+
TESTS::
|
|
1080
|
+
|
|
1081
|
+
sage: from sage.functions.jacobi import JacobiAmplitude
|
|
1082
|
+
sage: JacobiAmplitude()
|
|
1083
|
+
jacobi_am
|
|
1084
|
+
"""
|
|
1085
|
+
BuiltinFunction.__init__(self, name='jacobi_am', nargs=2,
|
|
1086
|
+
conversions=dict(maple='JacobiAM',
|
|
1087
|
+
mathematica='JacobiAmplitude'),
|
|
1088
|
+
evalf_params_first=False)
|
|
1089
|
+
|
|
1090
|
+
def _eval_(self, x, m):
|
|
1091
|
+
r"""
|
|
1092
|
+
TESTS::
|
|
1093
|
+
|
|
1094
|
+
sage: jacobi_am(x, 0) # needs sage.symbolic
|
|
1095
|
+
x
|
|
1096
|
+
sage: jacobi_am(0, x) # needs sage.symbolic
|
|
1097
|
+
0
|
|
1098
|
+
sage: jacobi_am(3, 4.) # needs mpmath
|
|
1099
|
+
-0.339059208303591
|
|
1100
|
+
"""
|
|
1101
|
+
if m == 0:
|
|
1102
|
+
return x
|
|
1103
|
+
elif x == 0:
|
|
1104
|
+
return Integer(0)
|
|
1105
|
+
return
|
|
1106
|
+
|
|
1107
|
+
def _evalf_(self, x, m, parent=None, algorithm=None):
|
|
1108
|
+
r"""
|
|
1109
|
+
TESTS::
|
|
1110
|
+
|
|
1111
|
+
sage: jacobi_am(1, 2).n(100) # needs mpmath
|
|
1112
|
+
0.73704379494724574105101929735
|
|
1113
|
+
"""
|
|
1114
|
+
return _mpmath_utils_call(jacobi_am_f, x, m, parent=parent)
|
|
1115
|
+
|
|
1116
|
+
def _derivative_(self, x, m, diff_param):
|
|
1117
|
+
r"""
|
|
1118
|
+
TESTS::
|
|
1119
|
+
|
|
1120
|
+
sage: diff(jacobi_am(x, 3), x) # needs sage.symbolic
|
|
1121
|
+
jacobi_dn(x, 3)
|
|
1122
|
+
sage: diff(jacobi_am(3, x), x) # needs sage.symbolic
|
|
1123
|
+
-1/2*(x*jacobi_cn(3, x)*jacobi_sn(3, x) -...
|
|
1124
|
+
(3*x + elliptic_e(jacobi_am(3, x), x) - 3)*jacobi_dn(3, x))/((x - 1)*x)
|
|
1125
|
+
"""
|
|
1126
|
+
if diff_param == 0:
|
|
1127
|
+
return jacobi_dn(x, m)
|
|
1128
|
+
elif diff_param == 1:
|
|
1129
|
+
return (((Integer(-1) + m) * x + elliptic_e(jacobi_am(x, m), m)) *
|
|
1130
|
+
jacobi('dn', x, m) - m * jacobi('cn', x, m) *
|
|
1131
|
+
jacobi('sn', x, m)) / (Integer(2) * (Integer(-1) + m) * m)
|
|
1132
|
+
|
|
1133
|
+
def _latex_(self):
|
|
1134
|
+
r"""
|
|
1135
|
+
TESTS::
|
|
1136
|
+
|
|
1137
|
+
sage: latex(jacobi_am)
|
|
1138
|
+
\operatorname{am}
|
|
1139
|
+
"""
|
|
1140
|
+
return r"\operatorname{am}"
|
|
1141
|
+
|
|
1142
|
+
def _print_latex_(self, x, m):
|
|
1143
|
+
r"""
|
|
1144
|
+
TESTS::
|
|
1145
|
+
|
|
1146
|
+
sage: latex(jacobi_am(3,x)) # needs sage.symbolic
|
|
1147
|
+
\operatorname{am}\left(3\middle|x\right)
|
|
1148
|
+
"""
|
|
1149
|
+
return r"\operatorname{{am}}\left({}\middle|{}\right)".format(latex(x),
|
|
1150
|
+
latex(m))
|
|
1151
|
+
|
|
1152
|
+
|
|
1153
|
+
jacobi_am = JacobiAmplitude()
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
def inverse_jacobi_f(kind, x, m):
|
|
1157
|
+
r"""
|
|
1158
|
+
Internal function for numerical evaluation of a continuous complex branch
|
|
1159
|
+
of each inverse Jacobi function, as described in [Tee1997]_. Only accepts
|
|
1160
|
+
real arguments.
|
|
1161
|
+
|
|
1162
|
+
TESTS::
|
|
1163
|
+
|
|
1164
|
+
sage: from mpmath import ellipfun, chop # needs mpmath
|
|
1165
|
+
sage: from sage.functions.jacobi import inverse_jacobi_f
|
|
1166
|
+
|
|
1167
|
+
sage: # needs mpmath
|
|
1168
|
+
sage: chop(ellipfun('sn', inverse_jacobi_f('sn', 0.6, 0), 0))
|
|
1169
|
+
mpf('0.59999999999999998')
|
|
1170
|
+
sage: chop(ellipfun('sn', inverse_jacobi_f('sn', 0.6, 1), 1))
|
|
1171
|
+
mpf('0.59999999999999998')
|
|
1172
|
+
sage: chop(ellipfun('sn', inverse_jacobi_f('sn', 0, -3), -3))
|
|
1173
|
+
mpf('0.0')
|
|
1174
|
+
sage: chop(ellipfun('sn', inverse_jacobi_f('sn', -1, 4), 4))
|
|
1175
|
+
mpf('-1.0')
|
|
1176
|
+
sage: chop(ellipfun('sn', inverse_jacobi_f('sn', 0.3, 4), 4))
|
|
1177
|
+
mpf('0.29999999999999999')
|
|
1178
|
+
sage: chop(ellipfun('sn', inverse_jacobi_f('sn', 0.8, 4), 4))
|
|
1179
|
+
mpf('0.80000000000000004')
|
|
1180
|
+
|
|
1181
|
+
sage: # needs mpmath
|
|
1182
|
+
sage: chop(ellipfun('ns', inverse_jacobi_f('ns', 0.8, 0), 0))
|
|
1183
|
+
mpf('0.80000000000000004')
|
|
1184
|
+
sage: chop(ellipfun('ns', inverse_jacobi_f('ns', -0.7, 1), 1))
|
|
1185
|
+
mpf('-0.69999999999999996')
|
|
1186
|
+
sage: chop(ellipfun('ns', inverse_jacobi_f('ns', 0.01, 2), 2))
|
|
1187
|
+
mpf('0.01')
|
|
1188
|
+
sage: chop(ellipfun('ns', inverse_jacobi_f('ns', 0, 2), 2))
|
|
1189
|
+
mpf('0.0')
|
|
1190
|
+
sage: chop(ellipfun('ns', inverse_jacobi_f('ns', -10, 6), 6))
|
|
1191
|
+
mpf('-10.0')
|
|
1192
|
+
|
|
1193
|
+
sage: # needs mpmath
|
|
1194
|
+
sage: chop(ellipfun('cn', inverse_jacobi_f('cn', -10, 0), 0))
|
|
1195
|
+
mpf('-9.9999999999999982')
|
|
1196
|
+
sage: chop(ellipfun('cn', inverse_jacobi_f('cn', 50, 1), 1))
|
|
1197
|
+
mpf('50.000000000000071')
|
|
1198
|
+
sage: chop(ellipfun('cn', inverse_jacobi_f('cn', 1, 5), 5))
|
|
1199
|
+
mpf('1.0')
|
|
1200
|
+
sage: chop(ellipfun('cn', inverse_jacobi_f('cn', 0.5, -5), -5))
|
|
1201
|
+
mpf('0.5')
|
|
1202
|
+
sage: chop(ellipfun('cn', inverse_jacobi_f('cn', -0.75, -15), -15))
|
|
1203
|
+
mpf('-0.75000000000000022')
|
|
1204
|
+
sage: chop(ellipfun('cn', inverse_jacobi_f('cn', 10, 0.8), 0.8))
|
|
1205
|
+
mpf('9.9999999999999982')
|
|
1206
|
+
sage: chop(ellipfun('cn', inverse_jacobi_f('cn', -2, 0.9), 0.9))
|
|
1207
|
+
mpf('-2.0')
|
|
1208
|
+
|
|
1209
|
+
sage: # needs mpmath
|
|
1210
|
+
sage: chop(ellipfun('nc', inverse_jacobi_f('nc', -4, 0), 0))
|
|
1211
|
+
mpf('-3.9999999999999987')
|
|
1212
|
+
sage: chop(ellipfun('nc', inverse_jacobi_f('nc', 7, 1), 1))
|
|
1213
|
+
mpf('7.0000000000000009')
|
|
1214
|
+
sage: chop(ellipfun('nc', inverse_jacobi_f('nc', 7, 3), 3))
|
|
1215
|
+
mpf('7.0')
|
|
1216
|
+
sage: chop(ellipfun('nc', inverse_jacobi_f('nc', 0, 2), 2))
|
|
1217
|
+
mpf('0.0')
|
|
1218
|
+
sage: chop(ellipfun('nc', inverse_jacobi_f('nc', -18, -4), -4))
|
|
1219
|
+
mpf('-17.999999999999925')
|
|
1220
|
+
|
|
1221
|
+
sage: # needs mpmath
|
|
1222
|
+
sage: chop(ellipfun('dn', inverse_jacobi_f('dn', -0.3, 1), 1))
|
|
1223
|
+
mpf('-0.29999999999999999')
|
|
1224
|
+
sage: chop(ellipfun('dn', inverse_jacobi_f('dn', 1, -1), -1))
|
|
1225
|
+
mpf('1.0')
|
|
1226
|
+
sage: chop(ellipfun('dn', inverse_jacobi_f('dn', 0.8, 0.5), 0.5))
|
|
1227
|
+
mpf('0.80000000000000004')
|
|
1228
|
+
sage: chop(ellipfun('dn', inverse_jacobi_f('dn', 5, -4), -4))
|
|
1229
|
+
mpf('5.0')
|
|
1230
|
+
sage: chop(ellipfun('dn', inverse_jacobi_f('dn', 0.4, 0.5), 0.5))
|
|
1231
|
+
mpf('0.40000000000000002')
|
|
1232
|
+
sage: chop(ellipfun('dn', inverse_jacobi_f('dn', -0.4, 0.5), 0.5))
|
|
1233
|
+
mpf('-0.40000000000000002')
|
|
1234
|
+
sage: chop(ellipfun('dn', inverse_jacobi_f('dn', -0.9, 0.5), 0.5))
|
|
1235
|
+
mpf('-0.90000000000000002')
|
|
1236
|
+
sage: chop(ellipfun('dn', inverse_jacobi_f('dn', -1.9, 0.2), 0.2))
|
|
1237
|
+
mpf('-1.8999999999999999')
|
|
1238
|
+
|
|
1239
|
+
sage: # needs mpmath
|
|
1240
|
+
sage: chop(ellipfun('nd', inverse_jacobi_f('nd', -1.9, 1), 1))
|
|
1241
|
+
mpf('-1.8999999999999999')
|
|
1242
|
+
sage: chop(ellipfun('nd', inverse_jacobi_f('nd', 1, -1), -1))
|
|
1243
|
+
mpf('1.0')
|
|
1244
|
+
sage: chop(ellipfun('nd', inverse_jacobi_f('nd', 11, -6), -6))
|
|
1245
|
+
mpf('11.0')
|
|
1246
|
+
sage: chop(ellipfun('nd', inverse_jacobi_f('nd', 0, 8), 8))
|
|
1247
|
+
mpf('0.0')
|
|
1248
|
+
sage: chop(ellipfun('nd', inverse_jacobi_f('nd', -3, 0.8), 0.8))
|
|
1249
|
+
mpf('-2.9999999999999996')
|
|
1250
|
+
|
|
1251
|
+
sage: # needs mpmath
|
|
1252
|
+
sage: chop(ellipfun('sc', inverse_jacobi_f('sc', -3, 0), 0))
|
|
1253
|
+
mpf('-3.0')
|
|
1254
|
+
sage: chop(ellipfun('sc', inverse_jacobi_f('sc', 2, 1), 1))
|
|
1255
|
+
mpf('2.0')
|
|
1256
|
+
sage: chop(ellipfun('sc', inverse_jacobi_f('sc', 0, 9), 9))
|
|
1257
|
+
mpf('0.0')
|
|
1258
|
+
sage: chop(ellipfun('sc', inverse_jacobi_f('sc', -7, 3), 3))
|
|
1259
|
+
mpf('-7.0')
|
|
1260
|
+
|
|
1261
|
+
sage: # needs mpmath
|
|
1262
|
+
sage: chop(ellipfun('cs', inverse_jacobi_f('cs', -7, 0), 0))
|
|
1263
|
+
mpf('-6.9999999999999991')
|
|
1264
|
+
sage: chop(ellipfun('cs', inverse_jacobi_f('cs', 8, 1), 1))
|
|
1265
|
+
mpf('8.0')
|
|
1266
|
+
sage: chop(ellipfun('cs', inverse_jacobi_f('cs', 2, 6), 6))
|
|
1267
|
+
mpf('2.0')
|
|
1268
|
+
sage: chop(ellipfun('cs', inverse_jacobi_f('cs', 0, 4), 4))
|
|
1269
|
+
mpf('0.0')
|
|
1270
|
+
sage: chop(ellipfun('cs', inverse_jacobi_f('cs', -6, 8), 8))
|
|
1271
|
+
mpf('-6.0000000000000018')
|
|
1272
|
+
|
|
1273
|
+
sage: chop(ellipfun('cd', inverse_jacobi_f('cd', -6, 0), 0)) # needs mpmath
|
|
1274
|
+
mpf('-6.0000000000000009')
|
|
1275
|
+
sage: chop(ellipfun('cd', inverse_jacobi_f('cd', 1, 3), 3)) # needs mpmath
|
|
1276
|
+
mpf('1.0')
|
|
1277
|
+
sage: chop(ellipfun('cd', inverse_jacobi_f('cd', 6, 8), 8)) # needs mpmath
|
|
1278
|
+
mpf('6.0000000000000027')
|
|
1279
|
+
|
|
1280
|
+
sage: chop(ellipfun('dc', inverse_jacobi_f('dc', 5, 0), 0)) # needs mpmath
|
|
1281
|
+
mpf('5.0000000000000018')
|
|
1282
|
+
sage: chop(ellipfun('dc', inverse_jacobi_f('dc', -4, 2), 2)) # needs mpmath
|
|
1283
|
+
mpf('-4.0000000000000018')
|
|
1284
|
+
|
|
1285
|
+
sage: # needs mpmath
|
|
1286
|
+
sage: chop(ellipfun('sd', inverse_jacobi_f('sd', -4, 0), 0))
|
|
1287
|
+
mpf('-3.9999999999999991')
|
|
1288
|
+
sage: chop(ellipfun('sd', inverse_jacobi_f('sd', 7, 1), 1))
|
|
1289
|
+
mpf('7.0')
|
|
1290
|
+
sage: chop(ellipfun('sd', inverse_jacobi_f('sd', 0, 9), 9))
|
|
1291
|
+
mpf('0.0')
|
|
1292
|
+
sage: chop(ellipfun('sd', inverse_jacobi_f('sd', 8, 0.8), 0.8))
|
|
1293
|
+
mpf('7.9999999999999991')
|
|
1294
|
+
|
|
1295
|
+
sage: chop(ellipfun('ds', inverse_jacobi_f('ds', 4, 0.25), 0.25)) # needs mpmath
|
|
1296
|
+
mpf('4.0')
|
|
1297
|
+
"""
|
|
1298
|
+
from mpmath import mp as ctx
|
|
1299
|
+
prec = ctx.prec
|
|
1300
|
+
try:
|
|
1301
|
+
x = ctx.convert(x)
|
|
1302
|
+
m = ctx.convert(m)
|
|
1303
|
+
if not isinstance(x, ctx.mpf) or not isinstance(x, ctx.mpf):
|
|
1304
|
+
raise ValueError('arguments must be real')
|
|
1305
|
+
if kind == 'sn':
|
|
1306
|
+
if m == 0:
|
|
1307
|
+
return ctx.asin(x)
|
|
1308
|
+
elif m == 1:
|
|
1309
|
+
return ctx.atanh(x)
|
|
1310
|
+
elif x == 0:
|
|
1311
|
+
return ctx.zero
|
|
1312
|
+
sign = ctx.sign(x) # sn is odd in x, so operate with abs(x) and
|
|
1313
|
+
x = abs(x) # include the sign at the end
|
|
1314
|
+
if x <= 1:
|
|
1315
|
+
ctx.prec += 10
|
|
1316
|
+
phi = ctx.asin(x)
|
|
1317
|
+
return sign * ctx.ellipf(phi, m)
|
|
1318
|
+
elif x <= 1 / ctx.sqrt(m):
|
|
1319
|
+
K = ctx.ellipk(m)
|
|
1320
|
+
ctx.prec += 10
|
|
1321
|
+
xpn2 = x ** (-2)
|
|
1322
|
+
m1 = 1 - m
|
|
1323
|
+
ctx.prec += 10
|
|
1324
|
+
omxpn2 = 1 - xpn2
|
|
1325
|
+
ctx.prec += 10
|
|
1326
|
+
omxpn2dm1 = omxpn2 / m1
|
|
1327
|
+
ctx.prec += 10
|
|
1328
|
+
phi = ctx.asin(omxpn2dm1.sqrt())
|
|
1329
|
+
return sign * ctx.mpc(K, ctx.ellipf(phi, m1))
|
|
1330
|
+
else:
|
|
1331
|
+
ctx.prec += 10
|
|
1332
|
+
m1 = 1 - m
|
|
1333
|
+
K_prime = ctx.ellipk(m1)
|
|
1334
|
+
sqrtm = ctx.sqrt(m)
|
|
1335
|
+
ctx.prec += 10
|
|
1336
|
+
xsqrtm = x * sqrtm
|
|
1337
|
+
ctx.prec += 10
|
|
1338
|
+
phi = ctx.asin(1 / xsqrtm)
|
|
1339
|
+
ctx.prec += 10
|
|
1340
|
+
return sign * ctx.mpc(ctx.ellipf(phi, m), K_prime)
|
|
1341
|
+
if kind == 'ns':
|
|
1342
|
+
if m == 0:
|
|
1343
|
+
return ctx.acsc(x)
|
|
1344
|
+
elif m == 1:
|
|
1345
|
+
return ctx.acoth(x)
|
|
1346
|
+
elif x > 0:
|
|
1347
|
+
ctx.prec += 10
|
|
1348
|
+
return inverse_jacobi_f('sn', 1 / x, m)
|
|
1349
|
+
elif x == 0:
|
|
1350
|
+
ctx.prec += 10
|
|
1351
|
+
return ctx.j * ctx.ellipk(1 - m)
|
|
1352
|
+
else:
|
|
1353
|
+
ctx.prec += 10
|
|
1354
|
+
K_prime = ctx.ellipk(1 - m)
|
|
1355
|
+
odx = 1 / x
|
|
1356
|
+
ctx.prec += 10
|
|
1357
|
+
arcsnodx = inverse_jacobi_f('sn', odx, m)
|
|
1358
|
+
itK_prime = ctx.j * 2 * K_prime
|
|
1359
|
+
ctx.prec += 10
|
|
1360
|
+
return arcsnodx + itK_prime
|
|
1361
|
+
if kind == 'cn':
|
|
1362
|
+
if m == 0:
|
|
1363
|
+
return ctx.acos(x)
|
|
1364
|
+
elif m == 1:
|
|
1365
|
+
return ctx.asech(x)
|
|
1366
|
+
elif x == 1:
|
|
1367
|
+
return ctx.zero
|
|
1368
|
+
elif 0 <= x < 1:
|
|
1369
|
+
ctx.prec += 10
|
|
1370
|
+
x2 = x ** 2
|
|
1371
|
+
ctx.prec += 10
|
|
1372
|
+
osx2 = 1 - x2
|
|
1373
|
+
ctx.prec += 10
|
|
1374
|
+
return ctx.ellipf(ctx.asin(ctx.sqrt(osx2)), m)
|
|
1375
|
+
elif -1 <= x < 0:
|
|
1376
|
+
K = ctx.ellipk(m)
|
|
1377
|
+
ctx.prec += 10
|
|
1378
|
+
x2 = x ** 2
|
|
1379
|
+
ctx.prec += 10
|
|
1380
|
+
osx2 = 1 - x2
|
|
1381
|
+
ctx.prec += 10
|
|
1382
|
+
return (2 * K) - ctx.ellipf(ctx.asin(ctx.sqrt(osx2)), m)
|
|
1383
|
+
elif x > 1:
|
|
1384
|
+
ctx.prec += 10
|
|
1385
|
+
m1 = 1 - m
|
|
1386
|
+
xn2 = x ** (-2)
|
|
1387
|
+
ctx.prec += 10
|
|
1388
|
+
osx2 = 1 - xn2
|
|
1389
|
+
ctx.prec += 10
|
|
1390
|
+
return ctx.j * ctx.ellipf(ctx.asin(ctx.sqrt(osx2)), m1)
|
|
1391
|
+
elif x < -1:
|
|
1392
|
+
K = ctx.ellipk(m)
|
|
1393
|
+
ctx.prec += 10
|
|
1394
|
+
m1 = 1 - m
|
|
1395
|
+
xn2 = x ** (-2)
|
|
1396
|
+
tK = 2 * K
|
|
1397
|
+
ctx.prec += 10
|
|
1398
|
+
osx2 = 1 - xn2
|
|
1399
|
+
ctx.prec += 10
|
|
1400
|
+
phi = ctx.asin(ctx.sqrt(osx2))
|
|
1401
|
+
ctx.prec += 10
|
|
1402
|
+
return tK - ctx.j * ctx.ellipf(phi, m1)
|
|
1403
|
+
if kind == 'nc':
|
|
1404
|
+
if m == 0:
|
|
1405
|
+
return ctx.asec(x)
|
|
1406
|
+
elif m == 1:
|
|
1407
|
+
return ctx.acosh(x)
|
|
1408
|
+
elif x == 1:
|
|
1409
|
+
return ctx.zero
|
|
1410
|
+
elif x > 0:
|
|
1411
|
+
ctx.prec += 10
|
|
1412
|
+
return inverse_jacobi_f('cn', 1 / x, m)
|
|
1413
|
+
elif x == 0:
|
|
1414
|
+
ctx.prec += 10
|
|
1415
|
+
return ctx.j * ctx.ellipk(1 - m)
|
|
1416
|
+
else:
|
|
1417
|
+
K = ctx.ellipk(m)
|
|
1418
|
+
ctx.prec += 10
|
|
1419
|
+
K_prime = ctx.ellipk(1 - m)
|
|
1420
|
+
odx = 1 / x
|
|
1421
|
+
ctx.prec += 10
|
|
1422
|
+
arccnodx = inverse_jacobi_f('cn', odx, m)
|
|
1423
|
+
tK = 2 * K
|
|
1424
|
+
ctx.prec += 10
|
|
1425
|
+
return arccnodx - tK + ctx.j * 2 * K_prime
|
|
1426
|
+
if kind == 'dn':
|
|
1427
|
+
if x == 1:
|
|
1428
|
+
return ctx.zero
|
|
1429
|
+
if not m <= 1:
|
|
1430
|
+
raise ValueError('m must be <= 1')
|
|
1431
|
+
if m == 1:
|
|
1432
|
+
return ctx.asech(x)
|
|
1433
|
+
ctx.prec += 10
|
|
1434
|
+
m1 = 1 - m
|
|
1435
|
+
sqrtm1 = ctx.sqrt(m1)
|
|
1436
|
+
if sqrtm1 <= x < 1:
|
|
1437
|
+
ctx.prec += 10
|
|
1438
|
+
x2 = x ** 2
|
|
1439
|
+
ctx.prec += 10
|
|
1440
|
+
osx2 = 1 - x2
|
|
1441
|
+
ctx.prec += 10
|
|
1442
|
+
osx2dm = osx2 / m
|
|
1443
|
+
ctx.prec += 10
|
|
1444
|
+
return ctx.ellipf(ctx.asin(ctx.sqrt(osx2dm)), m)
|
|
1445
|
+
elif x > 1:
|
|
1446
|
+
ctx.prec += 10
|
|
1447
|
+
xn2 = x ** (-2)
|
|
1448
|
+
ctx.prec += 10
|
|
1449
|
+
osxn2 = 1 - xn2
|
|
1450
|
+
m1xn2 = m1 * xn2
|
|
1451
|
+
ctx.prec += 10
|
|
1452
|
+
osm1xn2 = 1 - m1xn2
|
|
1453
|
+
ctx.prec += 10
|
|
1454
|
+
sqrtosxn2dosm1xn2 = ctx.sqrt(osxn2 / osm1xn2)
|
|
1455
|
+
ctx.prec += 10
|
|
1456
|
+
return ctx.j * ctx.ellipf(ctx.asin(sqrtosxn2dosm1xn2), m1)
|
|
1457
|
+
elif 0 <= x < sqrtm1:
|
|
1458
|
+
K = ctx.ellipk(m)
|
|
1459
|
+
ctx.prec += 10
|
|
1460
|
+
x2 = x ** 2
|
|
1461
|
+
ctx.prec += 10
|
|
1462
|
+
x2dm1 = x2 / m1
|
|
1463
|
+
osx2 = 1 - x2
|
|
1464
|
+
ctx.prec += 10
|
|
1465
|
+
osx2dm1 = 1 - x2dm1
|
|
1466
|
+
ctx.prec += 10
|
|
1467
|
+
osx2dm1dosx2 = osx2dm1 / osx2
|
|
1468
|
+
ctx.prec += 10
|
|
1469
|
+
sqrtall = ctx.sqrt(osx2dm1dosx2)
|
|
1470
|
+
ctx.prec += 10
|
|
1471
|
+
phi = ctx.asin(sqrtall)
|
|
1472
|
+
ctx.prec += 10
|
|
1473
|
+
return K + ctx.j * ctx.ellipf(phi, m1)
|
|
1474
|
+
elif -sqrtm1 <= x < 0:
|
|
1475
|
+
K = ctx.ellipk(m)
|
|
1476
|
+
K_prime = ctx.ellipk(m1)
|
|
1477
|
+
ctx.prec += 10
|
|
1478
|
+
tK_prime = 2 * K_prime
|
|
1479
|
+
x2 = x ** 2
|
|
1480
|
+
ctx.prec += 10
|
|
1481
|
+
x2dm1 = x2 / m1
|
|
1482
|
+
osx2 = 1 - x2
|
|
1483
|
+
ctx.prec += 10
|
|
1484
|
+
osx2dm1 = 1 - x2dm1
|
|
1485
|
+
ctx.prec += 10
|
|
1486
|
+
osx2dm1dosx2 = osx2dm1 / osx2
|
|
1487
|
+
ctx.prec += 10
|
|
1488
|
+
sqrtall = ctx.sqrt(osx2dm1dosx2)
|
|
1489
|
+
ctx.prec += 10
|
|
1490
|
+
phi = ctx.asin(sqrtall)
|
|
1491
|
+
ctx.prec += 10
|
|
1492
|
+
return K + ctx.j * (tK_prime - ctx.ellipf(phi, m1))
|
|
1493
|
+
elif -1 <= x < -sqrtm1:
|
|
1494
|
+
K = ctx.ellipk(m)
|
|
1495
|
+
K_prime = ctx.ellipk(m1)
|
|
1496
|
+
ctx.prec += 10
|
|
1497
|
+
x2 = x ** 2
|
|
1498
|
+
tK = 2 * K
|
|
1499
|
+
# Note that the factor of 2 is missing in the reference
|
|
1500
|
+
# (formula (81)), probably mistakenly so
|
|
1501
|
+
tK_prime = 2 * K_prime
|
|
1502
|
+
ctx.prec += 10
|
|
1503
|
+
osx2 = 1 - x2
|
|
1504
|
+
ctx.prec += 10
|
|
1505
|
+
osx2dm = osx2 / m
|
|
1506
|
+
sqrtall = ctx.sqrt(osx2dm)
|
|
1507
|
+
ctx.prec += 10
|
|
1508
|
+
phi = ctx.asin(sqrtall)
|
|
1509
|
+
ctx.prec += 10
|
|
1510
|
+
return (tK - ctx.ellipf(phi, m)) + (ctx.j * tK_prime)
|
|
1511
|
+
elif x < -1:
|
|
1512
|
+
K = ctx.ellipk(m)
|
|
1513
|
+
K_prime = ctx.ellipk(m1)
|
|
1514
|
+
ctx.prec += 10
|
|
1515
|
+
tK = 2 * K
|
|
1516
|
+
tK_prime = 2 * K_prime
|
|
1517
|
+
xn2 = x ** (-2)
|
|
1518
|
+
ctx.prec += 10
|
|
1519
|
+
osxn2 = 1 - xn2
|
|
1520
|
+
m1xn2 = m1 * xn2
|
|
1521
|
+
ctx.prec += 10
|
|
1522
|
+
osm1xn2 = 1 - m1xn2
|
|
1523
|
+
ctx.prec += 10
|
|
1524
|
+
sqrtosxn2dosm1xn2 = ctx.sqrt(osxn2 / osm1xn2)
|
|
1525
|
+
ctx.prec += 10
|
|
1526
|
+
phi = ctx.asin(sqrtosxn2dosm1xn2)
|
|
1527
|
+
ctx.prec += 10
|
|
1528
|
+
return tK + ctx.j * (tK_prime - ctx.ellipf(phi, m1))
|
|
1529
|
+
if kind == 'nd':
|
|
1530
|
+
if m == 1:
|
|
1531
|
+
return ctx.acosh(x)
|
|
1532
|
+
elif x == 1:
|
|
1533
|
+
return ctx.zero
|
|
1534
|
+
elif x > 0:
|
|
1535
|
+
ctx.prec += 10
|
|
1536
|
+
return inverse_jacobi_f('dn', 1 / x, m)
|
|
1537
|
+
elif x == 0:
|
|
1538
|
+
ctx.prec += 10
|
|
1539
|
+
return ctx.j * ctx.ellipk(1 - m)
|
|
1540
|
+
else:
|
|
1541
|
+
K = ctx.ellipk(m)
|
|
1542
|
+
ctx.prec += 10
|
|
1543
|
+
tK = 2 * K
|
|
1544
|
+
ctx.prec += 10
|
|
1545
|
+
return inverse_jacobi_f('dn', 1 / x, m) - tK
|
|
1546
|
+
if kind == 'sc':
|
|
1547
|
+
if m == 0:
|
|
1548
|
+
return ctx.atan(x)
|
|
1549
|
+
elif m == 1:
|
|
1550
|
+
return ctx.asinh(x)
|
|
1551
|
+
elif x == 0:
|
|
1552
|
+
return ctx.zero
|
|
1553
|
+
else:
|
|
1554
|
+
ctx.prec += 10
|
|
1555
|
+
atanx = ctx.atan(x)
|
|
1556
|
+
return ctx.ellipf(atanx, m)
|
|
1557
|
+
if kind == 'cs':
|
|
1558
|
+
if m == 0:
|
|
1559
|
+
return ctx.acot(x)
|
|
1560
|
+
elif m == 1:
|
|
1561
|
+
return ctx.acsch(x)
|
|
1562
|
+
elif x > 0:
|
|
1563
|
+
ctx.prec += 10
|
|
1564
|
+
odx = 1 / x
|
|
1565
|
+
ctx.prec += 10
|
|
1566
|
+
return ctx.ellipf(ctx.atan(odx), m)
|
|
1567
|
+
elif x == 0:
|
|
1568
|
+
return ctx.ellipk(m)
|
|
1569
|
+
else:
|
|
1570
|
+
K = ctx.ellipk(m)
|
|
1571
|
+
ctx.prec += 10
|
|
1572
|
+
odx = 1 / x
|
|
1573
|
+
ctx.prec += 10
|
|
1574
|
+
phi = ctx.atan(odx)
|
|
1575
|
+
ctx.prec += 10
|
|
1576
|
+
return ctx.ellipf(phi, m) + (2 * K)
|
|
1577
|
+
if kind == 'cd':
|
|
1578
|
+
if m == 0:
|
|
1579
|
+
return ctx.acos(x)
|
|
1580
|
+
elif x == 1:
|
|
1581
|
+
return ctx.zero
|
|
1582
|
+
else:
|
|
1583
|
+
K = ctx.ellipk(m)
|
|
1584
|
+
ctx.prec += 10
|
|
1585
|
+
return inverse_jacobi_f('sn', x, m) - K
|
|
1586
|
+
if kind == 'dc':
|
|
1587
|
+
if m == 0:
|
|
1588
|
+
return ctx.asec(x)
|
|
1589
|
+
K = ctx.ellipk(m)
|
|
1590
|
+
ctx.prec += 10
|
|
1591
|
+
return inverse_jacobi_f('ns', x, m) - K
|
|
1592
|
+
if kind == 'sd':
|
|
1593
|
+
if m == 0:
|
|
1594
|
+
return ctx.asin(x)
|
|
1595
|
+
elif m == 1:
|
|
1596
|
+
return ctx.asinh(x)
|
|
1597
|
+
elif x == 0:
|
|
1598
|
+
return ctx.zero
|
|
1599
|
+
else:
|
|
1600
|
+
if m > 1:
|
|
1601
|
+
raise ValueError('m must be <= 1')
|
|
1602
|
+
K = ctx.ellipk(m)
|
|
1603
|
+
ctx.prec += 10
|
|
1604
|
+
m1 = 1 - m
|
|
1605
|
+
ctx.prec += 10
|
|
1606
|
+
sqrtm1 = ctx.sqrt(m1)
|
|
1607
|
+
ctx.prec += 10
|
|
1608
|
+
xsqrtm1 = x * sqrtm1
|
|
1609
|
+
ctx.prec += 10
|
|
1610
|
+
return inverse_jacobi_f('cn', xsqrtm1, m) + K
|
|
1611
|
+
if kind == 'ds':
|
|
1612
|
+
if m == 0:
|
|
1613
|
+
return ctx.acsc(x)
|
|
1614
|
+
elif m == 1:
|
|
1615
|
+
return ctx.acsch(x)
|
|
1616
|
+
else:
|
|
1617
|
+
if m > 1:
|
|
1618
|
+
raise ValueError('m must be <= 1')
|
|
1619
|
+
K = ctx.ellipk(m)
|
|
1620
|
+
ctx.prec += 10
|
|
1621
|
+
m1 = 1 - m
|
|
1622
|
+
ctx.prec += 10
|
|
1623
|
+
sqrtm1 = ctx.sqrt(m1)
|
|
1624
|
+
ctx.prec += 10
|
|
1625
|
+
xdsqrtm1 = x / sqrtm1
|
|
1626
|
+
ctx.prec += 10
|
|
1627
|
+
return inverse_jacobi_f('nc', xdsqrtm1, m) + K
|
|
1628
|
+
finally:
|
|
1629
|
+
ctx.prec = prec
|
|
1630
|
+
|
|
1631
|
+
|
|
1632
|
+
def jacobi_am_f(x, m):
|
|
1633
|
+
r"""
|
|
1634
|
+
Internal function for numeric evaluation of the Jacobi amplitude function
|
|
1635
|
+
for real arguments. Procedure described in [Eh2013]_.
|
|
1636
|
+
|
|
1637
|
+
TESTS::
|
|
1638
|
+
|
|
1639
|
+
sage: # needs mpmath
|
|
1640
|
+
sage: from mpmath import ellipf
|
|
1641
|
+
sage: from sage.functions.jacobi import jacobi_am_f
|
|
1642
|
+
sage: ellipf(jacobi_am_f(0.5, 1), 1)
|
|
1643
|
+
mpf('0.5')
|
|
1644
|
+
sage: ellipf(jacobi_am(3, 0.3), 0.3)
|
|
1645
|
+
mpf('3.0')
|
|
1646
|
+
sage: ellipf(jacobi_am_f(2, -0.5), -0.5)
|
|
1647
|
+
mpf('2.0')
|
|
1648
|
+
sage: jacobi_am_f(2, -0.5)
|
|
1649
|
+
mpf('2.2680930777934176')
|
|
1650
|
+
sage: jacobi_am_f(-2, -0.5)
|
|
1651
|
+
mpf('-2.2680930777934176')
|
|
1652
|
+
sage: jacobi_am_f(-3, 2)
|
|
1653
|
+
mpf('0.36067407399586108')
|
|
1654
|
+
"""
|
|
1655
|
+
from mpmath import mp as ctx
|
|
1656
|
+
prec = ctx.prec
|
|
1657
|
+
try:
|
|
1658
|
+
x = ctx.convert(x)
|
|
1659
|
+
m = ctx.convert(m)
|
|
1660
|
+
if not isinstance(x, ctx.mpf) or not isinstance(m, ctx.mpf):
|
|
1661
|
+
raise ValueError('arguments must be real')
|
|
1662
|
+
if abs(m) == 1:
|
|
1663
|
+
# gd(x)
|
|
1664
|
+
ctx.prec += 10
|
|
1665
|
+
tanhx = ctx.tanh(x)
|
|
1666
|
+
ctx.prec += 10
|
|
1667
|
+
return ctx.asin(tanhx)
|
|
1668
|
+
elif abs(m) > 1:
|
|
1669
|
+
ctx.prec += 10
|
|
1670
|
+
# Real values needed for atan2; as per "Handbook of Elliptic
|
|
1671
|
+
# Integrals for Engineers and Scientists" 121.02, sn is real for
|
|
1672
|
+
# real x. The imaginary components can thus be safely discarded.
|
|
1673
|
+
snx = ctx.ellipfun('sn', x, m).real
|
|
1674
|
+
cnx = ctx.ellipfun('cn', x, m).real
|
|
1675
|
+
ctx.prec += 10
|
|
1676
|
+
return ctx.atan2(snx, cnx)
|
|
1677
|
+
else:
|
|
1678
|
+
ctx.prec += 10
|
|
1679
|
+
K = ctx.ellipk(m)
|
|
1680
|
+
if abs(x) <= K:
|
|
1681
|
+
snx = ctx.ellipfun('sn', x, m).real
|
|
1682
|
+
cnx = ctx.ellipfun('cn', x, m).real
|
|
1683
|
+
ctx.prec += 10
|
|
1684
|
+
return ctx.atan2(snx, cnx)
|
|
1685
|
+
else:
|
|
1686
|
+
# Do argument reduction on x to end up with z = x - 2nK, with
|
|
1687
|
+
# abs(z) <= K
|
|
1688
|
+
ctx.prec += 10
|
|
1689
|
+
tK = 2 * K
|
|
1690
|
+
ctx.prec += 10
|
|
1691
|
+
n = ctx.floor(x / tK)
|
|
1692
|
+
ctx.prec += 10
|
|
1693
|
+
tnK = n * tK
|
|
1694
|
+
npi = n * ctx.pi()
|
|
1695
|
+
ctx.prec += 10
|
|
1696
|
+
z = x - tnK
|
|
1697
|
+
ctx.prec += 10
|
|
1698
|
+
# z (and therefore sn(z, m) and cn(z, m)) is real because K(m)
|
|
1699
|
+
# is real for abs(m) <= 1.
|
|
1700
|
+
snz = ctx.ellipfun('sn', z, m).real
|
|
1701
|
+
cnz = ctx.ellipfun('cn', z, m).real
|
|
1702
|
+
ctx.prec += 10
|
|
1703
|
+
return ctx.atan2(snz, cnz) + npi
|
|
1704
|
+
finally:
|
|
1705
|
+
ctx.prec = prec
|