passagemath-pari 10.6.32__cp314-cp314-musllinux_1_2_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of passagemath-pari might be problematic. Click here for more details.
- PARIKernel/__init__.py +2 -0
- PARIKernel/__main__.py +5 -0
- PARIKernel/io.cpython-314-x86_64-linux-musl.so +0 -0
- PARIKernel/io.pxd +7 -0
- PARIKernel/io.pyx +84 -0
- PARIKernel/kernel.cpython-314-x86_64-linux-musl.so +0 -0
- PARIKernel/kernel.pyx +260 -0
- PARIKernel/paridecl.pxd +95 -0
- PARIKernel/svg.cpython-314-x86_64-linux-musl.so +0 -0
- PARIKernel/svg.pyx +52 -0
- cypari2/__init__.py +8 -0
- cypari2/auto_paridecl.pxd +1070 -0
- cypari2/closure.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/closure.pxd +5 -0
- cypari2/closure.pyx +246 -0
- cypari2/convert.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/convert.pxd +80 -0
- cypari2/convert.pyx +613 -0
- cypari2/custom_block.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/custom_block.pyx +30 -0
- cypari2/cypari.h +13 -0
- cypari2/gen.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/gen.pxd +69 -0
- cypari2/gen.pyx +4819 -0
- cypari2/handle_error.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/handle_error.pxd +7 -0
- cypari2/handle_error.pyx +232 -0
- cypari2/pari_instance.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/pari_instance.pxd +27 -0
- cypari2/pari_instance.pyx +1438 -0
- cypari2/paridecl.pxd +5353 -0
- cypari2/paripriv.pxd +34 -0
- cypari2/pycore_long.h +98 -0
- cypari2/pycore_long.pxd +9 -0
- cypari2/stack.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/stack.pxd +27 -0
- cypari2/stack.pyx +278 -0
- cypari2/string_utils.cpython-314-x86_64-linux-musl.so +0 -0
- cypari2/string_utils.pxd +29 -0
- cypari2/string_utils.pyx +65 -0
- cypari2/types.pxd +147 -0
- passagemath_pari-10.6.32.data/data/etc/jupyter/nbconfig/notebook.d/gp-mode.json +5 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/kernel.js +28 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/kernel.json +6 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/pari_jupyter/logo-64x64.png +0 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/kernel.json +13 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-32x32.png +0 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-64x64.png +0 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/kernels/xeus-gp/logo-svg.svg +75 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/nbextensions/gp-mode/gp.js +284 -0
- passagemath_pari-10.6.32.data/data/share/jupyter/nbextensions/gp-mode/main.js +15 -0
- passagemath_pari-10.6.32.dist-info/METADATA +209 -0
- passagemath_pari-10.6.32.dist-info/RECORD +331 -0
- passagemath_pari-10.6.32.dist-info/WHEEL +5 -0
- passagemath_pari-10.6.32.dist-info/top_level.txt +4 -0
- passagemath_pari.libs/libcrypto-f04afe95.so.3 +0 -0
- passagemath_pari.libs/libflint-fd6f12fc.so.21.0.0 +0 -0
- passagemath_pari.libs/libgcc_s-0cd532bd.so.1 +0 -0
- passagemath_pari.libs/libgf2x-9e30c3e3.so.3.0.0 +0 -0
- passagemath_pari.libs/libgfortran-2c33b284.so.5.0.0 +0 -0
- passagemath_pari.libs/libgivaro-9a94c711.so.9.2.1 +0 -0
- passagemath_pari.libs/libgmp-0e7fc84e.so.10.5.0 +0 -0
- passagemath_pari.libs/libgmpxx-9e08595c.so.4.7.0 +0 -0
- passagemath_pari.libs/libgsl-42cda06f.so.28.0.0 +0 -0
- passagemath_pari.libs/libmpfr-aaecbfc0.so.6.2.1 +0 -0
- passagemath_pari.libs/libncursesw-9c9e32c3.so.6.5 +0 -0
- passagemath_pari.libs/libntl-26885ca2.so.44.0.1 +0 -0
- passagemath_pari.libs/libopenblasp-r0-905cb27d.3.29.so +0 -0
- passagemath_pari.libs/libpari-gmp-tls-f31f908f.so.2.17.2 +0 -0
- passagemath_pari.libs/libquadmath-bb76a5fc.so.0.0.0 +0 -0
- passagemath_pari.libs/libreadline-06542304.so.8.2 +0 -0
- passagemath_pari.libs/libstdc++-5d72f927.so.6.0.33 +0 -0
- passagemath_pari.libs/libuuid-f3770415.so.1.3.0 +0 -0
- passagemath_pari.libs/libxeus-735780ff.so.13.1.0 +0 -0
- passagemath_pari.libs/libxeus-zmq-c68577b4.so.6.0.1 +0 -0
- passagemath_pari.libs/libzmq-1ba9a3da.so.5.2.5 +0 -0
- sage/all__sagemath_pari.py +26 -0
- sage/databases/all__sagemath_pari.py +7 -0
- sage/databases/conway.py +274 -0
- sage/ext/all__sagemath_pari.py +1 -0
- sage/ext/memory.cpython-314-x86_64-linux-musl.so +0 -0
- sage/ext/memory.pyx +98 -0
- sage/ext_data/pari/buzzard/DimensionSk.g +286 -0
- sage/ext_data/pari/buzzard/Tpprog.g +179 -0
- sage/ext_data/pari/buzzard/genusn.g +129 -0
- sage/ext_data/pari/dokchitser/computel.gp +740 -0
- sage/ext_data/pari/dokchitser/computel.gp.template +740 -0
- sage/ext_data/pari/dokchitser/ex-bsw +43 -0
- sage/ext_data/pari/dokchitser/ex-chgen +48 -0
- sage/ext_data/pari/dokchitser/ex-chqua +37 -0
- sage/ext_data/pari/dokchitser/ex-delta +35 -0
- sage/ext_data/pari/dokchitser/ex-eisen +30 -0
- sage/ext_data/pari/dokchitser/ex-gen2 +38 -0
- sage/ext_data/pari/dokchitser/ex-gen3 +49 -0
- sage/ext_data/pari/dokchitser/ex-gen4 +54 -0
- sage/ext_data/pari/dokchitser/ex-nf +48 -0
- sage/ext_data/pari/dokchitser/ex-shin +50 -0
- sage/ext_data/pari/dokchitser/ex-tau2 +30 -0
- sage/ext_data/pari/dokchitser/ex-zeta +27 -0
- sage/ext_data/pari/dokchitser/ex-zeta2 +47 -0
- sage/ext_data/pari/dokchitser/testall +13 -0
- sage/ext_data/pari/simon/ell.gp +2129 -0
- sage/ext_data/pari/simon/ellQ.gp +2151 -0
- sage/ext_data/pari/simon/ellcommon.gp +126 -0
- sage/ext_data/pari/simon/qfsolve.gp +722 -0
- sage/ext_data/pari/simon/resultant3.gp +306 -0
- sage/groups/all__sagemath_pari.py +3 -0
- sage/groups/pari_group.py +175 -0
- sage/interfaces/all__sagemath_pari.py +1 -0
- sage/interfaces/genus2reduction.py +464 -0
- sage/interfaces/gp.py +1114 -0
- sage/libs/all__sagemath_pari.py +2 -0
- sage/libs/linkages/__init__.py +1 -0
- sage/libs/linkages/padics/API.pxi +617 -0
- sage/libs/linkages/padics/Polynomial_ram.pxi +388 -0
- sage/libs/linkages/padics/Polynomial_shared.pxi +554 -0
- sage/libs/linkages/padics/__init__.py +1 -0
- sage/libs/linkages/padics/fmpz_poly_unram.pxi +869 -0
- sage/libs/linkages/padics/mpz.pxi +691 -0
- sage/libs/linkages/padics/relaxed/API.pxi +518 -0
- sage/libs/linkages/padics/relaxed/__init__.py +1 -0
- sage/libs/linkages/padics/relaxed/flint.pxi +543 -0
- sage/libs/linkages/padics/unram_shared.pxi +247 -0
- sage/libs/pari/__init__.py +210 -0
- sage/libs/pari/all.py +5 -0
- sage/libs/pari/convert_flint.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_flint.pxd +14 -0
- sage/libs/pari/convert_flint.pyx +159 -0
- sage/libs/pari/convert_gmp.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_gmp.pxd +14 -0
- sage/libs/pari/convert_gmp.pyx +210 -0
- sage/libs/pari/convert_sage.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_sage.pxd +16 -0
- sage/libs/pari/convert_sage.pyx +588 -0
- sage/libs/pari/convert_sage_complex_double.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_sage_complex_double.pxd +14 -0
- sage/libs/pari/convert_sage_complex_double.pyx +132 -0
- sage/libs/pari/convert_sage_matrix.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_sage_matrix.pyx +106 -0
- sage/libs/pari/convert_sage_real_double.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_sage_real_double.pxd +5 -0
- sage/libs/pari/convert_sage_real_double.pyx +14 -0
- sage/libs/pari/convert_sage_real_mpfr.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/convert_sage_real_mpfr.pxd +7 -0
- sage/libs/pari/convert_sage_real_mpfr.pyx +108 -0
- sage/libs/pari/misc.cpython-314-x86_64-linux-musl.so +0 -0
- sage/libs/pari/misc.pxd +4 -0
- sage/libs/pari/misc.pyx +26 -0
- sage/libs/pari/tests.py +1848 -0
- sage/matrix/all__sagemath_pari.py +1 -0
- sage/matrix/matrix_integer_pari.cpython-314-x86_64-linux-musl.so +0 -0
- sage/matrix/matrix_integer_pari.pyx +187 -0
- sage/matrix/matrix_rational_pari.cpython-314-x86_64-linux-musl.so +0 -0
- sage/matrix/matrix_rational_pari.pyx +160 -0
- sage/quadratic_forms/all__sagemath_pari.py +10 -0
- sage/quadratic_forms/genera/all.py +9 -0
- sage/quadratic_forms/genera/genus.py +3506 -0
- sage/quadratic_forms/genera/normal_form.py +1519 -0
- sage/quadratic_forms/genera/spinor_genus.py +243 -0
- sage/quadratic_forms/qfsolve.py +255 -0
- sage/quadratic_forms/quadratic_form__automorphisms.py +427 -0
- sage/quadratic_forms/quadratic_form__genus.py +141 -0
- sage/quadratic_forms/quadratic_form__local_density_interfaces.py +140 -0
- sage/quadratic_forms/quadratic_form__local_normal_form.py +421 -0
- sage/quadratic_forms/quadratic_form__local_representation_conditions.py +889 -0
- sage/quadratic_forms/quadratic_form__mass.py +69 -0
- sage/quadratic_forms/quadratic_form__mass__Conway_Sloane_masses.py +663 -0
- sage/quadratic_forms/quadratic_form__mass__Siegel_densities.py +373 -0
- sage/quadratic_forms/quadratic_form__siegel_product.py +198 -0
- sage/quadratic_forms/special_values.py +323 -0
- sage/rings/all__sagemath_pari.py +15 -0
- sage/rings/factorint_pari.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/factorint_pari.pyx +80 -0
- sage/rings/finite_rings/all__sagemath_pari.py +1 -0
- sage/rings/finite_rings/element_givaro.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/element_givaro.pxd +91 -0
- sage/rings/finite_rings/element_givaro.pyx +1769 -0
- sage/rings/finite_rings/element_ntl_gf2e.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/element_ntl_gf2e.pxd +22 -0
- sage/rings/finite_rings/element_ntl_gf2e.pyx +1333 -0
- sage/rings/finite_rings/element_pari_ffelt.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/element_pari_ffelt.pxd +13 -0
- sage/rings/finite_rings/element_pari_ffelt.pyx +1441 -0
- sage/rings/finite_rings/finite_field_givaro.py +612 -0
- sage/rings/finite_rings/finite_field_pari_ffelt.py +238 -0
- sage/rings/finite_rings/hom_finite_field_givaro.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/hom_finite_field_givaro.pxd +28 -0
- sage/rings/finite_rings/hom_finite_field_givaro.pyx +280 -0
- sage/rings/finite_rings/residue_field_givaro.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/residue_field_givaro.pyx +133 -0
- sage/rings/finite_rings/residue_field_pari_ffelt.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/finite_rings/residue_field_pari_ffelt.pyx +128 -0
- sage/rings/function_field/all__sagemath_pari.py +1 -0
- sage/rings/function_field/valuation.py +1450 -0
- sage/rings/function_field/valuation_ring.py +212 -0
- sage/rings/number_field/all__sagemath_pari.py +14 -0
- sage/rings/number_field/totallyreal.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/number_field/totallyreal.pyx +509 -0
- sage/rings/number_field/totallyreal_data.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/number_field/totallyreal_data.pxd +26 -0
- sage/rings/number_field/totallyreal_data.pyx +928 -0
- sage/rings/number_field/totallyreal_phc.py +144 -0
- sage/rings/number_field/totallyreal_rel.py +1018 -0
- sage/rings/padics/CA_template.pxi +1847 -0
- sage/rings/padics/CA_template_header.pxi +50 -0
- sage/rings/padics/CR_template.pxi +2563 -0
- sage/rings/padics/CR_template_header.pxi +57 -0
- sage/rings/padics/FM_template.pxi +1575 -0
- sage/rings/padics/FM_template_header.pxi +50 -0
- sage/rings/padics/FP_template.pxi +2176 -0
- sage/rings/padics/FP_template_header.pxi +57 -0
- sage/rings/padics/all.py +3 -0
- sage/rings/padics/all__sagemath_pari.py +11 -0
- sage/rings/padics/common_conversion.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/common_conversion.pxd +15 -0
- sage/rings/padics/common_conversion.pyx +508 -0
- sage/rings/padics/eisenstein_extension_generic.py +232 -0
- sage/rings/padics/factory.py +3623 -0
- sage/rings/padics/generic_nodes.py +1615 -0
- sage/rings/padics/lattice_precision.py +2889 -0
- sage/rings/padics/morphism.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/morphism.pxd +11 -0
- sage/rings/padics/morphism.pyx +366 -0
- sage/rings/padics/padic_base_generic.py +467 -0
- sage/rings/padics/padic_base_leaves.py +1235 -0
- sage/rings/padics/padic_capped_absolute_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_capped_absolute_element.pxd +15 -0
- sage/rings/padics/padic_capped_absolute_element.pyx +520 -0
- sage/rings/padics/padic_capped_relative_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_capped_relative_element.pxd +14 -0
- sage/rings/padics/padic_capped_relative_element.pyx +614 -0
- sage/rings/padics/padic_extension_generic.py +990 -0
- sage/rings/padics/padic_extension_leaves.py +738 -0
- sage/rings/padics/padic_fixed_mod_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_fixed_mod_element.pxd +15 -0
- sage/rings/padics/padic_fixed_mod_element.pyx +584 -0
- sage/rings/padics/padic_floating_point_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_floating_point_element.pxd +14 -0
- sage/rings/padics/padic_floating_point_element.pyx +447 -0
- sage/rings/padics/padic_generic_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_generic_element.pxd +48 -0
- sage/rings/padics/padic_generic_element.pyx +4642 -0
- sage/rings/padics/padic_lattice_element.py +1342 -0
- sage/rings/padics/padic_printing.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_printing.pxd +38 -0
- sage/rings/padics/padic_printing.pyx +1505 -0
- sage/rings/padics/padic_relaxed_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_relaxed_element.pxd +56 -0
- sage/rings/padics/padic_relaxed_element.pyx +18 -0
- sage/rings/padics/padic_relaxed_errors.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/padic_relaxed_errors.pxd +11 -0
- sage/rings/padics/padic_relaxed_errors.pyx +71 -0
- sage/rings/padics/padic_template_element.pxi +1212 -0
- sage/rings/padics/padic_template_element_header.pxi +50 -0
- sage/rings/padics/padic_valuation.py +1423 -0
- sage/rings/padics/pow_computer_flint.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/pow_computer_flint.pxd +38 -0
- sage/rings/padics/pow_computer_flint.pyx +641 -0
- sage/rings/padics/pow_computer_relative.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/pow_computer_relative.pxd +29 -0
- sage/rings/padics/pow_computer_relative.pyx +415 -0
- sage/rings/padics/qadic_flint_CA.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/qadic_flint_CA.pxd +21 -0
- sage/rings/padics/qadic_flint_CA.pyx +130 -0
- sage/rings/padics/qadic_flint_CR.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/qadic_flint_CR.pxd +13 -0
- sage/rings/padics/qadic_flint_CR.pyx +172 -0
- sage/rings/padics/qadic_flint_FM.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/qadic_flint_FM.pxd +14 -0
- sage/rings/padics/qadic_flint_FM.pyx +111 -0
- sage/rings/padics/qadic_flint_FP.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/qadic_flint_FP.pxd +12 -0
- sage/rings/padics/qadic_flint_FP.pyx +165 -0
- sage/rings/padics/relative_extension_leaves.py +429 -0
- sage/rings/padics/relative_ramified_CA.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/relative_ramified_CA.pxd +9 -0
- sage/rings/padics/relative_ramified_CA.pyx +33 -0
- sage/rings/padics/relative_ramified_CR.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/relative_ramified_CR.pxd +8 -0
- sage/rings/padics/relative_ramified_CR.pyx +33 -0
- sage/rings/padics/relative_ramified_FM.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/relative_ramified_FM.pxd +9 -0
- sage/rings/padics/relative_ramified_FM.pyx +33 -0
- sage/rings/padics/relative_ramified_FP.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/padics/relative_ramified_FP.pxd +8 -0
- sage/rings/padics/relative_ramified_FP.pyx +33 -0
- sage/rings/padics/relaxed_template.pxi +4229 -0
- sage/rings/padics/relaxed_template_header.pxi +160 -0
- sage/rings/padics/tests.py +35 -0
- sage/rings/padics/tutorial.py +341 -0
- sage/rings/padics/unramified_extension_generic.py +335 -0
- sage/rings/padics/witt_vector.py +917 -0
- sage/rings/padics/witt_vector_ring.py +934 -0
- sage/rings/pari_ring.py +235 -0
- sage/rings/polynomial/all__sagemath_pari.py +1 -0
- sage/rings/polynomial/padics/all.py +1 -0
- sage/rings/polynomial/padics/polynomial_padic.py +360 -0
- sage/rings/polynomial/padics/polynomial_padic_capped_relative_dense.py +1324 -0
- sage/rings/polynomial/padics/polynomial_padic_flat.py +72 -0
- sage/rings/power_series_pari.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/power_series_pari.pxd +6 -0
- sage/rings/power_series_pari.pyx +934 -0
- sage/rings/tate_algebra.py +1282 -0
- sage/rings/tate_algebra_element.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/tate_algebra_element.pxd +49 -0
- sage/rings/tate_algebra_element.pyx +3464 -0
- sage/rings/tate_algebra_ideal.cpython-314-x86_64-linux-musl.so +0 -0
- sage/rings/tate_algebra_ideal.pxd +7 -0
- sage/rings/tate_algebra_ideal.pyx +1307 -0
- sage/rings/valuation/all.py +7 -0
- sage/rings/valuation/augmented_valuation.py +2118 -0
- sage/rings/valuation/developing_valuation.py +362 -0
- sage/rings/valuation/gauss_valuation.py +812 -0
- sage/rings/valuation/inductive_valuation.py +1686 -0
- sage/rings/valuation/limit_valuation.py +946 -0
- sage/rings/valuation/mapped_valuation.py +656 -0
- sage/rings/valuation/scaled_valuation.py +322 -0
- sage/rings/valuation/trivial_valuation.py +382 -0
- sage/rings/valuation/valuation.py +1119 -0
- sage/rings/valuation/valuation_space.py +1615 -0
- sage/rings/valuation/valuations_catalog.py +10 -0
- sage/rings/valuation/value_group.py +697 -0
- sage/schemes/all__sagemath_pari.py +1 -0
- sage/schemes/elliptic_curves/all__sagemath_pari.py +1 -0
- sage/schemes/elliptic_curves/descent_two_isogeny_pari.cpython-314-x86_64-linux-musl.so +0 -0
- sage/schemes/elliptic_curves/descent_two_isogeny_pari.pyx +46 -0
- sage_wheels/bin/gp +0 -0
- sage_wheels/bin/gp2c +0 -0
- sage_wheels/bin/gp2c-run +57 -0
- sage_wheels/bin/xeus-gp +0 -0
- sage_wheels/share/gp2c/func.dsc +18414 -0
sage/libs/pari/tests.py
ADDED
|
@@ -0,0 +1,1848 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-pari
|
|
2
|
+
r"""
|
|
3
|
+
Tests for the Sage <-> PARI interface
|
|
4
|
+
|
|
5
|
+
The default precision is 64 bits, see :issue:`21425`::
|
|
6
|
+
|
|
7
|
+
sage: pari("bitprecision(Pi)")
|
|
8
|
+
64
|
|
9
|
+
|
|
10
|
+
Sage-specific API checks:
|
|
11
|
+
|
|
12
|
+
Creating PARI objects::
|
|
13
|
+
|
|
14
|
+
sage: pari(Matrix(2,2,range(4))) # needs sage.modules
|
|
15
|
+
[0, 1; 2, 3]
|
|
16
|
+
sage: pari(x^2-3) # needs sage.symbolic
|
|
17
|
+
x^2 - 3
|
|
18
|
+
|
|
19
|
+
The following example caused Sage to crash before
|
|
20
|
+
:issue:`20630`::
|
|
21
|
+
|
|
22
|
+
sage: R.<theta> = QQ[]
|
|
23
|
+
sage: K.<a> = NumberField(theta^2 + 1) # needs sage.rings.number_field
|
|
24
|
+
sage: K.absolute_polynomial().galois_group(pari_group=True) # needs sage.groups sage.rings.number_field
|
|
25
|
+
PARI group [2, -1, 1, "S2"] of degree 2
|
|
26
|
+
|
|
27
|
+
Before :issue:`15654`, this used to take a very long time.
|
|
28
|
+
Now it takes much less than a second::
|
|
29
|
+
|
|
30
|
+
sage: pari.allocatemem(200000)
|
|
31
|
+
PARI stack size set to 200000 bytes, maximum size set to ...
|
|
32
|
+
sage: x = polygen(ZpFM(3,10)) # needs sage.rings.padics
|
|
33
|
+
sage: pol = ((x-1)^50 + x) # needs sage.rings.padics
|
|
34
|
+
sage: pari(pol).poldisc() # needs sage.rings.padics
|
|
35
|
+
2*3 + 3^4 + 2*3^6 + 3^7 + 2*3^8 + 2*3^9 + O(3^10)
|
|
36
|
+
|
|
37
|
+
This used to give the wrong answer before :issue:`23259`::
|
|
38
|
+
|
|
39
|
+
sage: R.<x> = QQ[]
|
|
40
|
+
sage: f = pari(x^12 + x^7 - 1/5*x^6 - 3*x^5 + 13/5*x^4 + 11/5*x^3 + 2/5*x^2 + 2/5*x + 1/5)
|
|
41
|
+
sage: g,h = f.polredabs(1)
|
|
42
|
+
sage: f.subst(x,h)
|
|
43
|
+
Mod(0, x^12 - 2*x^11 + 2*x^10 - 11*x^9 + 13*x^8 + 15*x^7 - x^6 - 5*x^5 + 5)
|
|
44
|
+
|
|
45
|
+
Getting the coefficients of a Laurent series behaves differently
|
|
46
|
+
in Sage and PARI. In PARI we get all coefficients starting
|
|
47
|
+
from the lowest degree term. This includes trailing zeros::
|
|
48
|
+
|
|
49
|
+
sage: R.<x> = LaurentSeriesRing(QQ)
|
|
50
|
+
sage: s = x^2 + O(x^8)
|
|
51
|
+
sage: s.list()
|
|
52
|
+
[1]
|
|
53
|
+
sage: pari(s).list()
|
|
54
|
+
[1, 0, 0, 0, 0, 0]
|
|
55
|
+
sage: s = x^-2 + O(x^0)
|
|
56
|
+
sage: s.list()
|
|
57
|
+
[1]
|
|
58
|
+
sage: pari(s).list()
|
|
59
|
+
[1, 0]
|
|
60
|
+
|
|
61
|
+
Number fields::
|
|
62
|
+
|
|
63
|
+
sage: # needs sage.rings.number_field
|
|
64
|
+
sage: x = polygen(QQ)
|
|
65
|
+
sage: K.<a> = NumberField(x^4 - 4*x^2 + 1)
|
|
66
|
+
sage: pari(K).nf_get_pol()
|
|
67
|
+
y^4 - 4*y^2 + 1
|
|
68
|
+
sage: L.<b> = K.extension(x^2 - 5)
|
|
69
|
+
sage: pari(L).nf_get_pol() # Absolute
|
|
70
|
+
y^8 - 28*y^6 + 208*y^4 - 408*y^2 + 36
|
|
71
|
+
sage: L.pari_rnf().nf_get_pol() # Relative
|
|
72
|
+
x^2 - 5
|
|
73
|
+
sage: K.pari_nf().nf_get_pol()
|
|
74
|
+
y^4 - 4*y^2 + 1
|
|
75
|
+
sage: K.pari_bnf().nf_get_pol()
|
|
76
|
+
y^4 - 4*y^2 + 1
|
|
77
|
+
|
|
78
|
+
sage: # needs sage.rings.number_field
|
|
79
|
+
sage: K.<a> = QuadraticField(-65)
|
|
80
|
+
sage: G = K.pari_bnf().bnf_get_gen(); G
|
|
81
|
+
[[3, 2; 0, 1], [2, 1; 0, 1]]
|
|
82
|
+
sage: [K.ideal(J) for J in G]
|
|
83
|
+
[Fractional ideal (3, a + 2), Fractional ideal (2, a + 1)]
|
|
84
|
+
|
|
85
|
+
Conversions::
|
|
86
|
+
|
|
87
|
+
sage: # needs sage.rings.number_field
|
|
88
|
+
sage: K.<i> = QuadraticField(-1)
|
|
89
|
+
sage: F = pari(K).idealfactor(K.ideal(5)); F
|
|
90
|
+
[[5, [-2, 1]~, 1, 1, [2, -1; 1, 2]], 1; [5, [2, 1]~, 1, 1, [-2, -1; 1, -2]], 1]
|
|
91
|
+
sage: F[0,0].pr_get_p()
|
|
92
|
+
5
|
|
93
|
+
sage: J = pari(K).idealstar(K.ideal(4*i + 2))
|
|
94
|
+
sage: J.bid_get_cyc()
|
|
95
|
+
[4, 2]
|
|
96
|
+
|
|
97
|
+
sage: int(pari(RealField(63)(2^63 - 1))) # needs sage.rings.real_mpfr
|
|
98
|
+
9223372036854775807
|
|
99
|
+
sage: int(pari(RealField(63)(2^63 + 2))) # needs sage.rings.real_mpfr
|
|
100
|
+
9223372036854775810
|
|
101
|
+
|
|
102
|
+
sage: # needs sage.rings.padics
|
|
103
|
+
sage: K = Qp(11,5)
|
|
104
|
+
sage: x = K(11^-10 + 5*11^-7 + 11^-6)
|
|
105
|
+
sage: y = pari(x)
|
|
106
|
+
sage: y.padicprime()
|
|
107
|
+
11
|
|
108
|
+
sage: y.padicprime().type()
|
|
109
|
+
't_INT'
|
|
110
|
+
|
|
111
|
+
sage: # needs sage.rings.finite_rings
|
|
112
|
+
sage: x = polygen(GF(3))
|
|
113
|
+
sage: k.<a> = GF(9, modulus=x^2 + 1)
|
|
114
|
+
sage: b = pari(a).ffprimroot()
|
|
115
|
+
sage: b # random
|
|
116
|
+
a + 1
|
|
117
|
+
sage: b.fforder()
|
|
118
|
+
8
|
|
119
|
+
|
|
120
|
+
sage: pari(4).Zn_issquare(30.factor())
|
|
121
|
+
True
|
|
122
|
+
sage: pari(4).Zn_sqrt(30.factor())
|
|
123
|
+
22
|
|
124
|
+
|
|
125
|
+
sage: a = pari(1/2); a, a.type()
|
|
126
|
+
(1/2, 't_FRAC')
|
|
127
|
+
|
|
128
|
+
Conversion from matrices and vectors is supported::
|
|
129
|
+
|
|
130
|
+
sage: a = pari(matrix(2,3,[1,2,3,4,5,6])); a, a.type() # needs sage.modules
|
|
131
|
+
([1, 2, 3; 4, 5, 6], 't_MAT')
|
|
132
|
+
sage: v = vector([1.2, 3.4, 5.6]) # needs sage.modules
|
|
133
|
+
sage: pari(v) # needs sage.modules
|
|
134
|
+
[1.20000000000000, 3.40000000000000, 5.60000000000000]
|
|
135
|
+
|
|
136
|
+
Some more exotic examples::
|
|
137
|
+
|
|
138
|
+
sage: # needs sage.rings.number_field
|
|
139
|
+
sage: K.<a> = NumberField(polygen(QQ)^3 - 2)
|
|
140
|
+
sage: pari(K)
|
|
141
|
+
[y^3 - 2, [1, 1], -108, 1, [[1, 1.25992104989487, 1.58740105196820; 1, -0.629960524947437 + 1.09112363597172*I, -0.793700525984100 - 1.37472963699860*I], [1, 1.25992104989487, 1.58740105196820; 1, 0.461163111024285, -2.16843016298270; 1, -1.72108416091916, 0.581029111014503], [16, 20, 25; 16, 7, -35; 16, -28, 9], [3, 0, 0; 0, 0, 6; 0, 6, 0], [6, 0, 0; 0, 6, 0; 0, 0, 3], [2, 0, 0; 0, 0, 1; 0, 1, 0], [2, [0, 0, 2; 1, 0, 0; 0, 1, 0]], [2, 3]], [1.25992104989487, -0.629960524947437 + 1.09112363597172*I], [1, y, y^2], [1, 0, 0; 0, 1, 0; 0, 0, 1], [1, 0, 0, 0, 0, 2, 0, 2, 0; 0, 1, 0, 1, 0, 0, 0, 0, 2; 0, 0, 1, 0, 1, 0, 1, 0, 0]]
|
|
142
|
+
|
|
143
|
+
sage: # needs database_cremona_mini_ellcurve sage.schemes
|
|
144
|
+
sage: E = EllipticCurve('37a1')
|
|
145
|
+
sage: pari(E)
|
|
146
|
+
[0, 0, 1, -1, 0, 0, -2, 1, -1, 48, -216, 37, 110592/37, Vecsmall([1]),
|
|
147
|
+
[Vecsmall([64, 1])], [0, 0, 0, 0, 0, 0, 0, 0]]
|
|
148
|
+
|
|
149
|
+
Deprecation checks::
|
|
150
|
+
|
|
151
|
+
sage: pari.poltchebi(10)
|
|
152
|
+
doctest:...: DeprecationWarning: the PARI/GP function poltchebi is obsolete (2013-04-03)
|
|
153
|
+
512*x^10 - 1280*x^8 + 1120*x^6 - 400*x^4 + 50*x^2 - 1
|
|
154
|
+
sage: pari("x^3 + 1").polsturm(-1, 1)
|
|
155
|
+
doctest:...: DeprecationWarning: argument 2 of the PARI/GP function polsturm is undocumented and deprecated
|
|
156
|
+
1
|
|
157
|
+
sage: x = pari('10^100')
|
|
158
|
+
sage: x.Str().length()
|
|
159
|
+
101
|
|
160
|
+
sage: x.sizedigit()
|
|
161
|
+
doctest:...: DeprecationWarning: the PARI/GP function sizedigit is obsolete (2015-01-13)
|
|
162
|
+
101
|
|
163
|
+
sage: x = pari('1.234')
|
|
164
|
+
sage: x
|
|
165
|
+
1.23400000000000
|
|
166
|
+
sage: x.sizedigit()
|
|
167
|
+
1
|
|
168
|
+
sage: pari('7234.1').sizedigit()
|
|
169
|
+
4
|
|
170
|
+
sage: pari('9234.1').sizedigit()
|
|
171
|
+
5
|
|
172
|
+
sage: [pari(2*n).bernfrac() for n in range(9)]
|
|
173
|
+
[1, 1/6, -1/30, 1/42, -1/30, 5/66, -691/2730, 7/6, -3617/510]
|
|
174
|
+
sage: e = pari([0,1,1,-2,0]).ellinit()
|
|
175
|
+
sage: e.elllseries(2.1)
|
|
176
|
+
doctest:...: DeprecationWarning: the PARI/GP function elllseries is obsolete (2016-08-08)
|
|
177
|
+
0.402838047956645
|
|
178
|
+
sage: e.elllseries(1, precision=128)
|
|
179
|
+
-6.17606670058278 E-39
|
|
180
|
+
sage: e.elllseries(1, precision=256)
|
|
181
|
+
-2.05598131842639 E-77
|
|
182
|
+
sage: e.elllseries(-2)
|
|
183
|
+
0
|
|
184
|
+
sage: e.elllseries(2.1, A=1.1)
|
|
185
|
+
0.402838047956645
|
|
186
|
+
|
|
187
|
+
A long list of doctests which used to be part of manually written code
|
|
188
|
+
which is now automatically generated:
|
|
189
|
+
|
|
190
|
+
Reading a gp file::
|
|
191
|
+
|
|
192
|
+
sage: import tempfile
|
|
193
|
+
sage: gpfile = tempfile.NamedTemporaryFile(mode='w')
|
|
194
|
+
sage: __ = gpfile.file.write("mysquare(n) = {\n")
|
|
195
|
+
sage: __ = gpfile.file.write(" n^2;\n")
|
|
196
|
+
sage: __ = gpfile.file.write("}\n")
|
|
197
|
+
sage: __ = gpfile.file.write("polcyclo(5)\n")
|
|
198
|
+
sage: gpfile.file.flush()
|
|
199
|
+
sage: pari.read(gpfile.name)
|
|
200
|
+
x^4 + x^3 + x^2 + x + 1
|
|
201
|
+
sage: pari('mysquare(12)')
|
|
202
|
+
144
|
|
203
|
+
|
|
204
|
+
Constants::
|
|
205
|
+
|
|
206
|
+
sage: pari.euler()
|
|
207
|
+
0.577215664901533
|
|
208
|
+
sage: pari.euler(precision=100).sage()
|
|
209
|
+
0.577215664901532860606512090082...
|
|
210
|
+
sage: pari.pi()
|
|
211
|
+
3.14159265358979
|
|
212
|
+
sage: pari.pi(precision=100).sage()
|
|
213
|
+
3.1415926535897932384626433832...
|
|
214
|
+
|
|
215
|
+
Polynomial functions::
|
|
216
|
+
|
|
217
|
+
sage: R.<x> = PolynomialRing(ZZ)
|
|
218
|
+
sage: pari(2*x^2 + 2).content()
|
|
219
|
+
2
|
|
220
|
+
sage: pari("4*x^3 - 2*x/3 + 2/5").content()
|
|
221
|
+
2/15
|
|
222
|
+
|
|
223
|
+
sage: x = pari('y^8+6*y^6-27*y^5+1/9*y^2-y+1')
|
|
224
|
+
sage: x.newtonpoly(3)
|
|
225
|
+
[1, 1, -1/3, -1/3, -1/3, -1/3, -1/3, -1/3]
|
|
226
|
+
|
|
227
|
+
sage: f = pari("x^2 + y^3 + x*y")
|
|
228
|
+
sage: f
|
|
229
|
+
x^2 + y*x + y^3
|
|
230
|
+
sage: f.polcoef(1)
|
|
231
|
+
y
|
|
232
|
+
sage: f.polcoef(3)
|
|
233
|
+
0
|
|
234
|
+
sage: f.polcoef(3, "y")
|
|
235
|
+
1
|
|
236
|
+
sage: f.polcoef(1, "y")
|
|
237
|
+
x
|
|
238
|
+
|
|
239
|
+
sage: pari("x^2 + 1").poldisc()
|
|
240
|
+
-4
|
|
241
|
+
|
|
242
|
+
sage: pari.pollegendre(7)
|
|
243
|
+
429/16*x^7 - 693/16*x^5 + 315/16*x^3 - 35/16*x
|
|
244
|
+
sage: pari.pollegendre(7, 'z')
|
|
245
|
+
429/16*z^7 - 693/16*z^5 + 315/16*z^3 - 35/16*z
|
|
246
|
+
sage: pari.pollegendre(0)
|
|
247
|
+
1
|
|
248
|
+
|
|
249
|
+
sage: pari.polcyclo(8)
|
|
250
|
+
x^4 + 1
|
|
251
|
+
sage: pari.polcyclo(7, 'z')
|
|
252
|
+
z^6 + z^5 + z^4 + z^3 + z^2 + z + 1
|
|
253
|
+
sage: pari.polcyclo(1)
|
|
254
|
+
x - 1
|
|
255
|
+
|
|
256
|
+
Power series::
|
|
257
|
+
|
|
258
|
+
sage: f = pari('x+x^2+x^3+O(x^4)'); f
|
|
259
|
+
x + x^2 + x^3 + O(x^4)
|
|
260
|
+
sage: g = f.serreverse(); g
|
|
261
|
+
x - x^2 + x^3 + O(x^4)
|
|
262
|
+
sage: f.subst('x',g)
|
|
263
|
+
x + O(x^4)
|
|
264
|
+
sage: g.subst('x',f)
|
|
265
|
+
x + O(x^4)
|
|
266
|
+
|
|
267
|
+
Random seed::
|
|
268
|
+
|
|
269
|
+
sage: a = pari.getrand()
|
|
270
|
+
sage: a.type()
|
|
271
|
+
't_INT'
|
|
272
|
+
|
|
273
|
+
Constructors::
|
|
274
|
+
|
|
275
|
+
sage: v = pari([1,2,3])
|
|
276
|
+
sage: v
|
|
277
|
+
[1, 2, 3]
|
|
278
|
+
sage: v.type()
|
|
279
|
+
't_VEC'
|
|
280
|
+
sage: w = v.List()
|
|
281
|
+
sage: w
|
|
282
|
+
List([1, 2, 3])
|
|
283
|
+
sage: w.type()
|
|
284
|
+
't_LIST'
|
|
285
|
+
|
|
286
|
+
sage: x = pari(5)
|
|
287
|
+
sage: x.type()
|
|
288
|
+
't_INT'
|
|
289
|
+
sage: y = x.Mat()
|
|
290
|
+
sage: y
|
|
291
|
+
Mat(5)
|
|
292
|
+
sage: y.type()
|
|
293
|
+
't_MAT'
|
|
294
|
+
sage: x = pari('[1,2;3,4]')
|
|
295
|
+
sage: x.type()
|
|
296
|
+
't_MAT'
|
|
297
|
+
sage: x = pari('[1,2,3,4]')
|
|
298
|
+
sage: x.type()
|
|
299
|
+
't_VEC'
|
|
300
|
+
sage: y = x.Mat()
|
|
301
|
+
sage: y
|
|
302
|
+
Mat([1, 2, 3, 4])
|
|
303
|
+
sage: y.type()
|
|
304
|
+
't_MAT'
|
|
305
|
+
|
|
306
|
+
sage: v = pari('[1,2;3,4]').Vec(); v
|
|
307
|
+
[[1, 3]~, [2, 4]~]
|
|
308
|
+
sage: v.Mat()
|
|
309
|
+
[1, 2; 3, 4]
|
|
310
|
+
sage: v = pari('[1,2;3,4]').Col(); v
|
|
311
|
+
[[1, 2], [3, 4]]~
|
|
312
|
+
sage: v.Mat()
|
|
313
|
+
[1, 2; 3, 4]
|
|
314
|
+
|
|
315
|
+
sage: z = pari(3)
|
|
316
|
+
sage: x = z.Mod(pari(7))
|
|
317
|
+
sage: x
|
|
318
|
+
Mod(3, 7)
|
|
319
|
+
sage: x^2
|
|
320
|
+
Mod(2, 7)
|
|
321
|
+
sage: x^100
|
|
322
|
+
Mod(4, 7)
|
|
323
|
+
sage: x.type()
|
|
324
|
+
't_INTMOD'
|
|
325
|
+
sage: f = pari("x^2 + x + 1")
|
|
326
|
+
sage: g = pari("x")
|
|
327
|
+
sage: a = g.Mod(f)
|
|
328
|
+
sage: a
|
|
329
|
+
Mod(x, x^2 + x + 1)
|
|
330
|
+
sage: a*a
|
|
331
|
+
Mod(-x - 1, x^2 + x + 1)
|
|
332
|
+
sage: a.type()
|
|
333
|
+
't_POLMOD'
|
|
334
|
+
|
|
335
|
+
sage: v = pari("[1,2,3,4]")
|
|
336
|
+
sage: f = v.Pol()
|
|
337
|
+
sage: f
|
|
338
|
+
x^3 + 2*x^2 + 3*x + 4
|
|
339
|
+
sage: f*f
|
|
340
|
+
x^6 + 4*x^5 + 10*x^4 + 20*x^3 + 25*x^2 + 24*x + 16
|
|
341
|
+
|
|
342
|
+
sage: v = pari("[1,2;3,4]")
|
|
343
|
+
sage: v.Pol()
|
|
344
|
+
[1, 3]~*x + [2, 4]~
|
|
345
|
+
|
|
346
|
+
sage: v = pari("[1,2,3,4]")
|
|
347
|
+
sage: f = v.Polrev()
|
|
348
|
+
sage: f
|
|
349
|
+
4*x^3 + 3*x^2 + 2*x + 1
|
|
350
|
+
sage: v.Pol()
|
|
351
|
+
x^3 + 2*x^2 + 3*x + 4
|
|
352
|
+
sage: v.Polrev('y')
|
|
353
|
+
4*y^3 + 3*y^2 + 2*y + 1
|
|
354
|
+
|
|
355
|
+
sage: f
|
|
356
|
+
4*x^3 + 3*x^2 + 2*x + 1
|
|
357
|
+
sage: f.Polrev()
|
|
358
|
+
4*x^3 + 3*x^2 + 2*x + 1
|
|
359
|
+
sage: v = pari("[1,2;3,4]")
|
|
360
|
+
sage: v.Polrev()
|
|
361
|
+
[2, 4]~*x + [1, 3]~
|
|
362
|
+
|
|
363
|
+
sage: pari(3).Qfb(7, 1)
|
|
364
|
+
Qfb(3, 7, 1)
|
|
365
|
+
sage: pari(3).Qfb(7, 2)
|
|
366
|
+
Traceback (most recent call last):
|
|
367
|
+
...
|
|
368
|
+
PariError: domain error in Qfb: issquare(disc) = 1
|
|
369
|
+
|
|
370
|
+
sage: pari([1,5,2]).Set()
|
|
371
|
+
[1, 2, 5]
|
|
372
|
+
sage: pari([]).Set()
|
|
373
|
+
[]
|
|
374
|
+
sage: pari([1,1,-1,-1,3,3]).Set()
|
|
375
|
+
[-1, 1, 3]
|
|
376
|
+
sage: pari(1).Set()
|
|
377
|
+
[1]
|
|
378
|
+
sage: pari('1/(x*y)').Set()
|
|
379
|
+
[1/(y*x)]
|
|
380
|
+
sage: pari('["bc","ab","bc"]').Set()
|
|
381
|
+
["ab", "bc"]
|
|
382
|
+
|
|
383
|
+
sage: pari([65,66,123]).strchr()
|
|
384
|
+
"AB{"
|
|
385
|
+
sage: pari('"Sage"').Vecsmall()
|
|
386
|
+
Vecsmall([83, 97, 103, 101])
|
|
387
|
+
sage: _.strchr()
|
|
388
|
+
"Sage"
|
|
389
|
+
sage: pari([83, 97, 103, 101]).strchr()
|
|
390
|
+
"Sage"
|
|
391
|
+
|
|
392
|
+
Basic functions::
|
|
393
|
+
|
|
394
|
+
sage: pari(0).binary()
|
|
395
|
+
[]
|
|
396
|
+
sage: pari(-5).binary()
|
|
397
|
+
[1, 0, 1]
|
|
398
|
+
sage: pari(5).binary()
|
|
399
|
+
[1, 0, 1]
|
|
400
|
+
sage: pari(2005).binary()
|
|
401
|
+
[1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1]
|
|
402
|
+
sage: pari('"2"').binary()
|
|
403
|
+
Traceback (most recent call last):
|
|
404
|
+
...
|
|
405
|
+
PariError: incorrect type in binary (t_STR)
|
|
406
|
+
|
|
407
|
+
sage: pari(1.4).ceil()
|
|
408
|
+
2
|
|
409
|
+
sage: pari(-1.4).ceil()
|
|
410
|
+
-1
|
|
411
|
+
sage: pari(3/4).ceil()
|
|
412
|
+
1
|
|
413
|
+
|
|
414
|
+
sage: # needs sage.symbolic
|
|
415
|
+
sage: x = SR.symbol('x')
|
|
416
|
+
sage: pari(x).ceil()
|
|
417
|
+
x
|
|
418
|
+
sage: pari((x^2+x+1)/x).ceil()
|
|
419
|
+
x + 1
|
|
420
|
+
sage: pari(x^2+5*x+2.5).ceil()
|
|
421
|
+
x^2 + 5*x + 2.50000000000000
|
|
422
|
+
|
|
423
|
+
sage: x = pari(-2).Mod(5)
|
|
424
|
+
sage: x.centerlift()
|
|
425
|
+
-2
|
|
426
|
+
sage: x.lift()
|
|
427
|
+
3
|
|
428
|
+
sage: f = pari('x-1').Mod('x^2 + 1')
|
|
429
|
+
sage: f.centerlift()
|
|
430
|
+
x - 1
|
|
431
|
+
sage: f.lift()
|
|
432
|
+
x - 1
|
|
433
|
+
sage: f = pari('x-y').Mod('x^2+1')
|
|
434
|
+
sage: f
|
|
435
|
+
Mod(x - y, x^2 + 1)
|
|
436
|
+
sage: f.centerlift('x')
|
|
437
|
+
x - y
|
|
438
|
+
sage: f.centerlift('y')
|
|
439
|
+
Mod(x - y, x^2 + 1)
|
|
440
|
+
sage: pari("Mod(3,5)").lift_centered()
|
|
441
|
+
-2
|
|
442
|
+
|
|
443
|
+
sage: pari([0,1,2,3,4]).component(1)
|
|
444
|
+
0
|
|
445
|
+
sage: pari([0,1,2,3,4]).component(2)
|
|
446
|
+
1
|
|
447
|
+
sage: pari([0,1,2,3,4]).component(4)
|
|
448
|
+
3
|
|
449
|
+
sage: pari('x^3 + 2').component(1)
|
|
450
|
+
2
|
|
451
|
+
sage: pari('x^3 + 2').component(2)
|
|
452
|
+
0
|
|
453
|
+
sage: pari('x^3 + 2').component(4)
|
|
454
|
+
1
|
|
455
|
+
sage: pari('x').component(0)
|
|
456
|
+
Traceback (most recent call last):
|
|
457
|
+
...
|
|
458
|
+
PariError: nonexistent component: index < 1
|
|
459
|
+
|
|
460
|
+
sage: pari('x+1').conj()
|
|
461
|
+
x + 1
|
|
462
|
+
sage: pari('x+I').conj()
|
|
463
|
+
x - I
|
|
464
|
+
sage: pari('1/(2*x+3*I)').conj()
|
|
465
|
+
1/(2*x - 3*I)
|
|
466
|
+
sage: pari([1,2,'2-I','Mod(x,x^2+1)', 'Mod(x,x^2-2)']).conj()
|
|
467
|
+
[1, 2, 2 + I, Mod(-x, x^2 + 1), Mod(-x, x^2 - 2)]
|
|
468
|
+
sage: pari('Mod(x,x^2-2)').conj()
|
|
469
|
+
Mod(-x, x^2 - 2)
|
|
470
|
+
sage: pari('Mod(x,x^3-3)').conj()
|
|
471
|
+
Traceback (most recent call last):
|
|
472
|
+
...
|
|
473
|
+
PariError: incorrect type in gconj (t_POLMOD)
|
|
474
|
+
|
|
475
|
+
sage: pari('Mod(1+x,x^2-2)').conjvec()
|
|
476
|
+
[-0.414213562373095, 2.41421356237310]~
|
|
477
|
+
sage: pari('Mod(x,x^3-3)').conjvec()
|
|
478
|
+
[1.44224957030741, -0.721124785153704 - 1.24902476648341*I, -0.721124785153704 + 1.24902476648341*I]~
|
|
479
|
+
sage: pari('Mod(1+x,x^2-2)').conjvec(precision=192)[0].sage()
|
|
480
|
+
-0.414213562373095048801688724209698078569671875376948073177
|
|
481
|
+
|
|
482
|
+
sage: pari('5/9').denominator()
|
|
483
|
+
9
|
|
484
|
+
sage: pari('(x+1)/(x-2)').denominator()
|
|
485
|
+
x - 2
|
|
486
|
+
sage: pari('2/3 + 5/8*x + 7/3*x^2 + 1/5*y').denominator()
|
|
487
|
+
1
|
|
488
|
+
sage: pari('2/3*x').denominator()
|
|
489
|
+
1
|
|
490
|
+
sage: pari('[2/3, 5/8, 7/3, 1/5]').denominator()
|
|
491
|
+
120
|
|
492
|
+
|
|
493
|
+
sage: pari(5/9).floor()
|
|
494
|
+
0
|
|
495
|
+
sage: pari(11/9).floor()
|
|
496
|
+
1
|
|
497
|
+
sage: pari(1.17).floor()
|
|
498
|
+
1
|
|
499
|
+
sage: pari([1.5,2.3,4.99]).floor()
|
|
500
|
+
[1, 2, 4]
|
|
501
|
+
sage: pari([[1.1,2.2],[3.3,4.4]]).floor()
|
|
502
|
+
[[1, 2], [3, 4]]
|
|
503
|
+
|
|
504
|
+
sage: # needs sage.symbolic
|
|
505
|
+
sage: x = SR.symbol('x')
|
|
506
|
+
sage: pari(x).floor()
|
|
507
|
+
x
|
|
508
|
+
sage: pari((x^2+x+1)/x).floor()
|
|
509
|
+
x + 1
|
|
510
|
+
sage: pari(x^2+5*x+2.5).floor()
|
|
511
|
+
x^2 + 5*x + 2.50000000000000
|
|
512
|
+
|
|
513
|
+
sage: pari('"hello world"').floor()
|
|
514
|
+
Traceback (most recent call last):
|
|
515
|
+
...
|
|
516
|
+
PariError: incorrect type in gfloor (t_STR)
|
|
517
|
+
|
|
518
|
+
sage: pari(1.75).frac()
|
|
519
|
+
0.750000000000000
|
|
520
|
+
sage: pari(sqrt(2)).frac() # needs sage.symbolic
|
|
521
|
+
0.414213562373095
|
|
522
|
+
sage: pari('sqrt(-2)').frac()
|
|
523
|
+
Traceback (most recent call last):
|
|
524
|
+
...
|
|
525
|
+
PariError: incorrect type in gfrac (t_COMPLEX)
|
|
526
|
+
|
|
527
|
+
sage: pari('1+2*I').imag()
|
|
528
|
+
2
|
|
529
|
+
sage: pari(sqrt(-2)).imag() # needs sage.symbolic
|
|
530
|
+
1.41421356237310
|
|
531
|
+
sage: pari('x+I').imag()
|
|
532
|
+
1
|
|
533
|
+
sage: pari('x+2*I').imag()
|
|
534
|
+
2
|
|
535
|
+
sage: pari('(1+I)*x^2+2*I').imag()
|
|
536
|
+
x^2 + 2
|
|
537
|
+
sage: pari('[1,2,3] + [4*I,5,6]').imag()
|
|
538
|
+
[4, 0, 0]
|
|
539
|
+
|
|
540
|
+
sage: x = pari("x")
|
|
541
|
+
sage: a = x.Mod('x^3 + 17*x + 3')
|
|
542
|
+
sage: a
|
|
543
|
+
Mod(x, x^3 + 17*x + 3)
|
|
544
|
+
sage: b = a^4; b
|
|
545
|
+
Mod(-17*x^2 - 3*x, x^3 + 17*x + 3)
|
|
546
|
+
sage: b.lift()
|
|
547
|
+
-17*x^2 - 3*x
|
|
548
|
+
|
|
549
|
+
sage: pari(pi).sign() # needs sage.symbolic
|
|
550
|
+
1
|
|
551
|
+
sage: pari(0).sign()
|
|
552
|
+
0
|
|
553
|
+
sage: pari(-1/2).sign()
|
|
554
|
+
-1
|
|
555
|
+
sage: pari(SR(I)).sign() # needs sage.symbolic
|
|
556
|
+
Traceback (most recent call last):
|
|
557
|
+
...
|
|
558
|
+
PariError: incorrect type in gsigne (t_COMPLEX)
|
|
559
|
+
sage: pari(I).sign() # needs sage.symbolic
|
|
560
|
+
Traceback (most recent call last):
|
|
561
|
+
...
|
|
562
|
+
PariError: incorrect type in gsigne (t_POLMOD)
|
|
563
|
+
|
|
564
|
+
sage: y = pari('y')
|
|
565
|
+
sage: x = pari('9') + y - y
|
|
566
|
+
sage: x
|
|
567
|
+
9
|
|
568
|
+
sage: x.type()
|
|
569
|
+
't_POL'
|
|
570
|
+
sage: x.factor()
|
|
571
|
+
matrix(0,2)
|
|
572
|
+
sage: pari('9').factor()
|
|
573
|
+
Mat([3, 2])
|
|
574
|
+
sage: x.simplify()
|
|
575
|
+
9
|
|
576
|
+
sage: x.simplify().factor()
|
|
577
|
+
Mat([3, 2])
|
|
578
|
+
sage: x = pari('1.5 + 0*I')
|
|
579
|
+
sage: x.type()
|
|
580
|
+
't_REAL'
|
|
581
|
+
sage: x.simplify()
|
|
582
|
+
1.50000000000000
|
|
583
|
+
sage: y = x.simplify()
|
|
584
|
+
sage: y.type()
|
|
585
|
+
't_REAL'
|
|
586
|
+
|
|
587
|
+
sage: pari(2).sqr()
|
|
588
|
+
4
|
|
589
|
+
sage: pari("1+O(2^5)").sqr()
|
|
590
|
+
1 + O(2^6)
|
|
591
|
+
sage: pari("1+O(2^5)")*pari("1+O(2^5)")
|
|
592
|
+
1 + O(2^5)
|
|
593
|
+
sage: x = pari("1+O(2^5)"); x*x
|
|
594
|
+
1 + O(2^6)
|
|
595
|
+
|
|
596
|
+
sage: x = pari("x"); y = pari("y")
|
|
597
|
+
sage: f = pari('x^3 + 17*x + 3')
|
|
598
|
+
sage: f.subst(x, y)
|
|
599
|
+
y^3 + 17*y + 3
|
|
600
|
+
sage: f.subst(x, "z")
|
|
601
|
+
z^3 + 17*z + 3
|
|
602
|
+
sage: f.subst(x, "z")^2
|
|
603
|
+
z^6 + 34*z^4 + 6*z^3 + 289*z^2 + 102*z + 9
|
|
604
|
+
sage: f.subst(x, "x+1")
|
|
605
|
+
x^3 + 3*x^2 + 20*x + 21
|
|
606
|
+
sage: f.subst(x, "xyz")
|
|
607
|
+
xyz^3 + 17*xyz + 3
|
|
608
|
+
sage: f.subst(x, "xyz")^2
|
|
609
|
+
xyz^6 + 34*xyz^4 + 6*xyz^3 + 289*xyz^2 + 102*xyz + 9
|
|
610
|
+
|
|
611
|
+
sage: pari(9).valuation(3)
|
|
612
|
+
2
|
|
613
|
+
sage: pari(9).valuation(9)
|
|
614
|
+
1
|
|
615
|
+
sage: x = pari(9).Mod(27); x.valuation(3)
|
|
616
|
+
2
|
|
617
|
+
sage: pari('5/3').valuation(3)
|
|
618
|
+
-1
|
|
619
|
+
sage: pari('9 + 3*x + 15*x^2').valuation(3)
|
|
620
|
+
1
|
|
621
|
+
sage: pari([9,3,15]).valuation(3)
|
|
622
|
+
1
|
|
623
|
+
sage: pari('9 + 3*x + 15*x^2 + O(x^5)').valuation(3)
|
|
624
|
+
1
|
|
625
|
+
sage: pari('x^2*(x+1)^3').valuation(pari('x+1'))
|
|
626
|
+
3
|
|
627
|
+
sage: pari('x + O(x^5)').valuation('x')
|
|
628
|
+
1
|
|
629
|
+
sage: pari('2*x^2 + O(x^5)').valuation('x')
|
|
630
|
+
2
|
|
631
|
+
sage: pari(0).valuation(3)
|
|
632
|
+
+oo
|
|
633
|
+
|
|
634
|
+
sage: pari('x^2 + x -2').variable()
|
|
635
|
+
x
|
|
636
|
+
sage: pari('1+2^3 + O(2^5)').variable()
|
|
637
|
+
2
|
|
638
|
+
sage: pari('x+y0').variable()
|
|
639
|
+
x
|
|
640
|
+
sage: pari('y0+z0').variable()
|
|
641
|
+
y0
|
|
642
|
+
|
|
643
|
+
Bitwise functions::
|
|
644
|
+
|
|
645
|
+
sage: pari(8).bitand(4)
|
|
646
|
+
0
|
|
647
|
+
sage: pari(8).bitand(8)
|
|
648
|
+
8
|
|
649
|
+
sage: pari(6).binary()
|
|
650
|
+
[1, 1, 0]
|
|
651
|
+
sage: pari(7).binary()
|
|
652
|
+
[1, 1, 1]
|
|
653
|
+
sage: pari(6).bitand(7)
|
|
654
|
+
6
|
|
655
|
+
sage: pari(19).bitand(-1)
|
|
656
|
+
19
|
|
657
|
+
sage: pari(-1).bitand(-1)
|
|
658
|
+
-1
|
|
659
|
+
|
|
660
|
+
sage: pari(10).bitneg()
|
|
661
|
+
-11
|
|
662
|
+
sage: pari(1).bitneg()
|
|
663
|
+
-2
|
|
664
|
+
sage: pari(-2).bitneg()
|
|
665
|
+
1
|
|
666
|
+
sage: pari(-1).bitneg()
|
|
667
|
+
0
|
|
668
|
+
sage: pari(569).bitneg()
|
|
669
|
+
-570
|
|
670
|
+
sage: pari(569).bitneg(10)
|
|
671
|
+
454
|
|
672
|
+
sage: 454 % 2^10
|
|
673
|
+
454
|
|
674
|
+
sage: -570 % 2^10
|
|
675
|
+
454
|
|
676
|
+
|
|
677
|
+
sage: pari(14).bitnegimply(0)
|
|
678
|
+
14
|
|
679
|
+
sage: pari(8).bitnegimply(8)
|
|
680
|
+
0
|
|
681
|
+
sage: pari(8+4).bitnegimply(8)
|
|
682
|
+
4
|
|
683
|
+
|
|
684
|
+
sage: pari(14).bitor(0)
|
|
685
|
+
14
|
|
686
|
+
sage: pari(8).bitor(4)
|
|
687
|
+
12
|
|
688
|
+
sage: pari(12).bitor(1)
|
|
689
|
+
13
|
|
690
|
+
sage: pari(13).bitor(1)
|
|
691
|
+
13
|
|
692
|
+
|
|
693
|
+
sage: pari(6).bitxor(4)
|
|
694
|
+
2
|
|
695
|
+
sage: pari(0).bitxor(4)
|
|
696
|
+
4
|
|
697
|
+
sage: pari(6).bitxor(0)
|
|
698
|
+
6
|
|
699
|
+
|
|
700
|
+
Transcendental functions::
|
|
701
|
+
|
|
702
|
+
sage: x = pari("-27.1")
|
|
703
|
+
sage: x.abs()
|
|
704
|
+
27.1000000000000
|
|
705
|
+
sage: pari('1 + I').abs(precision=128).sage()
|
|
706
|
+
1.4142135623730950488016887242096980786
|
|
707
|
+
sage: pari('x-1.2*x^2').abs()
|
|
708
|
+
1.20000000000000*x^2 - x
|
|
709
|
+
sage: pari('-2 + t + O(t^2)').abs()
|
|
710
|
+
2 - t + O(t^2)
|
|
711
|
+
|
|
712
|
+
sage: pari(0.5).acos()
|
|
713
|
+
1.04719755119660
|
|
714
|
+
sage: pari(1/2).acos()
|
|
715
|
+
1.04719755119660
|
|
716
|
+
sage: pari(1.1).acos()
|
|
717
|
+
0.443568254385115*I
|
|
718
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
719
|
+
sage: pari(1.1+i).acos() # needs sage.rings.real_mpfr
|
|
720
|
+
0.849343054245252 - 1.09770986682533*I
|
|
721
|
+
|
|
722
|
+
sage: pari(2).acosh()
|
|
723
|
+
1.31695789692482
|
|
724
|
+
sage: pari(0).acosh()
|
|
725
|
+
1.57079632679490*I
|
|
726
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
727
|
+
sage: pari(i).acosh() # needs sage.rings.real_mpfr
|
|
728
|
+
0.881373587019543 + 1.57079632679490*I
|
|
729
|
+
|
|
730
|
+
sage: pari(2).agm(2)
|
|
731
|
+
2.00000000000000
|
|
732
|
+
sage: pari(0).agm(1)
|
|
733
|
+
0
|
|
734
|
+
sage: pari(1).agm(2)
|
|
735
|
+
1.45679103104691
|
|
736
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
737
|
+
sage: pari(1+i).agm(-3) # needs sage.rings.real_mpfr
|
|
738
|
+
-0.964731722290876 + 1.15700282952632*I
|
|
739
|
+
|
|
740
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
741
|
+
sage: pari(2+i).arg() # needs sage.rings.real_mpfr
|
|
742
|
+
0.463647609000806
|
|
743
|
+
|
|
744
|
+
sage: pari(pari(0.5).sin()).asin()
|
|
745
|
+
0.500000000000000
|
|
746
|
+
sage: pari(2).asin()
|
|
747
|
+
1.57079632679490 - 1.31695789692482*I
|
|
748
|
+
|
|
749
|
+
sage: pari(2).asinh()
|
|
750
|
+
1.44363547517881
|
|
751
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
752
|
+
sage: pari(2+i).asinh() # needs sage.rings.real_mpfr
|
|
753
|
+
1.52857091948100 + 0.427078586392476*I
|
|
754
|
+
|
|
755
|
+
sage: pari(1).atan()
|
|
756
|
+
0.785398163397448
|
|
757
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
758
|
+
sage: pari(1.5+i).atan() # needs sage.rings.real_mpfr
|
|
759
|
+
1.10714871779409 + 0.255412811882995*I
|
|
760
|
+
|
|
761
|
+
sage: pari(0).atanh()
|
|
762
|
+
0.E-19
|
|
763
|
+
sage: pari(2).atanh()
|
|
764
|
+
0.549306144334055 - 1.57079632679490*I
|
|
765
|
+
|
|
766
|
+
sage: pari(2).besselh1(3)
|
|
767
|
+
0.486091260585891 - 0.160400393484924*I
|
|
768
|
+
sage: pari(2).besselh2(3)
|
|
769
|
+
0.486091260585891 + 0.160400393484924*I
|
|
770
|
+
sage: pari(2).besselj(3)
|
|
771
|
+
0.486091260585891
|
|
772
|
+
sage: pari(2).besseljh(3)
|
|
773
|
+
0.412710032209716
|
|
774
|
+
sage: pari(2).besseli(3)
|
|
775
|
+
2.24521244092995
|
|
776
|
+
|
|
777
|
+
sage: # needs sage.rings.real_mpfr
|
|
778
|
+
sage: C.<i> = ComplexField()
|
|
779
|
+
sage: pari(2).besseli(3+i)
|
|
780
|
+
1.12539407613913 + 2.08313822670661*I
|
|
781
|
+
sage: C.<i> = ComplexField()
|
|
782
|
+
sage: pari(2+i).bessely(3)
|
|
783
|
+
-0.280775566958244 - 0.486708533223726*I
|
|
784
|
+
|
|
785
|
+
sage: pari(1.5).cos()
|
|
786
|
+
0.0707372016677029
|
|
787
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
788
|
+
sage: pari(1+i).cos() # needs sage.rings.real_mpfr
|
|
789
|
+
0.833730025131149 - 0.988897705762865*I
|
|
790
|
+
sage: pari('x+O(x^8)').cos()
|
|
791
|
+
1 - 1/2*x^2 + 1/24*x^4 - 1/720*x^6 + 1/40320*x^8 + O(x^9)
|
|
792
|
+
|
|
793
|
+
sage: pari(1.5).cosh()
|
|
794
|
+
2.35240961524325
|
|
795
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
796
|
+
sage: pari(1+i).cosh() # needs sage.rings.real_mpfr
|
|
797
|
+
0.833730025131149 + 0.988897705762865*I
|
|
798
|
+
sage: pari('x+O(x^8)').cosh()
|
|
799
|
+
1 + 1/2*x^2 + 1/24*x^4 + 1/720*x^6 + ...O(...)
|
|
800
|
+
|
|
801
|
+
sage: pari(5).cotan()
|
|
802
|
+
-0.295812915532746
|
|
803
|
+
sage: x = RR(pi) # needs sage.symbolic
|
|
804
|
+
sage: pari(x).cotan() # random
|
|
805
|
+
-8.17674825 E15
|
|
806
|
+
|
|
807
|
+
sage: pari(1).dilog()
|
|
808
|
+
1.64493406684823
|
|
809
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
810
|
+
sage: pari(1+i).dilog() # needs sage.rings.real_mpfr
|
|
811
|
+
0.616850275068085 + 1.46036211675312*I
|
|
812
|
+
|
|
813
|
+
sage: pari(1).erfc()
|
|
814
|
+
0.157299207050285
|
|
815
|
+
|
|
816
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
817
|
+
sage: pari(i).eta() # needs sage.rings.real_mpfr
|
|
818
|
+
0.998129069925959
|
|
819
|
+
|
|
820
|
+
sage: pari(0).exp()
|
|
821
|
+
1.00000000000000
|
|
822
|
+
sage: pari(1).exp()
|
|
823
|
+
2.71828182845905
|
|
824
|
+
sage: pari('x+O(x^8)').exp()
|
|
825
|
+
1 + x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5 + 1/720*x^6 + 1/5040*x^7 + O(x^8)
|
|
826
|
+
|
|
827
|
+
sage: pari(2).gamma()
|
|
828
|
+
1.00000000000000
|
|
829
|
+
sage: pari(5).gamma()
|
|
830
|
+
24.0000000000000
|
|
831
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
832
|
+
sage: pari(1+i).gamma() # needs sage.rings.real_mpfr
|
|
833
|
+
0.498015668118356 - 0.154949828301811*I
|
|
834
|
+
sage: pari(-1).gamma()
|
|
835
|
+
Traceback (most recent call last):
|
|
836
|
+
...
|
|
837
|
+
PariError: domain error in gamma: argument = nonpositive integer
|
|
838
|
+
|
|
839
|
+
sage: pari(2).gammah()
|
|
840
|
+
1.32934038817914
|
|
841
|
+
sage: pari(5).gammah()
|
|
842
|
+
52.3427777845535
|
|
843
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
844
|
+
sage: pari(1+i).gammah() # needs sage.rings.real_mpfr
|
|
845
|
+
0.575315188063452 + 0.0882106775440939*I
|
|
846
|
+
|
|
847
|
+
sage: pari(1).hyperu(2,3)
|
|
848
|
+
0.333333333333333
|
|
849
|
+
|
|
850
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
851
|
+
sage: pari(1+i).incgam(3-i) # needs sage.rings.real_mpfr
|
|
852
|
+
-0.0458297859919946 + 0.0433696818726677*I
|
|
853
|
+
sage: pari(1).incgamc(2)
|
|
854
|
+
0.864664716763387
|
|
855
|
+
|
|
856
|
+
sage: pari(5).log()
|
|
857
|
+
1.60943791243410
|
|
858
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
859
|
+
sage: pari(i).log() # needs sage.rings.real_mpfr
|
|
860
|
+
0.E-19 + 1.57079632679490*I
|
|
861
|
+
|
|
862
|
+
sage: pari(100).lngamma()
|
|
863
|
+
359.134205369575
|
|
864
|
+
sage: pari(100).log_gamma()
|
|
865
|
+
359.134205369575
|
|
866
|
+
|
|
867
|
+
sage: pari(1).psi()
|
|
868
|
+
-0.577215664901533
|
|
869
|
+
|
|
870
|
+
sage: pari(1).sin()
|
|
871
|
+
0.841470984807897
|
|
872
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
873
|
+
sage: pari(1+i).sin() # needs sage.rings.real_mpfr
|
|
874
|
+
1.29845758141598 + 0.634963914784736*I
|
|
875
|
+
|
|
876
|
+
sage: pari(0).sinh()
|
|
877
|
+
0.E-19
|
|
878
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
879
|
+
sage: pari(1+i).sinh() # needs sage.rings.real_mpfr
|
|
880
|
+
0.634963914784736 + 1.29845758141598*I
|
|
881
|
+
|
|
882
|
+
sage: pari(2).sqrt()
|
|
883
|
+
1.41421356237310
|
|
884
|
+
|
|
885
|
+
sage: pari(8).sqrtint()
|
|
886
|
+
2
|
|
887
|
+
sage: pari(10^100).sqrtint()
|
|
888
|
+
100000000000000000000000000000000000000000000000000
|
|
889
|
+
|
|
890
|
+
sage: pari(2).tan()
|
|
891
|
+
-2.18503986326152
|
|
892
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
893
|
+
sage: pari(i).tan() # needs sage.rings.real_mpfr
|
|
894
|
+
0.761594155955765*I
|
|
895
|
+
|
|
896
|
+
sage: pari(1).tanh()
|
|
897
|
+
0.761594155955765
|
|
898
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
899
|
+
sage: z = pari(i); z # needs sage.rings.real_mpfr
|
|
900
|
+
1.00000000000000*I
|
|
901
|
+
sage: result = z.tanh()
|
|
902
|
+
sage: result.real() <= 1e-18
|
|
903
|
+
True
|
|
904
|
+
sage: result.imag()
|
|
905
|
+
1.55740772465490
|
|
906
|
+
|
|
907
|
+
sage: pari('2+O(7^5)').teichmuller()
|
|
908
|
+
2 + 4*7 + 6*7^2 + 3*7^3 + O(7^5)
|
|
909
|
+
|
|
910
|
+
sage: pari(0.5).theta(2)
|
|
911
|
+
1.63202590295260
|
|
912
|
+
|
|
913
|
+
sage: pari(0.5).thetanullk(1)
|
|
914
|
+
0.548978532560341
|
|
915
|
+
|
|
916
|
+
sage: # needs sage.rings.real_mpfr
|
|
917
|
+
sage: C.<i> = ComplexField()
|
|
918
|
+
sage: pari(i).weber()
|
|
919
|
+
1.18920711500272
|
|
920
|
+
sage: pari(i).weber(1)
|
|
921
|
+
1.09050773266526
|
|
922
|
+
sage: pari(i).weber(2)
|
|
923
|
+
1.09050773266526
|
|
924
|
+
|
|
925
|
+
sage: pari(2).zeta()
|
|
926
|
+
1.64493406684823
|
|
927
|
+
sage: x = RR(pi)^2/6 # needs sage.symbolic
|
|
928
|
+
sage: pari(x) # needs sage.symbolic
|
|
929
|
+
1.64493406684823
|
|
930
|
+
sage: pari(3).zeta()
|
|
931
|
+
1.20205690315959
|
|
932
|
+
sage: pari('1+5*7+2*7^2+O(7^3)').zeta()
|
|
933
|
+
4*7^-2 + 5*7^-1 + O(7^0)
|
|
934
|
+
|
|
935
|
+
Linear algebra::
|
|
936
|
+
|
|
937
|
+
sage: pari('[1,2,3; 4,5,6; 7,8,9]').matadjoint()
|
|
938
|
+
[-3, 6, -3; 6, -12, 6; -3, 6, -3]
|
|
939
|
+
sage: pari('[a,b,c; d,e,f; g,h,i]').matadjoint()
|
|
940
|
+
[(i*e - h*f), (-i*b + h*c), (f*b - e*c); (-i*d + g*f), i*a - g*c, -f*a + d*c; (h*d - g*e), -h*a + g*b, e*a - d*b]
|
|
941
|
+
|
|
942
|
+
sage: pari('[1,1;1,-1]').matsolve(pari('[1;0]'))
|
|
943
|
+
[1/2; 1/2]
|
|
944
|
+
|
|
945
|
+
sage: D = pari('[3,4]~')
|
|
946
|
+
sage: B = pari('[1,2]~')
|
|
947
|
+
sage: M = pari('[1,2;3,4]')
|
|
948
|
+
sage: M.matsolvemod(D, B)
|
|
949
|
+
[10, 0]~
|
|
950
|
+
sage: M.matsolvemod(3, 1)
|
|
951
|
+
[2, 1]~
|
|
952
|
+
sage: M.matsolvemod(pari('[3,0]~'), pari('[1,2]~'))
|
|
953
|
+
[6, -4]~
|
|
954
|
+
sage: M2 = pari('[1,10;9,18]')
|
|
955
|
+
sage: M2.matsolvemod(3, pari('[2,3]~'), 1)
|
|
956
|
+
[[2, 0]~, [3, 2; 0, 1]]
|
|
957
|
+
sage: M2.matsolvemod(9, pari('[2,3]~'))
|
|
958
|
+
0
|
|
959
|
+
sage: M2.matsolvemod(9, pari('[2,45]~'), 1)
|
|
960
|
+
[[2, 0]~, [9, 8; 0, 1]]
|
|
961
|
+
|
|
962
|
+
sage: pari('[1,2,3;4,5,6;7,8,9]').matker()
|
|
963
|
+
[1; -2; 1]
|
|
964
|
+
sage: pari('[1,2,3;4,5,6;7,8,9]').matker(1)
|
|
965
|
+
[1; -2; 1]
|
|
966
|
+
sage: pari('matrix(3,3,i,j,i)').matker()
|
|
967
|
+
[-1, -1; 1, 0; 0, 1]
|
|
968
|
+
sage: pari('[1,2,3;4,5,6;7,8,9]*Mod(1,2)').matker()
|
|
969
|
+
[Mod(1, 2); Mod(0, 2); Mod(1, 2)]
|
|
970
|
+
|
|
971
|
+
sage: pari('[1,2; 3,4]').matdet(0)
|
|
972
|
+
-2
|
|
973
|
+
sage: pari('[1,2; 3,4]').matdet(1)
|
|
974
|
+
-2
|
|
975
|
+
|
|
976
|
+
sage: pari('[1,2; 3,4]').trace()
|
|
977
|
+
5
|
|
978
|
+
|
|
979
|
+
sage: pari('[1,2,3; 4,5,6; 7,8,9]').mathnf()
|
|
980
|
+
[6, 1; 3, 1; 0, 1]
|
|
981
|
+
|
|
982
|
+
sage: # needs sage.modules
|
|
983
|
+
sage: M = matrix([[1,2,3],[4,5,6],[7,8,11]])
|
|
984
|
+
sage: d = M.det()
|
|
985
|
+
sage: pari(M).mathnfmod(d)
|
|
986
|
+
[6, 4, 3; 0, 1, 0; 0, 0, 1]
|
|
987
|
+
sage: M = matrix([[1,0,0],[0,2,0],[0,0,6]])
|
|
988
|
+
sage: pari(M).mathnfmod(6)
|
|
989
|
+
[1, 0, 0; 0, 1, 0; 0, 0, 6]
|
|
990
|
+
sage: pari(M).mathnfmod(12)
|
|
991
|
+
[1, 0, 0; 0, 2, 0; 0, 0, 6]
|
|
992
|
+
|
|
993
|
+
sage: # needs sage.modules
|
|
994
|
+
sage: M = matrix([[1,0,0],[0,2,0],[0,0,6]])
|
|
995
|
+
sage: pari(M).mathnfmodid(6)
|
|
996
|
+
[1, 0, 0; 0, 2, 0; 0, 0, 6]
|
|
997
|
+
sage: pari(M).mathnfmod(6)
|
|
998
|
+
[1, 0, 0; 0, 1, 0; 0, 0, 6]
|
|
999
|
+
|
|
1000
|
+
sage: pari('[1,2,3; 4,5,6; 7,8,9]').matsnf()
|
|
1001
|
+
[0, 3, 1]
|
|
1002
|
+
|
|
1003
|
+
sage: a = pari('[1,2;3,4]')
|
|
1004
|
+
sage: a.matfrobenius()
|
|
1005
|
+
[0, 2; 1, 5]
|
|
1006
|
+
sage: a.matfrobenius(flag=1)
|
|
1007
|
+
[x^2 - 5*x - 2]
|
|
1008
|
+
sage: a.matfrobenius(2)
|
|
1009
|
+
[[0, 2; 1, 5], [1, -1/3; 0, 1/3]]
|
|
1010
|
+
sage: v = a.matfrobenius(2)
|
|
1011
|
+
sage: v[0]
|
|
1012
|
+
[0, 2; 1, 5]
|
|
1013
|
+
sage: v[1]^(-1)*v[0]*v[1]
|
|
1014
|
+
[1, 2; 3, 4]
|
|
1015
|
+
sage: t = pari('[3, -2, 0, 0; 0, -2, 0, 1; 0, -1, -2, 2; 0, -2, 0, 2]')
|
|
1016
|
+
sage: t.matfrobenius()
|
|
1017
|
+
[0, 0, 0, -12; 1, 0, 0, -2; 0, 1, 0, 8; 0, 0, 1, 1]
|
|
1018
|
+
sage: t.charpoly('x')
|
|
1019
|
+
x^4 - x^3 - 8*x^2 + 2*x + 12
|
|
1020
|
+
sage: t.matfrobenius(1)
|
|
1021
|
+
[x^4 - x^3 - 8*x^2 + 2*x + 12]
|
|
1022
|
+
|
|
1023
|
+
Quadratic forms::
|
|
1024
|
+
|
|
1025
|
+
sage: # needs sage.modules
|
|
1026
|
+
sage: A = Matrix(3,3,[1,2,3,2,5,5,3,5,11])
|
|
1027
|
+
sage: A.is_positive_definite()
|
|
1028
|
+
True
|
|
1029
|
+
sage: pari(A).qfminim(10, 5).sage()
|
|
1030
|
+
[
|
|
1031
|
+
[17 14 15 16 13]
|
|
1032
|
+
[-4 -3 -3 -3 -2]
|
|
1033
|
+
146, 10, [-3 -3 -3 -3 -3]
|
|
1034
|
+
]
|
|
1035
|
+
sage: pari(A).qfminim().sage()
|
|
1036
|
+
[
|
|
1037
|
+
[ 5 2 1]
|
|
1038
|
+
[-1 -1 0]
|
|
1039
|
+
6, 1, [-1 0 0]
|
|
1040
|
+
]
|
|
1041
|
+
sage: pari(A.change_ring(RR)).qfminim(5, m=5, flag=2).sage()
|
|
1042
|
+
[
|
|
1043
|
+
[ -5 -10 -2 -7 3]
|
|
1044
|
+
[ 1 2 1 2 0]
|
|
1045
|
+
10, 5.00000000000000000, [ 1 2 0 1 -1]
|
|
1046
|
+
]
|
|
1047
|
+
|
|
1048
|
+
sage: # needs sage.modules
|
|
1049
|
+
sage: M = diagonal_matrix([1,1,-1])
|
|
1050
|
+
sage: P = M.__pari__().qfparam([0,1,-1]); P
|
|
1051
|
+
[0, -2, 0; 1, 0, -1; -1, 0, -1]
|
|
1052
|
+
sage: R.<x,y> = QQ[]
|
|
1053
|
+
sage: v = P.sage() * vector([x^2, x*y, y^2]); v
|
|
1054
|
+
(-2*x*y, x^2 - y^2, -x^2 - y^2)
|
|
1055
|
+
sage: v(x=2, y=1)
|
|
1056
|
+
(-4, 3, -5)
|
|
1057
|
+
sage: v(x=3,y=8)
|
|
1058
|
+
(-48, -55, -73)
|
|
1059
|
+
sage: 48^2 + 55^2 == 73^2
|
|
1060
|
+
True
|
|
1061
|
+
|
|
1062
|
+
sage: # needs sage.modules
|
|
1063
|
+
sage: M = diagonal_matrix([1,2,3,4,-5])
|
|
1064
|
+
sage: M.__pari__().qfsolve()
|
|
1065
|
+
[0, 1, -1, 0, -1]~
|
|
1066
|
+
sage: M = diagonal_matrix([4,-9])
|
|
1067
|
+
sage: M.__pari__().qfsolve()
|
|
1068
|
+
[6, 4]~
|
|
1069
|
+
sage: M = diagonal_matrix([1,1,1,1,1])
|
|
1070
|
+
sage: M.__pari__().qfsolve()
|
|
1071
|
+
-1
|
|
1072
|
+
sage: M = diagonal_matrix([1,1,-3])
|
|
1073
|
+
sage: M.__pari__().qfsolve()
|
|
1074
|
+
3
|
|
1075
|
+
sage: M = diagonal_matrix([1,-42])
|
|
1076
|
+
sage: M.__pari__().qfsolve()
|
|
1077
|
+
-2
|
|
1078
|
+
sage: M = diagonal_matrix([1,-1,0,0])
|
|
1079
|
+
sage: M.__pari__().qfsolve().sage()
|
|
1080
|
+
[0 0]
|
|
1081
|
+
[0 0]
|
|
1082
|
+
[1 0]
|
|
1083
|
+
[0 1]
|
|
1084
|
+
|
|
1085
|
+
Number-theoretical functions::
|
|
1086
|
+
|
|
1087
|
+
sage: n = pari.set_real_precision(210)
|
|
1088
|
+
sage: w1 = pari('z1=2-sqrt(26); (z1+I)/(z1-I)')
|
|
1089
|
+
sage: f = w1.algdep(12); f
|
|
1090
|
+
545*x^11 - 297*x^10 - 281*x^9 + 48*x^8 - 168*x^7 + 690*x^6 - 168*x^5 + 48*x^4 - 281*x^3 - 297*x^2 + 545*x
|
|
1091
|
+
sage: f(w1).abs() < 1.0e-200
|
|
1092
|
+
True
|
|
1093
|
+
sage: f.factor()
|
|
1094
|
+
[x, 1; x + 1, 2; x^2 + 1, 1; x^2 + x + 1, 1; 545*x^4 - 1932*x^3 + 2790*x^2 - 1932*x + 545, 1]
|
|
1095
|
+
sage: pari.set_real_precision(n)
|
|
1096
|
+
210
|
|
1097
|
+
|
|
1098
|
+
sage: pari(6).binomial(2)
|
|
1099
|
+
15
|
|
1100
|
+
sage: pari('x+1').binomial(3)
|
|
1101
|
+
1/6*x^3 - 1/6*x
|
|
1102
|
+
sage: pari('2+x+O(x^2)').binomial(3)
|
|
1103
|
+
1/3*x + O(x^2)
|
|
1104
|
+
|
|
1105
|
+
sage: pari(10).eulerphi()
|
|
1106
|
+
4
|
|
1107
|
+
|
|
1108
|
+
sage: # needs sage.symbolic
|
|
1109
|
+
sage: x = SR.symbol('x')
|
|
1110
|
+
sage: pari(10).gcd(15)
|
|
1111
|
+
5
|
|
1112
|
+
sage: pari([5, 'y']).gcd()
|
|
1113
|
+
1
|
|
1114
|
+
sage: pari([x, x^2]).gcd()
|
|
1115
|
+
x
|
|
1116
|
+
sage: pari(10).lcm(15)
|
|
1117
|
+
30
|
|
1118
|
+
sage: pari([5, 'y']).lcm()
|
|
1119
|
+
5*y
|
|
1120
|
+
sage: pari([10, x, x^2]).lcm()
|
|
1121
|
+
10*x^2
|
|
1122
|
+
|
|
1123
|
+
sage: pari(20).numbpart()
|
|
1124
|
+
627
|
|
1125
|
+
sage: pari(100).numbpart()
|
|
1126
|
+
190569292
|
|
1127
|
+
|
|
1128
|
+
sage: pari(10).numdiv()
|
|
1129
|
+
4
|
|
1130
|
+
|
|
1131
|
+
sage: pari(7).primepi()
|
|
1132
|
+
4
|
|
1133
|
+
sage: pari(100).primepi()
|
|
1134
|
+
25
|
|
1135
|
+
sage: pari(1000).primepi()
|
|
1136
|
+
168
|
|
1137
|
+
sage: pari(100000).primepi()
|
|
1138
|
+
9592
|
|
1139
|
+
sage: pari(0).primepi()
|
|
1140
|
+
0
|
|
1141
|
+
sage: pari(-15).primepi()
|
|
1142
|
+
0
|
|
1143
|
+
sage: pari(500509).primepi()
|
|
1144
|
+
41581
|
|
1145
|
+
sage: pari(10^7).primepi()
|
|
1146
|
+
664579
|
|
1147
|
+
|
|
1148
|
+
sage: pari(4).znprimroot()
|
|
1149
|
+
Mod(3, 4)
|
|
1150
|
+
sage: pari(10007^3).znprimroot()
|
|
1151
|
+
Mod(5, 1002101470343)
|
|
1152
|
+
sage: pari(2*109^10).znprimroot()
|
|
1153
|
+
Mod(236736367459211723407, 473472734918423446802)
|
|
1154
|
+
|
|
1155
|
+
sage: pari(0).znstar()
|
|
1156
|
+
[2, [2], [-1]]
|
|
1157
|
+
sage: pari(96).znstar()
|
|
1158
|
+
[32, [8, 2, 2], [Mod(37, 96), Mod(31, 96), Mod(65, 96)]]
|
|
1159
|
+
sage: pari(-5).znstar()
|
|
1160
|
+
[4, [4], [Mod(2, 5)]]
|
|
1161
|
+
|
|
1162
|
+
Finite fields::
|
|
1163
|
+
|
|
1164
|
+
sage: x = GF(2)['x'].gen()
|
|
1165
|
+
sage: pari(x^2+x+2).ffgen()
|
|
1166
|
+
x
|
|
1167
|
+
sage: pari(x^2+x+1).ffgen('a')
|
|
1168
|
+
a
|
|
1169
|
+
|
|
1170
|
+
sage: pari(7).ffinit(11)
|
|
1171
|
+
Mod(1, 7)*x^11 + Mod(1, 7)*x^10 + Mod(4, 7)*x^9 + Mod(5, 7)*x^8 + Mod(1, 7)*x^7 + Mod(1, 7)*x^2 + Mod(1, 7)*x + Mod(6, 7)
|
|
1172
|
+
sage: pari(2003).ffinit(3)
|
|
1173
|
+
Mod(1, 2003)*x^3 + Mod(1, 2003)*x^2 + Mod(1993, 2003)*x + Mod(1995, 2003)
|
|
1174
|
+
|
|
1175
|
+
sage: # needs sage.rings.finite_rings
|
|
1176
|
+
sage: k.<a> = GF(2^12)
|
|
1177
|
+
sage: g = pari(a).ffprimroot()
|
|
1178
|
+
sage: (g^1234).fflog(g)
|
|
1179
|
+
1234
|
|
1180
|
+
sage: pari(k(1)).fflog(g)
|
|
1181
|
+
0
|
|
1182
|
+
sage: b = g^5
|
|
1183
|
+
sage: ord = b.fforder(); ord
|
|
1184
|
+
819
|
|
1185
|
+
sage: (b^555).fflog(b, ord)
|
|
1186
|
+
555
|
|
1187
|
+
sage: (b^555).fflog(b, (ord, ord.factor()) )
|
|
1188
|
+
555
|
|
1189
|
+
|
|
1190
|
+
sage: # needs sage.rings.finite_rings
|
|
1191
|
+
sage: k.<a> = GF(5^80)
|
|
1192
|
+
sage: g = pari(a).ffprimroot()
|
|
1193
|
+
sage: g.fforder()
|
|
1194
|
+
82718061255302767487140869206996285356581211090087890624
|
|
1195
|
+
sage: g.fforder( (5^80-1, factor(5^80-1)) )
|
|
1196
|
+
82718061255302767487140869206996285356581211090087890624
|
|
1197
|
+
sage: k(2).__pari__().fforder(o=4)
|
|
1198
|
+
4
|
|
1199
|
+
|
|
1200
|
+
`p`-adic functions::
|
|
1201
|
+
|
|
1202
|
+
sage: # needs sage.rings.padics
|
|
1203
|
+
sage: K = Qp(11,5)
|
|
1204
|
+
sage: x = K(11^-10 + 5*11^-7 + 11^-6)
|
|
1205
|
+
sage: y = pari(x)
|
|
1206
|
+
sage: y.padicprec(11)
|
|
1207
|
+
-5
|
|
1208
|
+
sage: y.padicprec(17)
|
|
1209
|
+
Traceback (most recent call last):
|
|
1210
|
+
...
|
|
1211
|
+
PariError: inconsistent moduli in padicprec: 11 != 17
|
|
1212
|
+
sage: R.<t> = PolynomialRing(Zp(3))
|
|
1213
|
+
sage: pol = R([O(3^4), O(3^6), O(3^5)])
|
|
1214
|
+
sage: pari(pol).padicprec(3)
|
|
1215
|
+
4
|
|
1216
|
+
|
|
1217
|
+
Elliptic curves::
|
|
1218
|
+
|
|
1219
|
+
sage: e = pari([0,1,0,1,0]).ellinit(); e
|
|
1220
|
+
[0, 1, 0, 1, 0, 4, 2, 0, -1, -32, 224, -48, 2048/3, Vecsmall([1]), [Vecsmall([64, -1])], [0, 0, 0, 0, 0, 0, 0, 0]]
|
|
1221
|
+
|
|
1222
|
+
sage: pari([0,1/2,0,-3/4,0]).ellinit()
|
|
1223
|
+
[0, 1/2, 0, -3/4, 0, 2, -3/2, 0, -9/16, 40, -116, 117/4, 256000/117, Vecsmall([1]), [Vecsmall([64, 1])], [0, 0, 0, 0, 0, 0, 0, 0]]
|
|
1224
|
+
sage: pari([0,0.5,0,-0.75,0]).ellinit()
|
|
1225
|
+
[0, 0.500000000000000, 0, -0.750000000000000, 0, 2.00000000000000, -1.50000000000000, 0, -0.562500000000000, 40.0000000000000, -116.000000000000, 29.2500000000000, 2188.03418803419, Vecsmall([0]), [Vecsmall([64, 1])], [0, 0, 0, 0]]
|
|
1226
|
+
sage: pari([0,SR(I),0,1,0]).ellinit() # needs sage.symbolic
|
|
1227
|
+
[0, I, 0, 1, 0, 4*I, 2, 0, -1, -64, 352*I, -80, 16384/5, Vecsmall([0]), [Vecsmall([64, 0])], [0, 0, 0, 0]]
|
|
1228
|
+
sage: x = SR.symbol('x') # needs sage.symbolic
|
|
1229
|
+
sage: pari([0,x,0,2*x,1]).ellinit() # needs sage.symbolic
|
|
1230
|
+
[0, x, 0, 2*x, 1, 4*x, 4*x, 4, -4*x^2 + 4*x, 16*x^2 - 96*x, -64*x^3 + 576*x^2 - 864, 64*x^4 - 576*x^3 + 576*x^2 - 432, (256*x^6 - 4608*x^5 + 27648*x^4 - 55296*x^3)/(4*x^4 - 36*x^3 + 36*x^2 - 27), Vecsmall([0]), [Vecsmall([64, 0])], [0, 0, 0, 0]]
|
|
1231
|
+
|
|
1232
|
+
sage: e = pari([0,1,1,-2,0]).ellinit()
|
|
1233
|
+
sage: e.ellheight([1,0])
|
|
1234
|
+
0.476711659343740
|
|
1235
|
+
sage: e.ellheight([1,0], precision=128).sage()
|
|
1236
|
+
0.476711659343739537379486058884653059459022942211150879336
|
|
1237
|
+
sage: e.ellheight([1, 0], [-1, 1])
|
|
1238
|
+
0.418188984498861
|
|
1239
|
+
|
|
1240
|
+
sage: e = pari([0,1,1,-2,0]).ellinit()
|
|
1241
|
+
sage: x = pari([1,0])
|
|
1242
|
+
sage: e.ellisoncurve([1,4])
|
|
1243
|
+
False
|
|
1244
|
+
sage: e.ellisoncurve(x)
|
|
1245
|
+
True
|
|
1246
|
+
sage: f = e.ellchangecurve([1,2,3,-1])
|
|
1247
|
+
sage: f[:5] # show only first five entries
|
|
1248
|
+
[6, -2, -1, 17, 8]
|
|
1249
|
+
sage: x.ellchangepoint([1,2,3,-1])
|
|
1250
|
+
[-1, 4]
|
|
1251
|
+
sage: f.ellisoncurve([-1,4])
|
|
1252
|
+
True
|
|
1253
|
+
|
|
1254
|
+
sage: e = pari([0, 5, 2, -1, 1]).ellinit()
|
|
1255
|
+
sage: e.ellglobalred()
|
|
1256
|
+
[20144, [1, -2, 0, -1], 1, [2, 4; 1259, 1], [[4, 2, 0, 1], [1, 5, 0, 1]]]
|
|
1257
|
+
|
|
1258
|
+
sage: # needs database_cremona_mini_ellcurve sage.schemes
|
|
1259
|
+
sage: e = pari(EllipticCurve('17a').a_invariants()).ellinit()
|
|
1260
|
+
sage: e.ellglobalred()
|
|
1261
|
+
[17, [1, 0, 0, 0], 4, Mat([17, 1]), [[1, 8, 0, 4]]]
|
|
1262
|
+
|
|
1263
|
+
sage: e = pari([0, 1, 1, -2, 0]).ellinit()
|
|
1264
|
+
sage: e.elladd([1,0], [-1,1])
|
|
1265
|
+
[-3/4, -15/8]
|
|
1266
|
+
|
|
1267
|
+
sage: e = pari([0, -1, 1, -10, -20]).ellinit()
|
|
1268
|
+
sage: e.ellak(6)
|
|
1269
|
+
2
|
|
1270
|
+
sage: e.ellak(2005)
|
|
1271
|
+
2
|
|
1272
|
+
sage: e.ellak(-1)
|
|
1273
|
+
0
|
|
1274
|
+
sage: e.ellak(0)
|
|
1275
|
+
0
|
|
1276
|
+
|
|
1277
|
+
sage: # needs sage.schemes
|
|
1278
|
+
sage: E = EllipticCurve('389a1')
|
|
1279
|
+
sage: pari(E).ellanalyticrank() # needs sage.rings.number_field
|
|
1280
|
+
[2, 1.51863300057685]
|
|
1281
|
+
|
|
1282
|
+
sage: e = pari([0, -1, 1, -10, -20]).ellinit()
|
|
1283
|
+
sage: e.ellap(2)
|
|
1284
|
+
-2
|
|
1285
|
+
sage: e.ellap(2003)
|
|
1286
|
+
4
|
|
1287
|
+
|
|
1288
|
+
sage: e = pari([1,2,3,4,5]).ellinit()
|
|
1289
|
+
sage: e.ellglobalred()
|
|
1290
|
+
[10351, [1, -1, 0, -1], 1, [11, 1; 941, 1], [[1, 5, 0, 1], [1, 5, 0, 1]]]
|
|
1291
|
+
sage: f = e.ellchangecurve([1,-1,0,-1])
|
|
1292
|
+
sage: f[:5]
|
|
1293
|
+
[1, -1, 0, 4, 3]
|
|
1294
|
+
|
|
1295
|
+
sage: e = pari([0,0,0,-82,0]).ellinit()
|
|
1296
|
+
sage: e.elleta()
|
|
1297
|
+
[3.60546360143265, 3.60546360143265*I]
|
|
1298
|
+
sage: w1, w2 = e.omega()
|
|
1299
|
+
sage: eta1, eta2 = e.elleta()
|
|
1300
|
+
sage: w1*eta2 - w2*eta1
|
|
1301
|
+
6.28318530717959*I
|
|
1302
|
+
|
|
1303
|
+
sage: e = pari([0,1,1,-2,0]).ellinit().ellminimalmodel()[0]
|
|
1304
|
+
sage: e.ellheightmatrix([[1,0], [-1,1]])
|
|
1305
|
+
[0.476711659343740, 0.418188984498861; 0.418188984498861, 0.686667083305587]
|
|
1306
|
+
|
|
1307
|
+
sage: e = pari([0,1,1,-2,0]).ellinit()
|
|
1308
|
+
sage: om = e.omega()
|
|
1309
|
+
sage: om
|
|
1310
|
+
[2.49021256085506, -1.97173770155165*I]
|
|
1311
|
+
sage: om.elleisnum(2)
|
|
1312
|
+
10.0672605281120
|
|
1313
|
+
sage: om.elleisnum(4)
|
|
1314
|
+
112.000000000000
|
|
1315
|
+
sage: om.elleisnum(100)
|
|
1316
|
+
2.15314248576078 E50
|
|
1317
|
+
|
|
1318
|
+
sage: # needs sage.schemes
|
|
1319
|
+
sage: e = pari([0,0,0,0,1]).ellinit()
|
|
1320
|
+
sage: e.elllocalred(7)
|
|
1321
|
+
[0, 1, [1, 0, 0, 0], 1]
|
|
1322
|
+
sage: e = pari(EllipticCurve('27a3').a_invariants()).ellinit()
|
|
1323
|
+
sage: e.elllocalred(3)
|
|
1324
|
+
[3, 2, [1, 0, 0, 0], 1]
|
|
1325
|
+
sage: e = pari(EllipticCurve('24a4').a_invariants()).ellinit()
|
|
1326
|
+
sage: e.elllocalred(2)
|
|
1327
|
+
[3, 3, [1, 0, 0, 0], 2]
|
|
1328
|
+
sage: e = pari(EllipticCurve('20a2').a_invariants()).ellinit()
|
|
1329
|
+
sage: e.elllocalred(2)
|
|
1330
|
+
[2, 4, [1, 0, 0, 0], 3]
|
|
1331
|
+
sage: e = pari(EllipticCurve('11a2').a_invariants()).ellinit()
|
|
1332
|
+
sage: e.elllocalred(11)
|
|
1333
|
+
[1, 5, [1, 0, 0, 0], 1]
|
|
1334
|
+
sage: e = pari(EllipticCurve('14a4').a_invariants()).ellinit()
|
|
1335
|
+
sage: e.elllocalred(2)
|
|
1336
|
+
[1, 6, [1, 0, 0, 0], 2]
|
|
1337
|
+
sage: e = pari(EllipticCurve('14a1').a_invariants()).ellinit()
|
|
1338
|
+
sage: e.elllocalred(2)
|
|
1339
|
+
[1, 10, [1, 0, 0, 0], 2]
|
|
1340
|
+
sage: e = pari(EllipticCurve('32a3').a_invariants()).ellinit()
|
|
1341
|
+
sage: e.elllocalred(2)
|
|
1342
|
+
[5, -1, [1, 0, 0, 0], 1]
|
|
1343
|
+
sage: e = pari(EllipticCurve('24a5').a_invariants()).ellinit()
|
|
1344
|
+
sage: e.elllocalred(2)
|
|
1345
|
+
[3, -2, [1, 0, 0, 0], 1]
|
|
1346
|
+
sage: e = pari(EllipticCurve('24a2').a_invariants()).ellinit()
|
|
1347
|
+
sage: e.elllocalred(2)
|
|
1348
|
+
[3, -3, [1, 0, 0, 0], 2]
|
|
1349
|
+
sage: e = pari(EllipticCurve('20a1').a_invariants()).ellinit()
|
|
1350
|
+
sage: e.elllocalred(2)
|
|
1351
|
+
[2, -4, [1, 0, 0, 0], 3]
|
|
1352
|
+
sage: e = pari(EllipticCurve('24a1').a_invariants()).ellinit()
|
|
1353
|
+
sage: e.elllocalred(2)
|
|
1354
|
+
[3, -5, [1, 0, 0, 0], 4]
|
|
1355
|
+
sage: e = pari(EllipticCurve('90c2').a_invariants()).ellinit()
|
|
1356
|
+
sage: e.elllocalred(3)
|
|
1357
|
+
[2, -10, [1, 0, 0, 0], 4]
|
|
1358
|
+
|
|
1359
|
+
sage: # needs sage.schemes
|
|
1360
|
+
sage: e = pari(EllipticCurve('65a1').a_invariants()).ellinit()
|
|
1361
|
+
sage: e.ellorder([0,0])
|
|
1362
|
+
2
|
|
1363
|
+
sage: e.ellorder([1,0])
|
|
1364
|
+
0
|
|
1365
|
+
|
|
1366
|
+
sage: e = pari([0,1,1,-2,0]).ellinit()
|
|
1367
|
+
sage: e.ellordinate(0)
|
|
1368
|
+
[0, -1]
|
|
1369
|
+
sage: e.ellordinate(SR(I)) # needs sage.symbolic
|
|
1370
|
+
[0.582203589721741 - 1.38606082464177*I, -1.58220358972174 + 1.38606082464177*I]
|
|
1371
|
+
sage: e.ellordinate(SR(I), precision=128)[0].sage() # needs sage.symbolic
|
|
1372
|
+
0.58220358972174117723338947874993600727 - 1.3860608246417697185311834209833653345*I
|
|
1373
|
+
sage: e.ellordinate(1+3*5^1+O(5^3)) # needs sage.rings.padics
|
|
1374
|
+
[4*5 + 5^2 + O(5^3), 4 + 3*5^2 + O(5^3)]
|
|
1375
|
+
sage: e.ellordinate('z+2*z^2+O(z^4)')
|
|
1376
|
+
[-2*z - 7*z^2 - 23*z^3 + O(z^4), -1 + 2*z + 7*z^2 + 23*z^3 + O(z^4)]
|
|
1377
|
+
sage: e.ellordinate(5)
|
|
1378
|
+
[]
|
|
1379
|
+
sage: e.ellordinate(5.0)
|
|
1380
|
+
[11.3427192823270, -12.3427192823270]
|
|
1381
|
+
|
|
1382
|
+
sage: e = pari([0,0,0,1,0]).ellinit()
|
|
1383
|
+
sage: e.ellpointtoz([0,0])
|
|
1384
|
+
1.85407467730137
|
|
1385
|
+
sage: e.ellpointtoz([0])
|
|
1386
|
+
0
|
|
1387
|
+
|
|
1388
|
+
sage: e = pari([0,0,0,3,0]).ellinit()
|
|
1389
|
+
sage: p = [1,2] # Point of infinite order
|
|
1390
|
+
sage: e.ellmul([0,0], 2)
|
|
1391
|
+
[0]
|
|
1392
|
+
sage: e.ellmul(p, 2)
|
|
1393
|
+
[1/4, -7/8]
|
|
1394
|
+
sage: q = e.ellmul(p, SR(1+I)); q # needs sage.symbolic
|
|
1395
|
+
[-2*I, 1 + I]
|
|
1396
|
+
sage: e.ellmul(q, SR(1-I)) # needs sage.symbolic
|
|
1397
|
+
[1/4, -7/8]
|
|
1398
|
+
sage: for D in [-7, -8, -11, -12, -16, -19, -27, -28]: # long time (1s)
|
|
1399
|
+
....: hcpol = hilbert_class_polynomial(D)
|
|
1400
|
+
....: j = hcpol.roots(multiplicities=False)[0]
|
|
1401
|
+
....: t = (1728-j)/(27*j)
|
|
1402
|
+
....: E = EllipticCurve([4*t,16*t^2])
|
|
1403
|
+
....: P = E.point([0, 4*t])
|
|
1404
|
+
....: assert(E.j_invariant() == j)
|
|
1405
|
+
....: #
|
|
1406
|
+
....: # Compute some CM number and its minimal polynomial
|
|
1407
|
+
....: #
|
|
1408
|
+
....: cm = pari('cm = (3*quadgen(%s)+2)'%D)
|
|
1409
|
+
....: cm_minpoly = pari('minpoly(cm)')
|
|
1410
|
+
....: #
|
|
1411
|
+
....: # Evaluate cm_minpoly(cm)(P), which should be zero
|
|
1412
|
+
....: #
|
|
1413
|
+
....: e = pari(E) # Convert E to PARI
|
|
1414
|
+
....: P2 = e.ellmul(P, cm_minpoly[2]*cm + cm_minpoly[1])
|
|
1415
|
+
....: P0 = e.elladd(e.ellmul(P, cm_minpoly[0]), e.ellmul(P2, cm))
|
|
1416
|
+
....: assert(P0 == E(0))
|
|
1417
|
+
|
|
1418
|
+
sage: e = pari([0,0,0,-82,0]).ellinit()
|
|
1419
|
+
sage: e.ellrootno()
|
|
1420
|
+
-1
|
|
1421
|
+
sage: e.ellrootno(2)
|
|
1422
|
+
1
|
|
1423
|
+
sage: e.ellrootno(1009)
|
|
1424
|
+
1
|
|
1425
|
+
|
|
1426
|
+
sage: # needs sage.rings.real_mpfr
|
|
1427
|
+
sage: e = pari([0,0,0,1,0]).ellinit()
|
|
1428
|
+
sage: C.<i> = ComplexField()
|
|
1429
|
+
sage: e.ellsigma(2+i)
|
|
1430
|
+
1.43490215804166 + 1.80307856719256*I
|
|
1431
|
+
|
|
1432
|
+
sage: e = pari([0, 1, 1, -2, 0]).ellinit()
|
|
1433
|
+
sage: e.ellsub([1,0], [-1,1])
|
|
1434
|
+
[0, 0]
|
|
1435
|
+
|
|
1436
|
+
sage: e = pari([0,0,0,1,0]).ellinit()
|
|
1437
|
+
sage: e.ellzeta(1)
|
|
1438
|
+
1.06479841295883
|
|
1439
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
1440
|
+
sage: e.ellzeta(i-1) # needs sage.rings.real_mpfr
|
|
1441
|
+
-0.350122658523049 - 0.350122658523049*I
|
|
1442
|
+
|
|
1443
|
+
sage: e = pari([0,0,0,1,0]).ellinit()
|
|
1444
|
+
sage: C.<i> = ComplexField() # needs sage.rings.real_mpfr
|
|
1445
|
+
sage: e.ellztopoint(1+i) # needs sage.rings.real_mpfr
|
|
1446
|
+
[0.E-... - 1.02152286795670*I, -0.149072813701096 - 0.149072813701096*I]
|
|
1447
|
+
sage: e.ellztopoint(0)
|
|
1448
|
+
[0]
|
|
1449
|
+
|
|
1450
|
+
sage: pari(SR(I)).ellj() # needs sage.symbolic
|
|
1451
|
+
1728.00000000000
|
|
1452
|
+
sage: pari(SR(3*I)).ellj() # needs sage.symbolic
|
|
1453
|
+
153553679.396729
|
|
1454
|
+
sage: pari('quadgen(-3)').ellj()
|
|
1455
|
+
0.E-54
|
|
1456
|
+
sage: pari('quadgen(-7)').ellj(precision=256).sage()
|
|
1457
|
+
-3375.000000000000000000000000000000000000000000000000000000000000000000000000
|
|
1458
|
+
sage: pari(SR(-I)).ellj() # needs sage.symbolic
|
|
1459
|
+
Traceback (most recent call last):
|
|
1460
|
+
...
|
|
1461
|
+
PariError: domain error in modular function: Im(argument) <= 0
|
|
1462
|
+
|
|
1463
|
+
Quadratic class numbers::
|
|
1464
|
+
|
|
1465
|
+
sage: pari(10009).qfbhclassno()
|
|
1466
|
+
0
|
|
1467
|
+
sage: pari(2).qfbhclassno()
|
|
1468
|
+
0
|
|
1469
|
+
sage: pari(0).qfbhclassno()
|
|
1470
|
+
-1/12
|
|
1471
|
+
sage: pari(4).qfbhclassno()
|
|
1472
|
+
1/2
|
|
1473
|
+
sage: pari(3).qfbhclassno()
|
|
1474
|
+
1/3
|
|
1475
|
+
sage: pari(23).qfbhclassno()
|
|
1476
|
+
3
|
|
1477
|
+
|
|
1478
|
+
sage: pari(-4).qfbclassno()
|
|
1479
|
+
1
|
|
1480
|
+
sage: pari(-23).qfbclassno()
|
|
1481
|
+
3
|
|
1482
|
+
sage: pari(-104).qfbclassno()
|
|
1483
|
+
6
|
|
1484
|
+
sage: pari(109).qfbclassno()
|
|
1485
|
+
1
|
|
1486
|
+
sage: pari(10001).qfbclassno()
|
|
1487
|
+
16
|
|
1488
|
+
sage: pari(10001).qfbclassno(flag=1)
|
|
1489
|
+
16
|
|
1490
|
+
sage: pari(3).qfbclassno()
|
|
1491
|
+
Traceback (most recent call last):
|
|
1492
|
+
...
|
|
1493
|
+
PariError: domain error in classno2: disc % 4 > 1
|
|
1494
|
+
sage: pari(4).qfbclassno()
|
|
1495
|
+
Traceback (most recent call last):
|
|
1496
|
+
...
|
|
1497
|
+
PariError: domain error in classno2: issquare(disc) = 1
|
|
1498
|
+
|
|
1499
|
+
sage: pari(-4).quadclassunit()
|
|
1500
|
+
[1, [], [], 1]
|
|
1501
|
+
sage: pari(-23).quadclassunit()
|
|
1502
|
+
[3, [3], [Qfb(2, 1, 3)], 1]
|
|
1503
|
+
sage: pari(-104).quadclassunit()
|
|
1504
|
+
[6, [6], [Qfb(5, -4, 6)], 1]
|
|
1505
|
+
sage: pari(109).quadclassunit()
|
|
1506
|
+
[1, [], [], 5.56453508676047, -1]
|
|
1507
|
+
sage: pari(10001).quadclassunit() # random generators
|
|
1508
|
+
[16, [16], [Qfb(10, 99, -5, 0.E-38)], 5.29834236561059]
|
|
1509
|
+
sage: pari(10001).quadclassunit()[0]
|
|
1510
|
+
16
|
|
1511
|
+
sage: pari(10001).quadclassunit()[1]
|
|
1512
|
+
[16]
|
|
1513
|
+
sage: pari(10001).quadclassunit()[3]
|
|
1514
|
+
5.29834236561059
|
|
1515
|
+
sage: pari(3).quadclassunit()
|
|
1516
|
+
Traceback (most recent call last):
|
|
1517
|
+
...
|
|
1518
|
+
PariError: domain error in Buchquad: disc % 4 > 1
|
|
1519
|
+
sage: pari(4).quadclassunit()
|
|
1520
|
+
Traceback (most recent call last):
|
|
1521
|
+
...
|
|
1522
|
+
PariError: domain error in Buchquad: issquare(disc) = 1
|
|
1523
|
+
|
|
1524
|
+
General number fields::
|
|
1525
|
+
|
|
1526
|
+
sage: x = polygen(QQ)
|
|
1527
|
+
sage: K.<a> = NumberField(x^2 - 1/8) # needs sage.rings.number_field
|
|
1528
|
+
sage: pari(x^2 - 2).factornf(K.pari_polynomial("a")) # needs sage.rings.number_field
|
|
1529
|
+
doctest:...: DeprecationWarning: the PARI/GP function factornf is obsolete (2016-08-08)
|
|
1530
|
+
[x + Mod(-a, a^2 - 2), 1; x + Mod(a, a^2 - 2), 1]
|
|
1531
|
+
|
|
1532
|
+
sage: K.<z> = QuadraticField(-23) # needs sage.rings.number_field
|
|
1533
|
+
sage: p = K.primes_above(3)[0] # needs sage.rings.number_field
|
|
1534
|
+
sage: K.pari_bnf().bnrclassno(p._pari_bid_()) # needs sage.rings.number_field
|
|
1535
|
+
3
|
|
1536
|
+
|
|
1537
|
+
sage: # needs sage.symbolic
|
|
1538
|
+
sage: x = SR.symbol('x')
|
|
1539
|
+
sage: P = pari(x^6 + 108)
|
|
1540
|
+
sage: G = P.galoisinit()
|
|
1541
|
+
sage: G[0] == P
|
|
1542
|
+
True
|
|
1543
|
+
sage: len(G[5]) == prod(G[7])
|
|
1544
|
+
True
|
|
1545
|
+
|
|
1546
|
+
sage: # needs sage.symbolic
|
|
1547
|
+
sage: G = pari(x^6 + 108).galoisinit()
|
|
1548
|
+
sage: G.galoispermtopol(G[5])
|
|
1549
|
+
[x, 1/12*x^4 - 1/2*x, -1/12*x^4 - 1/2*x, 1/12*x^4 + 1/2*x, -1/12*x^4 + 1/2*x, -x]
|
|
1550
|
+
sage: G.galoispermtopol(G[5][1])
|
|
1551
|
+
1/12*x^4 - 1/2*x
|
|
1552
|
+
sage: G.galoispermtopol(G[5][1:4])
|
|
1553
|
+
[1/12*x^4 - 1/2*x, -1/12*x^4 - 1/2*x, 1/12*x^4 + 1/2*x]
|
|
1554
|
+
|
|
1555
|
+
sage: # needs sage.symbolic
|
|
1556
|
+
sage: G = pari(x^4 + 1).galoisinit()
|
|
1557
|
+
sage: G.galoisfixedfield(G[5][1], flag=2)
|
|
1558
|
+
[y^2 - 2, Mod(-x^3 + x, x^4 + 1), [x^2 - y*x + 1, x^2 + y*x + 1]]
|
|
1559
|
+
sage: G.galoisfixedfield(G[5][5:7])
|
|
1560
|
+
[x^4 + 1, Mod(x, x^4 + 1)]
|
|
1561
|
+
sage: L = G.galoissubgroups()
|
|
1562
|
+
sage: G.galoisfixedfield(L[3], flag=2, v='z')
|
|
1563
|
+
[z^2 + 2, Mod(x^3 + x, x^4 + 1), [x^2 - z*x - 1, x^2 + z*x - 1]]
|
|
1564
|
+
|
|
1565
|
+
sage: G = pari(x^6 + 108).galoisinit()
|
|
1566
|
+
sage: L = G.galoissubgroups()
|
|
1567
|
+
sage: list(L[0][1])
|
|
1568
|
+
[3, 2]
|
|
1569
|
+
|
|
1570
|
+
sage: # needs sage.symbolic
|
|
1571
|
+
sage: G = pari(x^6 + 108).galoisinit()
|
|
1572
|
+
sage: G.galoisisabelian()
|
|
1573
|
+
0
|
|
1574
|
+
sage: H = G.galoissubgroups()[2]
|
|
1575
|
+
sage: H.galoisisabelian()
|
|
1576
|
+
Mat(2)
|
|
1577
|
+
sage: H.galoisisabelian(flag=1)
|
|
1578
|
+
1
|
|
1579
|
+
|
|
1580
|
+
sage: # needs sage.symbolic
|
|
1581
|
+
sage: G = pari(x^6 + 108).galoisinit()
|
|
1582
|
+
sage: L = G.galoissubgroups()
|
|
1583
|
+
sage: G.galoisisnormal(L[0])
|
|
1584
|
+
1
|
|
1585
|
+
sage: G.galoisisnormal(L[2])
|
|
1586
|
+
0
|
|
1587
|
+
|
|
1588
|
+
sage: # needs sage.rings.number_field
|
|
1589
|
+
sage: F = QuadraticField(5, 'alpha')
|
|
1590
|
+
sage: nf = F.__pari__()
|
|
1591
|
+
sage: P = F.ideal(F.gen())
|
|
1592
|
+
sage: Q = F.ideal(2)
|
|
1593
|
+
sage: moduli = pari.matrix(2,2,[P.pari_prime(),4,Q.pari_prime(),4]) # needs sage.symbolic
|
|
1594
|
+
sage: residues = pari.vector(2,[0,1])
|
|
1595
|
+
sage: b = F(nf.idealchinese(moduli,residues)) # needs sage.symbolic
|
|
1596
|
+
sage: b.valuation(P) >= 4 # needs sage.symbolic
|
|
1597
|
+
True
|
|
1598
|
+
sage: (b-1).valuation(Q) >= 2 # needs sage.symbolic
|
|
1599
|
+
True
|
|
1600
|
+
|
|
1601
|
+
sage: # needs sage.rings.number_field sage.symbolic
|
|
1602
|
+
sage: F = NumberField(x^3-2, 'alpha')
|
|
1603
|
+
sage: nf = F.__pari__()
|
|
1604
|
+
sage: x = pari('[1, -1, 2]~')
|
|
1605
|
+
sage: y = pari('[1, -1, 3]~')
|
|
1606
|
+
sage: nf.idealcoprime(x, y)
|
|
1607
|
+
1
|
|
1608
|
+
|
|
1609
|
+
sage: y = pari('[2, -2, 4]~')
|
|
1610
|
+
sage: nf.idealcoprime(x, y) # needs sage.rings.number_field
|
|
1611
|
+
[5/43, 9/43, -1/43]~
|
|
1612
|
+
|
|
1613
|
+
sage: # needs sage.rings.number_field
|
|
1614
|
+
sage: R.<x> = PolynomialRing(QQ)
|
|
1615
|
+
sage: K.<a> = NumberField(x^2 + 1)
|
|
1616
|
+
sage: L = K.pari_nf().ideallist(100)
|
|
1617
|
+
sage: L[0] # One ideal of norm 1. # needs sage.symbolic
|
|
1618
|
+
[[1, 0; 0, 1]]
|
|
1619
|
+
sage: L[64] # 4 ideals of norm 65. # needs sage.symbolic
|
|
1620
|
+
[[65, 8; 0, 1], [65, 47; 0, 1], [65, 18; 0, 1], [65, 57; 0, 1]]
|
|
1621
|
+
|
|
1622
|
+
sage: # needs sage.rings.number_field
|
|
1623
|
+
sage: F = NumberField(x^3-2, 'alpha')
|
|
1624
|
+
sage: nf = F.__pari__()
|
|
1625
|
+
sage: I = pari('[1, -1, 2]~')
|
|
1626
|
+
sage: bid = nf.idealstar(I)
|
|
1627
|
+
sage: nf.ideallog(5, bid)
|
|
1628
|
+
[25]~
|
|
1629
|
+
|
|
1630
|
+
sage: # needs sage.rings.number_field
|
|
1631
|
+
sage: K.<i> = QuadraticField(-1)
|
|
1632
|
+
sage: F = pari(K).idealprimedec(5); F
|
|
1633
|
+
[[5, [-2, 1]~, 1, 1, [2, -1; 1, 2]], [5, [2, 1]~, 1, 1, [-2, -1; 1, -2]]]
|
|
1634
|
+
sage: F[0].pr_get_p()
|
|
1635
|
+
5
|
|
1636
|
+
|
|
1637
|
+
sage: # needs sage.rings.number_field
|
|
1638
|
+
sage: x = polygen(ZZ)
|
|
1639
|
+
sage: F = NumberField(x^3 - 2, 'alpha')
|
|
1640
|
+
sage: nf = F.__pari__()
|
|
1641
|
+
sage: I = pari('[1, -1, 2]~')
|
|
1642
|
+
sage: nf.idealstar(I)
|
|
1643
|
+
[[[43, 9, 5; 0, 1, 0; 0, 0, 1], [0]], [42, [42]], [Mat([[43, [9, 1, 0]~, 1, 1, [-5, 2, -18; -9, -5, 2; 1, -9, -5]], 1]), Mat([[43, [9, 1, 0]~, 1, 1, [-5, 2, -18; -9, -5, 2; 1, -9, -5]], 1])], [[[[42], [3], [43, 9, 5; 0, 1, 0; 0, 0, 1], [[[-14, -8, 20]~, [1, 34, 38], [43, [9, 1, 0]~, 1, 1, [-5, 2, -18; -9, -5, 2; 1, -9, -5]]]~, 3, [42, [2, 1; 3, 1; 7, 1]]]]], [[], Vecsmall([])]], [Mat(1)]]
|
|
1644
|
+
|
|
1645
|
+
sage: # needs sage.rings.number_field
|
|
1646
|
+
sage: x = polygen(QQ)
|
|
1647
|
+
sage: K.<a> = NumberField(x^3 - 17)
|
|
1648
|
+
sage: Kpari = K.pari_nf()
|
|
1649
|
+
sage: Kpari.getattr('zk')
|
|
1650
|
+
[1, 1/3*y^2 - 1/3*y + 1/3, y]
|
|
1651
|
+
sage: Kpari.nfbasistoalg(42)
|
|
1652
|
+
Mod(42, y^3 - 17)
|
|
1653
|
+
sage: Kpari.nfbasistoalg("[3/2, -5, 0]~")
|
|
1654
|
+
Mod(-5/3*y^2 + 5/3*y - 1/6, y^3 - 17)
|
|
1655
|
+
sage: Kpari.getattr('zk') * pari("[3/2, -5, 0]~")
|
|
1656
|
+
-5/3*y^2 + 5/3*y - 1/6
|
|
1657
|
+
|
|
1658
|
+
sage: # needs sage.rings.number_field
|
|
1659
|
+
sage: k.<a> = NumberField(x^2 + 5)
|
|
1660
|
+
sage: x = 10
|
|
1661
|
+
sage: y = a + 1
|
|
1662
|
+
sage: pari(k).nfeltdiveuc(x, y)
|
|
1663
|
+
[2, -2]~
|
|
1664
|
+
|
|
1665
|
+
sage: # needs sage.rings.number_field
|
|
1666
|
+
sage: x = polygen(ZZ)
|
|
1667
|
+
sage: k.<a> = NumberField(x^2 + 5)
|
|
1668
|
+
sage: I = k.ideal(a)
|
|
1669
|
+
sage: kp = pari(k)
|
|
1670
|
+
sage: kp.nfeltreduce(12, I.pari_hnf())
|
|
1671
|
+
[2, 0]~
|
|
1672
|
+
sage: 12 - k(kp.nfeltreduce(12, I.pari_hnf())) in I
|
|
1673
|
+
True
|
|
1674
|
+
|
|
1675
|
+
sage: x = QQ['x'].0; nf = pari(x^2 + 2).nfinit()
|
|
1676
|
+
sage: nf.nfgaloisconj()
|
|
1677
|
+
[-x, x]~
|
|
1678
|
+
sage: nf = pari(x^3 + 2).nfinit()
|
|
1679
|
+
sage: nf.nfgaloisconj()
|
|
1680
|
+
[x]~
|
|
1681
|
+
sage: nf = pari(x^4 + 2).nfinit()
|
|
1682
|
+
sage: nf.nfgaloisconj()
|
|
1683
|
+
[-x, x]~
|
|
1684
|
+
|
|
1685
|
+
sage: # needs sage.rings.number_field
|
|
1686
|
+
sage: x = polygen(QQ)
|
|
1687
|
+
sage: K.<t> = NumberField(x^3 - x + 1)
|
|
1688
|
+
sage: pari(K).nfhilbert(t, t + 2)
|
|
1689
|
+
-1
|
|
1690
|
+
sage: P = K.ideal(t^2 + t - 2) # Prime ideal above 5
|
|
1691
|
+
sage: pari(K).nfhilbert(t, t + 2, P.pari_prime())
|
|
1692
|
+
-1
|
|
1693
|
+
sage: P = K.ideal(t^2 + 3*t - 1) # Prime ideal above 23, ramified
|
|
1694
|
+
sage: pari(K).nfhilbert(t, t + 2, P.pari_prime())
|
|
1695
|
+
1
|
|
1696
|
+
|
|
1697
|
+
sage: # needs sage.rings.number_field
|
|
1698
|
+
sage: F.<a> = NumberField(x^2-x-1)
|
|
1699
|
+
sage: Fp = pari(F)
|
|
1700
|
+
sage: A = matrix(F,[[1,2,a,3],[3,0,a+2,0],[0,0,a,2],[3+a,a,0,1]])
|
|
1701
|
+
sage: I = [F.ideal(-2*a+1),F.ideal(7), F.ideal(3),F.ideal(1)]
|
|
1702
|
+
sage: Fp.nfhnf([pari(A),[pari(P) for P in I]])
|
|
1703
|
+
[[1, [-969/5, -1/15]~, [15, -2]~, [-1938, -3]~; 0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1], [[3997, 1911; 0, 7], [15, 6; 0, 3], 1, 1]]
|
|
1704
|
+
sage: K.<b> = NumberField(x^3-2)
|
|
1705
|
+
sage: Kp = pari(K)
|
|
1706
|
+
sage: A = matrix(K,[[1,0,0,5*b],[1,2*b^2,b,57],[0,2,1,b^2-3],[2,0,0,b]])
|
|
1707
|
+
sage: I = [K.ideal(2),K.ideal(3+b^2),K.ideal(1),K.ideal(1)]
|
|
1708
|
+
sage: Kp.nfhnf([pari(A),[pari(P) for P in I]])
|
|
1709
|
+
[[1, -225, 72, -31; 0, 1, [0, -1, 0]~, [0, 0, -1/2]~; 0, 0, 1, [0, 0, -1/2]~; 0, 0, 0, 1], [[1116, 756, 612; 0, 18, 0; 0, 0, 18], 2, 1, [2, 0, 0; 0, 1, 0; 0, 0, 1]]]
|
|
1710
|
+
sage: K.<b> = NumberField(x^2+5)
|
|
1711
|
+
sage: Kp = pari(K)
|
|
1712
|
+
sage: A = matrix(K,[[1,0,0,5*b],[1,2*b^2,b,57],[0,2,1,b^2-3],[2,0,0,b]])
|
|
1713
|
+
sage: I = [K.ideal(2),K.ideal(3+b^2),K.ideal(1),K.ideal(1)]
|
|
1714
|
+
sage: Kp.nfhnf([pari(A),[pari(P) for P in I]])
|
|
1715
|
+
[[1, [15, 6]~, [0, -54]~, [113, 72]~; 0, 1, [-4, -1]~, [0, -1]~; 0, 0, 1, 0; 0, 0, 0, 1], [[360, 180; 0, 180], [6, 4; 0, 2], 1, 1]]
|
|
1716
|
+
sage: A = matrix(K,[[1,0,0,5*b],[1,2*b,b,57],[0,2,1,b-3],[2,0,b,b]])
|
|
1717
|
+
sage: I = [K.ideal(2).factor()[0][0],K.ideal(3+b),K.ideal(1),K.ideal(1)]
|
|
1718
|
+
sage: Kp.nfhnf([pari(A),[pari(P) for P in I]])
|
|
1719
|
+
[[1, [7605, 4]~, [5610, 5]~, [7913, -6]~; 0, 1, 0, -1; 0, 0, 1, 0; 0, 0, 0, 1], [[19320, 13720; 0, 56], [2, 1; 0, 1], 1, 1]]
|
|
1720
|
+
|
|
1721
|
+
sage: pari('x^3 - 17').nfinit()
|
|
1722
|
+
[x^3 - 17, [1, 1], -867, 3, [[1, 1.68006914259990, 2.57128159065824; 1, -0.340034571299952 - 2.65083754153991*I, -1.28564079532912 + 2.22679517779329*I], [1, 1.68006914259990, 2.57128159065824; 1, -2.99087211283986, 0.941154382464174; 1, 2.31080297023995, -3.51243597312241], [16, 27, 41; 16, -48, 15; 16, 37, -56], [3, 1, 0; 1, -11, 17; 0, 17, 0], [51, 0, 16; 0, 17, 3; 0, 0, 1], [17, 0, -1; 0, 0, 3; -1, 3, 2], [51, [-17, 6, -1; 0, -18, 3; 1, 0, -16]], [3, 17]], [2.57128159065824, -1.28564079532912 + 2.22679517779329*I], [3, x^2 - x + 1, 3*x], [1, 0, -1; 0, 0, 3; 0, 1, 1], [1, 0, 0, 0, -4, 6, 0, 6, -1; 0, 1, 0, 1, 1, -1, 0, -1, 3; 0, 0, 1, 0, 2, 0, 1, 0, 1]]
|
|
1723
|
+
sage: pari('x^2 + 10^100 + 1').nfinit()
|
|
1724
|
+
[...]
|
|
1725
|
+
sage: pari('1.0').nfinit()
|
|
1726
|
+
Traceback (most recent call last):
|
|
1727
|
+
...
|
|
1728
|
+
PariError: incorrect type in checknf [please apply nfinit()] (t_REAL)
|
|
1729
|
+
|
|
1730
|
+
sage: # needs sage.rings.number_field
|
|
1731
|
+
sage: F = NumberField(x^3-2,'alpha')
|
|
1732
|
+
sage: G = NumberField(x^3-2,'beta')
|
|
1733
|
+
sage: F.__pari__().nfisisom(G.__pari__())
|
|
1734
|
+
[y]
|
|
1735
|
+
sage: GG = NumberField(x^3-4,'gamma')
|
|
1736
|
+
sage: F.__pari__().nfisisom(GG.__pari__())
|
|
1737
|
+
[1/2*y^2]
|
|
1738
|
+
sage: F.__pari__().nfisisom(GG.pari_nf())
|
|
1739
|
+
[1/2*y^2]
|
|
1740
|
+
sage: F.pari_nf().nfisisom(GG.__pari__()[0])
|
|
1741
|
+
[1/2*y^2]
|
|
1742
|
+
sage: H = NumberField(x^2-2,'alpha')
|
|
1743
|
+
sage: F.__pari__().nfisisom(H.__pari__())
|
|
1744
|
+
0
|
|
1745
|
+
sage: K.<a> = NumberField(x^2 + x + 1)
|
|
1746
|
+
sage: L.<b> = NumberField(x^2 + 3)
|
|
1747
|
+
sage: pari(K).nfisisom(L)
|
|
1748
|
+
[-1/2*y - 1/2, 1/2*y - 1/2]
|
|
1749
|
+
|
|
1750
|
+
sage: y = QQ['yy'].0; _ = pari(y) # pari has variable ordering rules
|
|
1751
|
+
sage: x = QQ['zz'].0; nf = pari(x^2 + 2).nfinit()
|
|
1752
|
+
sage: nf.nfroots(y^2 + 2)
|
|
1753
|
+
[Mod(-zz, zz^2 + 2), Mod(zz, zz^2 + 2)]~
|
|
1754
|
+
sage: nf = pari(x^3 + 2).nfinit()
|
|
1755
|
+
sage: nf.nfroots(y^3 + 2)
|
|
1756
|
+
[Mod(zz, zz^3 + 2)]~
|
|
1757
|
+
sage: nf = pari(x^4 + 2).nfinit()
|
|
1758
|
+
sage: nf.nfroots(y^4 + 2)
|
|
1759
|
+
[Mod(-zz, zz^4 + 2), Mod(zz, zz^4 + 2)]~
|
|
1760
|
+
|
|
1761
|
+
sage: nf = pari('x^2 + 1').nfinit()
|
|
1762
|
+
sage: nf.nfrootsof1()
|
|
1763
|
+
[4, [0, 1]~]
|
|
1764
|
+
|
|
1765
|
+
sage: x = ZZ['xx1'].0; pari(x)
|
|
1766
|
+
xx1
|
|
1767
|
+
sage: y = ZZ['yy1'].0; pari(y)
|
|
1768
|
+
yy1
|
|
1769
|
+
sage: nf = pari(y^2 - 6*y + 24).nfinit()
|
|
1770
|
+
sage: rnf = nf.rnfinit(x^2 - pari(y))
|
|
1771
|
+
sage: P = pari('[[[1, 0]~, [0, 0]~; [0, 0]~, [1, 0]~], [[2, 0; 0, 2], [2, 0; 0, 1/2]]]')
|
|
1772
|
+
sage: rnf.rnfidealdown(P)
|
|
1773
|
+
2
|
|
1774
|
+
|
|
1775
|
+
sage: f = pari('y^3+y+1')
|
|
1776
|
+
sage: K = f.nfinit()
|
|
1777
|
+
sage: x = pari('x'); y = pari('y')
|
|
1778
|
+
sage: g = x^5 - x^2 + y
|
|
1779
|
+
sage: L = K.rnfinit(g)
|
|
1780
|
+
|
|
1781
|
+
sage: pari(-23).quadhilbert()
|
|
1782
|
+
x^3 - x^2 + 1
|
|
1783
|
+
sage: pari(145).quadhilbert()
|
|
1784
|
+
x^4 - x^3 - 5*x^2 - x + 1
|
|
1785
|
+
sage: pari(-12).quadhilbert() # Not fundamental
|
|
1786
|
+
Traceback (most recent call last):
|
|
1787
|
+
...
|
|
1788
|
+
PariError: domain error in quadray: isfundamental(D) = 0
|
|
1789
|
+
|
|
1790
|
+
sage: # needs sage.rings.number_field sage.symbolic
|
|
1791
|
+
sage: x = SR.symbol('x')
|
|
1792
|
+
sage: F = NumberField(x^3-2,'alpha')
|
|
1793
|
+
sage: F.__pari__()[0].nfdisc()
|
|
1794
|
+
-108
|
|
1795
|
+
sage: G = NumberField(x^5-11,'beta')
|
|
1796
|
+
sage: G.__pari__()[0].nfdisc()
|
|
1797
|
+
45753125
|
|
1798
|
+
sage: f = x^3-2
|
|
1799
|
+
sage: f.__pari__()
|
|
1800
|
+
x^3 - 2
|
|
1801
|
+
sage: f.__pari__().nfdisc()
|
|
1802
|
+
-108
|
|
1803
|
+
|
|
1804
|
+
These are some doctests that used to be part of Sage and were removed from the cypari2
|
|
1805
|
+
library::
|
|
1806
|
+
|
|
1807
|
+
sage: e = pari([0,0,0,-82,0]).ellinit()
|
|
1808
|
+
sage: eta1 = e.elleta(precision=50)[0]
|
|
1809
|
+
sage: eta1.sage()
|
|
1810
|
+
3.6054636014326520859158205642077267748
|
|
1811
|
+
sage: eta1 = e.elleta(precision=150)[0]
|
|
1812
|
+
sage: eta1.sage()
|
|
1813
|
+
3.605463601432652085915820564207726774810268996598024745444380641429820491740 # 64-bit
|
|
1814
|
+
3.605463601432652085915820564207726774810268996598024745444380641430 # 32-bit
|
|
1815
|
+
sage: from cypari2 import Pari
|
|
1816
|
+
sage: pari = Pari()
|
|
1817
|
+
|
|
1818
|
+
sage: # needs sage.symbolic
|
|
1819
|
+
sage: f = pari('(2/3)*x^3 + x - 5/7 + y'); f
|
|
1820
|
+
2/3*x^3 + x + (y - 5/7)
|
|
1821
|
+
sage: var('x,y')
|
|
1822
|
+
(x, y)
|
|
1823
|
+
sage: f.sage({'x':x, 'y':y})
|
|
1824
|
+
2/3*x^3 + x + y - 5/7
|
|
1825
|
+
|
|
1826
|
+
sage: pari.default("debug")
|
|
1827
|
+
0
|
|
1828
|
+
sage: pari.default("debug", 3)
|
|
1829
|
+
sage: pari(2**67+1).factor()
|
|
1830
|
+
IFAC: cracking composite
|
|
1831
|
+
49191317529892137643
|
|
1832
|
+
IFAC: factor 6713103182899
|
|
1833
|
+
is prime
|
|
1834
|
+
IFAC: factor 7327657
|
|
1835
|
+
is prime
|
|
1836
|
+
IFAC: prime 7327657
|
|
1837
|
+
appears with exponent = 1
|
|
1838
|
+
IFAC: prime 6713103182899
|
|
1839
|
+
appears with exponent = 1
|
|
1840
|
+
IFAC: found 2 large prime (power) factors.
|
|
1841
|
+
[3, 1; 7327657, 1; 6713103182899, 1]
|
|
1842
|
+
sage: pari.default("debug", 0)
|
|
1843
|
+
sage: pari(2**67+1).factor()
|
|
1844
|
+
[3, 1; 7327657, 1; 6713103182899, 1]
|
|
1845
|
+
|
|
1846
|
+
sage: pari(18).bernreal(precision=192).sage()
|
|
1847
|
+
54.9711779448621553884711779448621553884711779448621553885
|
|
1848
|
+
"""
|