passagemath-singular 10.6.31rc3__cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_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-singular might be problematic. Click here for more details.
- PySingular.cpython-314-x86_64-linux-gnu.so +0 -0
- passagemath_singular-10.6.31rc3.dist-info/METADATA +183 -0
- passagemath_singular-10.6.31rc3.dist-info/RECORD +491 -0
- passagemath_singular-10.6.31rc3.dist-info/WHEEL +6 -0
- passagemath_singular-10.6.31rc3.dist-info/top_level.txt +3 -0
- passagemath_singular.libs/libSingular-4-20aec911.4.1.so +0 -0
- passagemath_singular.libs/libcddgmp-21acf0c6.so.0.1.3 +0 -0
- passagemath_singular.libs/libfactory-4-fcee31da.4.1.so +0 -0
- passagemath_singular.libs/libflint-66e12231.so.21.0.0 +0 -0
- passagemath_singular.libs/libgf2x-a4cdec90.so.3.0.0 +0 -0
- passagemath_singular.libs/libgfortran-83c28eba.so.5.0.0 +0 -0
- passagemath_singular.libs/libgmp-6e109695.so.10.5.0 +0 -0
- passagemath_singular.libs/libgsl-cda90e79.so.28.0.0 +0 -0
- passagemath_singular.libs/libmpfr-82690d50.so.6.2.1 +0 -0
- passagemath_singular.libs/libntl-e6f0d543.so.44.0.1 +0 -0
- passagemath_singular.libs/libomalloc-0-5c9e866e.9.6.so +0 -0
- passagemath_singular.libs/libopenblasp-r0-6dcb67f9.3.29.so +0 -0
- passagemath_singular.libs/libpolys-4-5c0a87e0.4.1.so +0 -0
- passagemath_singular.libs/libquadmath-2284e583.so.0.0.0 +0 -0
- passagemath_singular.libs/libreadline-ea270e21.so.8.2 +0 -0
- passagemath_singular.libs/libsingular_resources-4-a1aafc6d.4.1.so +0 -0
- passagemath_singular.libs/libtinfo-ceb117d9.so.6.3 +0 -0
- sage/algebras/all__sagemath_singular.py +3 -0
- sage/algebras/fusion_rings/all.py +19 -0
- sage/algebras/fusion_rings/f_matrix.py +2448 -0
- sage/algebras/fusion_rings/fast_parallel_fmats_methods.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/algebras/fusion_rings/fast_parallel_fmats_methods.pxd +5 -0
- sage/algebras/fusion_rings/fast_parallel_fmats_methods.pyx +538 -0
- sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pxd +3 -0
- sage/algebras/fusion_rings/fast_parallel_fusion_ring_braid_repn.pyx +331 -0
- sage/algebras/fusion_rings/fusion_double.py +899 -0
- sage/algebras/fusion_rings/fusion_ring.py +1580 -0
- sage/algebras/fusion_rings/poly_tup_engine.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/algebras/fusion_rings/poly_tup_engine.pxd +24 -0
- sage/algebras/fusion_rings/poly_tup_engine.pyx +579 -0
- sage/algebras/fusion_rings/shm_managers.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/algebras/fusion_rings/shm_managers.pxd +24 -0
- sage/algebras/fusion_rings/shm_managers.pyx +780 -0
- sage/algebras/letterplace/all.py +1 -0
- sage/algebras/letterplace/free_algebra_element_letterplace.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/algebras/letterplace/free_algebra_element_letterplace.pxd +18 -0
- sage/algebras/letterplace/free_algebra_element_letterplace.pyx +755 -0
- sage/algebras/letterplace/free_algebra_letterplace.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/algebras/letterplace/free_algebra_letterplace.pxd +35 -0
- sage/algebras/letterplace/free_algebra_letterplace.pyx +914 -0
- sage/algebras/letterplace/letterplace_ideal.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/algebras/letterplace/letterplace_ideal.pyx +408 -0
- sage/algebras/quatalg/all.py +2 -0
- sage/algebras/quatalg/quaternion_algebra.py +4778 -0
- sage/algebras/quatalg/quaternion_algebra_cython.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/algebras/quatalg/quaternion_algebra_cython.pyx +261 -0
- sage/algebras/quatalg/quaternion_algebra_element.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/algebras/quatalg/quaternion_algebra_element.pxd +29 -0
- sage/algebras/quatalg/quaternion_algebra_element.pyx +2176 -0
- sage/all__sagemath_singular.py +11 -0
- sage/ext_data/all__sagemath_singular.py +1 -0
- sage/ext_data/singular/function_field/core.lib +98 -0
- sage/interfaces/all__sagemath_singular.py +1 -0
- sage/interfaces/singular.py +2835 -0
- sage/libs/all__sagemath_singular.py +1 -0
- sage/libs/singular/__init__.py +1 -0
- sage/libs/singular/decl.pxd +1168 -0
- sage/libs/singular/function.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/libs/singular/function.pxd +87 -0
- sage/libs/singular/function.pyx +1901 -0
- sage/libs/singular/function_factory.py +61 -0
- sage/libs/singular/groebner_strategy.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/libs/singular/groebner_strategy.pxd +22 -0
- sage/libs/singular/groebner_strategy.pyx +582 -0
- sage/libs/singular/option.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/libs/singular/option.pyx +671 -0
- sage/libs/singular/polynomial.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/libs/singular/polynomial.pxd +39 -0
- sage/libs/singular/polynomial.pyx +661 -0
- sage/libs/singular/ring.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/libs/singular/ring.pxd +58 -0
- sage/libs/singular/ring.pyx +893 -0
- sage/libs/singular/singular.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/libs/singular/singular.pxd +72 -0
- sage/libs/singular/singular.pyx +1944 -0
- sage/libs/singular/standard_options.py +145 -0
- sage/matrix/all__sagemath_singular.py +1 -0
- sage/matrix/matrix_mpolynomial_dense.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/matrix/matrix_mpolynomial_dense.pxd +7 -0
- sage/matrix/matrix_mpolynomial_dense.pyx +615 -0
- sage/rings/all__sagemath_singular.py +1 -0
- sage/rings/function_field/all__sagemath_singular.py +1 -0
- sage/rings/function_field/derivations_polymod.py +911 -0
- sage/rings/function_field/element_polymod.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/rings/function_field/element_polymod.pyx +406 -0
- sage/rings/function_field/function_field_polymod.py +2611 -0
- sage/rings/function_field/ideal_polymod.py +1775 -0
- sage/rings/function_field/order_polymod.py +1475 -0
- sage/rings/function_field/place_polymod.py +681 -0
- sage/rings/polynomial/all__sagemath_singular.py +1 -0
- sage/rings/polynomial/multi_polynomial_ideal_libsingular.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/multi_polynomial_ideal_libsingular.pxd +5 -0
- sage/rings/polynomial/multi_polynomial_ideal_libsingular.pyx +339 -0
- sage/rings/polynomial/multi_polynomial_libsingular.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/multi_polynomial_libsingular.pxd +30 -0
- sage/rings/polynomial/multi_polynomial_libsingular.pyx +6277 -0
- sage/rings/polynomial/plural.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/rings/polynomial/plural.pxd +48 -0
- sage/rings/polynomial/plural.pyx +3171 -0
- sage/symbolic/all__sagemath_singular.py +1 -0
- sage/symbolic/comparison_impl.pxi +428 -0
- sage/symbolic/constants_c_impl.pxi +178 -0
- sage/symbolic/expression.cpython-314-x86_64-linux-gnu.so +0 -0
- sage/symbolic/expression.pxd +7 -0
- sage/symbolic/expression.pyx +14200 -0
- sage/symbolic/getitem_impl.pxi +202 -0
- sage/symbolic/pynac.pxi +572 -0
- sage/symbolic/pynac_constant_impl.pxi +133 -0
- sage/symbolic/pynac_function_impl.pxi +206 -0
- sage/symbolic/pynac_impl.pxi +2576 -0
- sage/symbolic/pynac_wrap.h +124 -0
- sage/symbolic/series_impl.pxi +272 -0
- sage/symbolic/substitution_map_impl.pxi +94 -0
- sage_wheels/bin/ESingular +0 -0
- sage_wheels/bin/Singular +0 -0
- sage_wheels/bin/TSingular +0 -0
- sage_wheels/lib/singular/MOD/cohomo.la +41 -0
- sage_wheels/lib/singular/MOD/cohomo.so +0 -0
- sage_wheels/lib/singular/MOD/customstd.la +41 -0
- sage_wheels/lib/singular/MOD/customstd.so +0 -0
- sage_wheels/lib/singular/MOD/freealgebra.la +41 -0
- sage_wheels/lib/singular/MOD/freealgebra.so +0 -0
- sage_wheels/lib/singular/MOD/gfanlib.la +41 -0
- sage_wheels/lib/singular/MOD/gfanlib.so +0 -0
- sage_wheels/lib/singular/MOD/gitfan.la +41 -0
- sage_wheels/lib/singular/MOD/gitfan.so +0 -0
- sage_wheels/lib/singular/MOD/interval.la +41 -0
- sage_wheels/lib/singular/MOD/interval.so +0 -0
- sage_wheels/lib/singular/MOD/loctriv.la +41 -0
- sage_wheels/lib/singular/MOD/loctriv.so +0 -0
- sage_wheels/lib/singular/MOD/machinelearning.la +41 -0
- sage_wheels/lib/singular/MOD/machinelearning.so +0 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldGeneral.la +41 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldGeneral.so +0 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldIndep.la +41 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldIndep.so +0 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldQ.la +41 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldQ.so +0 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldZp.la +41 -0
- sage_wheels/lib/singular/MOD/p_Procs_FieldZp.so +0 -0
- sage_wheels/lib/singular/MOD/partialgb.la +41 -0
- sage_wheels/lib/singular/MOD/partialgb.so +0 -0
- sage_wheels/lib/singular/MOD/pyobject.la +41 -0
- sage_wheels/lib/singular/MOD/pyobject.so +0 -0
- sage_wheels/lib/singular/MOD/singmathic.la +41 -0
- sage_wheels/lib/singular/MOD/singmathic.so +0 -0
- sage_wheels/lib/singular/MOD/sispasm.la +41 -0
- sage_wheels/lib/singular/MOD/sispasm.so +0 -0
- sage_wheels/lib/singular/MOD/subsets.la +41 -0
- sage_wheels/lib/singular/MOD/subsets.so +0 -0
- sage_wheels/lib/singular/MOD/systhreads.la +41 -0
- sage_wheels/lib/singular/MOD/systhreads.so +0 -0
- sage_wheels/lib/singular/MOD/syzextra.la +41 -0
- sage_wheels/lib/singular/MOD/syzextra.so +0 -0
- sage_wheels/libexec/singular/MOD/change_cost +0 -0
- sage_wheels/libexec/singular/MOD/singularsurf +11 -0
- sage_wheels/libexec/singular/MOD/singularsurf_jupyter +9 -0
- sage_wheels/libexec/singular/MOD/singularsurf_win +10 -0
- sage_wheels/libexec/singular/MOD/solve_IP +0 -0
- sage_wheels/libexec/singular/MOD/surfex +16 -0
- sage_wheels/libexec/singular/MOD/toric_ideal +0 -0
- sage_wheels/share/factory/gftables/10201 +342 -0
- sage_wheels/share/factory/gftables/1024 +37 -0
- sage_wheels/share/factory/gftables/10609 +356 -0
- sage_wheels/share/factory/gftables/11449 +384 -0
- sage_wheels/share/factory/gftables/11881 +398 -0
- sage_wheels/share/factory/gftables/121 +6 -0
- sage_wheels/share/factory/gftables/12167 +408 -0
- sage_wheels/share/factory/gftables/125 +7 -0
- sage_wheels/share/factory/gftables/12769 +428 -0
- sage_wheels/share/factory/gftables/128 +7 -0
- sage_wheels/share/factory/gftables/1331 +47 -0
- sage_wheels/share/factory/gftables/1369 +48 -0
- sage_wheels/share/factory/gftables/14641 +490 -0
- sage_wheels/share/factory/gftables/15625 +523 -0
- sage_wheels/share/factory/gftables/16 +3 -0
- sage_wheels/share/factory/gftables/16129 +540 -0
- sage_wheels/share/factory/gftables/16384 +549 -0
- sage_wheels/share/factory/gftables/16807 +563 -0
- sage_wheels/share/factory/gftables/1681 +58 -0
- sage_wheels/share/factory/gftables/169 +8 -0
- sage_wheels/share/factory/gftables/17161 +574 -0
- sage_wheels/share/factory/gftables/1849 +64 -0
- sage_wheels/share/factory/gftables/18769 +628 -0
- sage_wheels/share/factory/gftables/19321 +646 -0
- sage_wheels/share/factory/gftables/19683 +659 -0
- sage_wheels/share/factory/gftables/2048 +71 -0
- sage_wheels/share/factory/gftables/2187 +75 -0
- sage_wheels/share/factory/gftables/2197 +76 -0
- sage_wheels/share/factory/gftables/2209 +76 -0
- sage_wheels/share/factory/gftables/22201 +742 -0
- sage_wheels/share/factory/gftables/22801 +762 -0
- sage_wheels/share/factory/gftables/2401 +82 -0
- sage_wheels/share/factory/gftables/243 +11 -0
- sage_wheels/share/factory/gftables/24389 +815 -0
- sage_wheels/share/factory/gftables/24649 +824 -0
- sage_wheels/share/factory/gftables/25 +3 -0
- sage_wheels/share/factory/gftables/256 +11 -0
- sage_wheels/share/factory/gftables/26569 +888 -0
- sage_wheels/share/factory/gftables/27 +3 -0
- sage_wheels/share/factory/gftables/27889 +932 -0
- sage_wheels/share/factory/gftables/2809 +96 -0
- sage_wheels/share/factory/gftables/28561 +954 -0
- sage_wheels/share/factory/gftables/289 +12 -0
- sage_wheels/share/factory/gftables/29791 +995 -0
- sage_wheels/share/factory/gftables/29929 +1000 -0
- sage_wheels/share/factory/gftables/3125 +107 -0
- sage_wheels/share/factory/gftables/32 +4 -0
- sage_wheels/share/factory/gftables/32041 +1070 -0
- sage_wheels/share/factory/gftables/32761 +1094 -0
- sage_wheels/share/factory/gftables/32768 +1095 -0
- sage_wheels/share/factory/gftables/343 +14 -0
- sage_wheels/share/factory/gftables/3481 +118 -0
- sage_wheels/share/factory/gftables/361 +14 -0
- sage_wheels/share/factory/gftables/36481 +1218 -0
- sage_wheels/share/factory/gftables/3721 +126 -0
- sage_wheels/share/factory/gftables/37249 +1244 -0
- sage_wheels/share/factory/gftables/38809 +1296 -0
- sage_wheels/share/factory/gftables/39601 +1322 -0
- sage_wheels/share/factory/gftables/4 +3 -0
- sage_wheels/share/factory/gftables/4096 +139 -0
- sage_wheels/share/factory/gftables/44521 +1486 -0
- sage_wheels/share/factory/gftables/4489 +152 -0
- sage_wheels/share/factory/gftables/49 +4 -0
- sage_wheels/share/factory/gftables/4913 +166 -0
- sage_wheels/share/factory/gftables/49729 +1660 -0
- sage_wheels/share/factory/gftables/5041 +170 -0
- sage_wheels/share/factory/gftables/50653 +1691 -0
- sage_wheels/share/factory/gftables/512 +20 -0
- sage_wheels/share/factory/gftables/51529 +1720 -0
- sage_wheels/share/factory/gftables/52441 +1750 -0
- sage_wheels/share/factory/gftables/529 +20 -0
- sage_wheels/share/factory/gftables/5329 +180 -0
- sage_wheels/share/factory/gftables/54289 +1812 -0
- sage_wheels/share/factory/gftables/57121 +1906 -0
- sage_wheels/share/factory/gftables/58081 +1938 -0
- sage_wheels/share/factory/gftables/59049 +1971 -0
- sage_wheels/share/factory/gftables/6241 +210 -0
- sage_wheels/share/factory/gftables/625 +23 -0
- sage_wheels/share/factory/gftables/63001 +2102 -0
- sage_wheels/share/factory/gftables/64 +5 -0
- sage_wheels/share/factory/gftables/6561 +221 -0
- sage_wheels/share/factory/gftables/6859 +231 -0
- sage_wheels/share/factory/gftables/6889 +232 -0
- sage_wheels/share/factory/gftables/729 +27 -0
- sage_wheels/share/factory/gftables/7921 +266 -0
- sage_wheels/share/factory/gftables/8 +3 -0
- sage_wheels/share/factory/gftables/81 +5 -0
- sage_wheels/share/factory/gftables/8192 +276 -0
- sage_wheels/share/factory/gftables/841 +30 -0
- sage_wheels/share/factory/gftables/9 +3 -0
- sage_wheels/share/factory/gftables/9409 +316 -0
- sage_wheels/share/factory/gftables/961 +34 -0
- sage_wheels/share/info/singular.info +191898 -0
- sage_wheels/share/singular/LIB/GND.lib +1359 -0
- sage_wheels/share/singular/LIB/JMBTest.lib +976 -0
- sage_wheels/share/singular/LIB/JMSConst.lib +1363 -0
- sage_wheels/share/singular/LIB/KVequiv.lib +699 -0
- sage_wheels/share/singular/LIB/SingularityDBM.lib +491 -0
- sage_wheels/share/singular/LIB/VecField.lib +1542 -0
- sage_wheels/share/singular/LIB/absfact.lib +959 -0
- sage_wheels/share/singular/LIB/ainvar.lib +730 -0
- sage_wheels/share/singular/LIB/aksaka.lib +419 -0
- sage_wheels/share/singular/LIB/alexpoly.lib +2542 -0
- sage_wheels/share/singular/LIB/algebra.lib +1193 -0
- sage_wheels/share/singular/LIB/all.lib +136 -0
- sage_wheels/share/singular/LIB/arcpoint.lib +514 -0
- sage_wheels/share/singular/LIB/arnold.lib +4553 -0
- sage_wheels/share/singular/LIB/arnoldclassify.lib +2058 -0
- sage_wheels/share/singular/LIB/arr.lib +3486 -0
- sage_wheels/share/singular/LIB/assprimeszerodim.lib +755 -0
- sage_wheels/share/singular/LIB/autgradalg.lib +3361 -0
- sage_wheels/share/singular/LIB/bfun.lib +1964 -0
- sage_wheels/share/singular/LIB/bimodules.lib +774 -0
- sage_wheels/share/singular/LIB/brillnoether.lib +226 -0
- sage_wheels/share/singular/LIB/brnoeth.lib +5017 -0
- sage_wheels/share/singular/LIB/central.lib +2169 -0
- sage_wheels/share/singular/LIB/chern.lib +4162 -0
- sage_wheels/share/singular/LIB/cimonom.lib +571 -0
- sage_wheels/share/singular/LIB/cisimplicial.lib +1835 -0
- sage_wheels/share/singular/LIB/classify.lib +3239 -0
- sage_wheels/share/singular/LIB/classify2.lib +1462 -0
- sage_wheels/share/singular/LIB/classifyMapGerms.lib +1515 -0
- sage_wheels/share/singular/LIB/classify_aeq.lib +3253 -0
- sage_wheels/share/singular/LIB/classifyceq.lib +2092 -0
- sage_wheels/share/singular/LIB/classifyci.lib +1133 -0
- sage_wheels/share/singular/LIB/combinat.lib +91 -0
- sage_wheels/share/singular/LIB/compregb.lib +276 -0
- sage_wheels/share/singular/LIB/control.lib +1636 -0
- sage_wheels/share/singular/LIB/crypto.lib +3795 -0
- sage_wheels/share/singular/LIB/curveInv.lib +667 -0
- sage_wheels/share/singular/LIB/curvepar.lib +1817 -0
- sage_wheels/share/singular/LIB/customstd.lib +100 -0
- sage_wheels/share/singular/LIB/deRham.lib +5979 -0
- sage_wheels/share/singular/LIB/decodegb.lib +2134 -0
- sage_wheels/share/singular/LIB/decomp.lib +1655 -0
- sage_wheels/share/singular/LIB/deflation.lib +872 -0
- sage_wheels/share/singular/LIB/deform.lib +925 -0
- sage_wheels/share/singular/LIB/difform.lib +3055 -0
- sage_wheels/share/singular/LIB/divisors.lib +750 -0
- sage_wheels/share/singular/LIB/dmod.lib +5817 -0
- sage_wheels/share/singular/LIB/dmodapp.lib +3269 -0
- sage_wheels/share/singular/LIB/dmodideal.lib +1211 -0
- sage_wheels/share/singular/LIB/dmodloc.lib +2645 -0
- sage_wheels/share/singular/LIB/dmodvar.lib +818 -0
- sage_wheels/share/singular/LIB/dummy.lib +17 -0
- sage_wheels/share/singular/LIB/elim.lib +1009 -0
- sage_wheels/share/singular/LIB/ellipticcovers.lib +548 -0
- sage_wheels/share/singular/LIB/enumpoints.lib +146 -0
- sage_wheels/share/singular/LIB/equising.lib +2127 -0
- sage_wheels/share/singular/LIB/ffmodstd.lib +2384 -0
- sage_wheels/share/singular/LIB/ffsolve.lib +1289 -0
- sage_wheels/share/singular/LIB/findifs.lib +778 -0
- sage_wheels/share/singular/LIB/finitediff.lib +1768 -0
- sage_wheels/share/singular/LIB/finvar.lib +7989 -0
- sage_wheels/share/singular/LIB/fpadim.lib +2429 -0
- sage_wheels/share/singular/LIB/fpalgebras.lib +1666 -0
- sage_wheels/share/singular/LIB/fpaprops.lib +1462 -0
- sage_wheels/share/singular/LIB/freegb.lib +3853 -0
- sage_wheels/share/singular/LIB/general.lib +1350 -0
- sage_wheels/share/singular/LIB/gfan.lib +1768 -0
- sage_wheels/share/singular/LIB/gitfan.lib +3130 -0
- sage_wheels/share/singular/LIB/gkdim.lib +99 -0
- sage_wheels/share/singular/LIB/gmspoly.lib +589 -0
- sage_wheels/share/singular/LIB/gmssing.lib +1739 -0
- sage_wheels/share/singular/LIB/goettsche.lib +909 -0
- sage_wheels/share/singular/LIB/graal.lib +1366 -0
- sage_wheels/share/singular/LIB/gradedModules.lib +2541 -0
- sage_wheels/share/singular/LIB/graphics.lib +360 -0
- sage_wheels/share/singular/LIB/grobcov.lib +7706 -0
- sage_wheels/share/singular/LIB/groups.lib +1123 -0
- sage_wheels/share/singular/LIB/grwalk.lib +507 -0
- sage_wheels/share/singular/LIB/hdepth.lib +194 -0
- sage_wheels/share/singular/LIB/help.cnf +57 -0
- sage_wheels/share/singular/LIB/hess.lib +1946 -0
- sage_wheels/share/singular/LIB/hnoether.lib +4292 -0
- sage_wheels/share/singular/LIB/hodge.lib +400 -0
- sage_wheels/share/singular/LIB/homolog.lib +1965 -0
- sage_wheels/share/singular/LIB/hyperel.lib +975 -0
- sage_wheels/share/singular/LIB/inout.lib +679 -0
- sage_wheels/share/singular/LIB/integralbasis.lib +6224 -0
- sage_wheels/share/singular/LIB/interval.lib +1418 -0
- sage_wheels/share/singular/LIB/intprog.lib +778 -0
- sage_wheels/share/singular/LIB/invar.lib +443 -0
- sage_wheels/share/singular/LIB/involut.lib +980 -0
- sage_wheels/share/singular/LIB/jacobson.lib +1215 -0
- sage_wheels/share/singular/LIB/kskernel.lib +534 -0
- sage_wheels/share/singular/LIB/latex.lib +3146 -0
- sage_wheels/share/singular/LIB/lejeune.lib +651 -0
- sage_wheels/share/singular/LIB/linalg.lib +2040 -0
- sage_wheels/share/singular/LIB/locnormal.lib +212 -0
- sage_wheels/share/singular/LIB/lrcalc.lib +526 -0
- sage_wheels/share/singular/LIB/makedbm.lib +294 -0
- sage_wheels/share/singular/LIB/mathml.lib +813 -0
- sage_wheels/share/singular/LIB/matrix.lib +1372 -0
- sage_wheels/share/singular/LIB/maxlike.lib +1132 -0
- sage_wheels/share/singular/LIB/methods.lib +212 -0
- sage_wheels/share/singular/LIB/moddiq.lib +322 -0
- sage_wheels/share/singular/LIB/modfinduni.lib +181 -0
- sage_wheels/share/singular/LIB/modnormal.lib +218 -0
- sage_wheels/share/singular/LIB/modprimdec.lib +1278 -0
- sage_wheels/share/singular/LIB/modquotient.lib +269 -0
- sage_wheels/share/singular/LIB/modstd.lib +1024 -0
- sage_wheels/share/singular/LIB/modular.lib +545 -0
- sage_wheels/share/singular/LIB/modules.lib +2561 -0
- sage_wheels/share/singular/LIB/modwalk.lib +609 -0
- sage_wheels/share/singular/LIB/mondromy.lib +1016 -0
- sage_wheels/share/singular/LIB/monomialideal.lib +3851 -0
- sage_wheels/share/singular/LIB/mprimdec.lib +2353 -0
- sage_wheels/share/singular/LIB/mregular.lib +1863 -0
- sage_wheels/share/singular/LIB/multigrading.lib +5629 -0
- sage_wheels/share/singular/LIB/ncHilb.lib +777 -0
- sage_wheels/share/singular/LIB/ncModslimgb.lib +791 -0
- sage_wheels/share/singular/LIB/ncalg.lib +16311 -0
- sage_wheels/share/singular/LIB/ncall.lib +31 -0
- sage_wheels/share/singular/LIB/ncdecomp.lib +468 -0
- sage_wheels/share/singular/LIB/ncfactor.lib +13371 -0
- sage_wheels/share/singular/LIB/ncfrac.lib +1023 -0
- sage_wheels/share/singular/LIB/nchilbert.lib +448 -0
- sage_wheels/share/singular/LIB/nchomolog.lib +759 -0
- sage_wheels/share/singular/LIB/ncloc.lib +361 -0
- sage_wheels/share/singular/LIB/ncpreim.lib +795 -0
- sage_wheels/share/singular/LIB/ncrat.lib +2849 -0
- sage_wheels/share/singular/LIB/nctools.lib +1887 -0
- sage_wheels/share/singular/LIB/nets.lib +1456 -0
- sage_wheels/share/singular/LIB/nfmodstd.lib +1000 -0
- sage_wheels/share/singular/LIB/nfmodsyz.lib +732 -0
- sage_wheels/share/singular/LIB/noether.lib +1106 -0
- sage_wheels/share/singular/LIB/normal.lib +8700 -0
- sage_wheels/share/singular/LIB/normaliz.lib +2226 -0
- sage_wheels/share/singular/LIB/ntsolve.lib +362 -0
- sage_wheels/share/singular/LIB/numerAlg.lib +560 -0
- sage_wheels/share/singular/LIB/numerDecom.lib +2261 -0
- sage_wheels/share/singular/LIB/olga.lib +1933 -0
- sage_wheels/share/singular/LIB/orbitparam.lib +351 -0
- sage_wheels/share/singular/LIB/parallel.lib +319 -0
- sage_wheels/share/singular/LIB/paraplanecurves.lib +3110 -0
- sage_wheels/share/singular/LIB/perron.lib +202 -0
- sage_wheels/share/singular/LIB/pfd.lib +2223 -0
- sage_wheels/share/singular/LIB/phindex.lib +642 -0
- sage_wheels/share/singular/LIB/pointid.lib +673 -0
- sage_wheels/share/singular/LIB/polybori.lib +1430 -0
- sage_wheels/share/singular/LIB/polyclass.lib +525 -0
- sage_wheels/share/singular/LIB/polylib.lib +1174 -0
- sage_wheels/share/singular/LIB/polymake.lib +1902 -0
- sage_wheels/share/singular/LIB/presolve.lib +1533 -0
- sage_wheels/share/singular/LIB/primdec.lib +9576 -0
- sage_wheels/share/singular/LIB/primdecint.lib +1782 -0
- sage_wheels/share/singular/LIB/primitiv.lib +401 -0
- sage_wheels/share/singular/LIB/puiseuxexpansions.lib +1631 -0
- sage_wheels/share/singular/LIB/purityfiltration.lib +960 -0
- sage_wheels/share/singular/LIB/qhmoduli.lib +1561 -0
- sage_wheels/share/singular/LIB/qmatrix.lib +293 -0
- sage_wheels/share/singular/LIB/random.lib +455 -0
- sage_wheels/share/singular/LIB/ratgb.lib +489 -0
- sage_wheels/share/singular/LIB/realclassify.lib +5759 -0
- sage_wheels/share/singular/LIB/realizationMatroids.lib +772 -0
- sage_wheels/share/singular/LIB/realrad.lib +1197 -0
- sage_wheels/share/singular/LIB/recover.lib +2628 -0
- sage_wheels/share/singular/LIB/redcgs.lib +3984 -0
- sage_wheels/share/singular/LIB/reesclos.lib +465 -0
- sage_wheels/share/singular/LIB/resbinomial.lib +2802 -0
- sage_wheels/share/singular/LIB/resgraph.lib +789 -0
- sage_wheels/share/singular/LIB/resjung.lib +820 -0
- sage_wheels/share/singular/LIB/resolve.lib +5110 -0
- sage_wheels/share/singular/LIB/resources.lib +170 -0
- sage_wheels/share/singular/LIB/reszeta.lib +5473 -0
- sage_wheels/share/singular/LIB/ring.lib +1328 -0
- sage_wheels/share/singular/LIB/ringgb.lib +343 -0
- sage_wheels/share/singular/LIB/rinvar.lib +1153 -0
- sage_wheels/share/singular/LIB/rootisolation.lib +1481 -0
- sage_wheels/share/singular/LIB/rootsmr.lib +709 -0
- sage_wheels/share/singular/LIB/rootsur.lib +886 -0
- sage_wheels/share/singular/LIB/rstandard.lib +607 -0
- sage_wheels/share/singular/LIB/rwalk.lib +336 -0
- sage_wheels/share/singular/LIB/sagbi.lib +1353 -0
- sage_wheels/share/singular/LIB/sagbiNormaliz.lib +1622 -0
- sage_wheels/share/singular/LIB/sagbiNormaliz0.lib +1498 -0
- sage_wheels/share/singular/LIB/sagbigrob.lib +449 -0
- sage_wheels/share/singular/LIB/schreyer.lib +321 -0
- sage_wheels/share/singular/LIB/schubert.lib +2551 -0
- sage_wheels/share/singular/LIB/sets.lib +524 -0
- sage_wheels/share/singular/LIB/sheafcoh.lib +1663 -0
- sage_wheels/share/singular/LIB/signcond.lib +437 -0
- sage_wheels/share/singular/LIB/sing.lib +1094 -0
- sage_wheels/share/singular/LIB/sing4ti2.lib +419 -0
- sage_wheels/share/singular/LIB/solve.lib +2243 -0
- sage_wheels/share/singular/LIB/spcurve.lib +1077 -0
- sage_wheels/share/singular/LIB/spectrum.lib +62 -0
- sage_wheels/share/singular/LIB/sresext.lib +757 -0
- sage_wheels/share/singular/LIB/ssi.lib +143 -0
- sage_wheels/share/singular/LIB/standard.lib +2769 -0
- sage_wheels/share/singular/LIB/stanleyreisner.lib +473 -0
- sage_wheels/share/singular/LIB/stdmodule.lib +547 -0
- sage_wheels/share/singular/LIB/stratify.lib +1070 -0
- sage_wheels/share/singular/LIB/surf.lib +506 -0
- sage_wheels/share/singular/LIB/surf_jupyter.lib +223 -0
- sage_wheels/share/singular/LIB/surfacesignature.lib +522 -0
- sage_wheels/share/singular/LIB/surfex.lib +1462 -0
- sage_wheels/share/singular/LIB/swalk.lib +877 -0
- sage_wheels/share/singular/LIB/symodstd.lib +1570 -0
- sage_wheels/share/singular/LIB/systhreads.lib +74 -0
- sage_wheels/share/singular/LIB/tasks.lib +1324 -0
- sage_wheels/share/singular/LIB/tateProdCplxNegGrad.lib +2412 -0
- sage_wheels/share/singular/LIB/teachstd.lib +858 -0
- sage_wheels/share/singular/LIB/template.lib +116 -0
- sage_wheels/share/singular/LIB/toric.lib +1119 -0
- sage_wheels/share/singular/LIB/transformation.lib +116 -0
- sage_wheels/share/singular/LIB/triang.lib +1197 -0
- sage_wheels/share/singular/LIB/tropical.lib +8741 -0
- sage_wheels/share/singular/LIB/tropicalEllipticCovers.lib +2922 -0
- sage_wheels/share/singular/LIB/tropicalNewton.lib +1128 -0
- sage_wheels/share/singular/LIB/tst.lib +1108 -0
- sage_wheels/share/singular/LIB/weierstr.lib +241 -0
- sage_wheels/share/singular/LIB/zeroset.lib +1478 -0
- sage_wheels/share/singular/emacs/.emacs-general +184 -0
- sage_wheels/share/singular/emacs/.emacs-singular +234 -0
- sage_wheels/share/singular/emacs/COPYING +44 -0
- sage_wheels/share/singular/emacs/cmd-cmpl.el +241 -0
- sage_wheels/share/singular/emacs/ex-cmpl.el +1681 -0
- sage_wheels/share/singular/emacs/hlp-cmpl.el +4318 -0
- sage_wheels/share/singular/emacs/lib-cmpl.el +179 -0
- sage_wheels/share/singular/emacs/singular.el +4273 -0
- sage_wheels/share/singular/emacs/singular.xpm +39 -0
- sage_wheels/share/singular/singular.idx +5002 -0
|
@@ -0,0 +1,1350 @@
|
|
|
1
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
+
version="version general.lib 4.4.0.6 Oct_2024 "; // $Id: 73596842c09856b38919a762dc6d9e4bd7a9a250 $
|
|
3
|
+
category="General purpose";
|
|
4
|
+
info="
|
|
5
|
+
LIBRARY: general.lib Elementary Computations of General Type
|
|
6
|
+
|
|
7
|
+
PROCEDURES:
|
|
8
|
+
A_Z(\"a\",n); string a,b,... of n comma separated letters
|
|
9
|
+
A_Z_L(\"a\",n); list of strings a,b,... of n letters
|
|
10
|
+
ASCII([n,m]); string of printable ASCII characters (number n to m)
|
|
11
|
+
absValue(c); absolute value of c
|
|
12
|
+
binomial(n,m[,../..]); n choose m (type int), [type bigint]
|
|
13
|
+
deleteSublist(iv,l); delete entries given by iv from list l
|
|
14
|
+
factorial(n[,../..]); n factorial (=n!) (type int), [type bigint]
|
|
15
|
+
fibonacci(n); nth Fibonacci number
|
|
16
|
+
kmemory([n[,v]]); active [allocated] memory in kilobyte
|
|
17
|
+
killall(); kill all user-defined variables
|
|
18
|
+
number_e(n); compute exp(1) up to n decimal digits
|
|
19
|
+
number_pi(n); compute pi (area of unit circle) up to n digits
|
|
20
|
+
primes(n,m); intvec of primes p, n<=p<=m
|
|
21
|
+
product(../..[,v]); multiply components of vector/ideal/...[indices v]
|
|
22
|
+
sort(ideal/module); sort generators according to monomial ordering
|
|
23
|
+
sum(vector/id/..[,v]); add components of vector/ideal/...[with indices v]
|
|
24
|
+
watchdog(i,cmd); only wait for result of command cmd for i seconds
|
|
25
|
+
primecoeffs(J[,q]); primefactors <= min(p,32003) of coeffs of J
|
|
26
|
+
timeStd(i,d) std(i) if the standard basis computation finished
|
|
27
|
+
after d-1 seconds and i otherwise
|
|
28
|
+
timeFactorize(p,d) factorize(p) if the factorization finished after d-1
|
|
29
|
+
seconds otherwise f is considered to be irreducible
|
|
30
|
+
factorH(p) changes variables to become the last variable the
|
|
31
|
+
principal one in the multivariate factorization and
|
|
32
|
+
factorizes then the polynomial
|
|
33
|
+
|
|
34
|
+
(parameters in square brackets [] are optional)
|
|
35
|
+
";
|
|
36
|
+
|
|
37
|
+
LIB "inout.lib";
|
|
38
|
+
LIB "polylib.lib";
|
|
39
|
+
LIB "matrix.lib";
|
|
40
|
+
LIB "ring.lib";
|
|
41
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
42
|
+
|
|
43
|
+
proc A_Z (string s,int n)
|
|
44
|
+
"USAGE: A_Z(\"a\",n); a any letter, n integer (-26<= n <=26, !=0)
|
|
45
|
+
RETURN: string of n small (if a is small) or capital (if a is capital)
|
|
46
|
+
letters, comma separated, beginning with a, in alphabetical
|
|
47
|
+
order (or reverse alphabetical order if n<0)
|
|
48
|
+
EXAMPLE: example A_Z; shows an example
|
|
49
|
+
"
|
|
50
|
+
{
|
|
51
|
+
if ( n>=-26 and n<=26 and n!=0 )
|
|
52
|
+
{
|
|
53
|
+
string alpha =
|
|
54
|
+
"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,"+
|
|
55
|
+
"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,"+
|
|
56
|
+
"A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,"+
|
|
57
|
+
"A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
|
|
58
|
+
int ii; int aa;
|
|
59
|
+
for(ii=1; ii<=51; ii=ii+2)
|
|
60
|
+
{
|
|
61
|
+
if( alpha[ii]==s ) { aa=ii; }
|
|
62
|
+
}
|
|
63
|
+
if ( aa==0)
|
|
64
|
+
{
|
|
65
|
+
for(ii=105; ii<=155; ii=ii+2)
|
|
66
|
+
{
|
|
67
|
+
if( alpha[ii]==s ) { aa=ii; }
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if( aa!=0 )
|
|
71
|
+
{
|
|
72
|
+
string out;
|
|
73
|
+
if (n > 0) { out = alpha[aa,2*(n)-1]; return (out); }
|
|
74
|
+
if (n < 0)
|
|
75
|
+
{
|
|
76
|
+
string beta =
|
|
77
|
+
"z,y,x,w,v,u,t,s,r,q,p,o,n,m,l,k,j,i,h,g,f,e,d,c,b,a,"+
|
|
78
|
+
"z,y,x,w,v,u,t,s,r,q,p,o,n,m,l,k,j,i,h,g,f,e,d,c,b,a,"+
|
|
79
|
+
"Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A,"+
|
|
80
|
+
"Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A";
|
|
81
|
+
if ( aa < 52 ) { aa=52-aa; }
|
|
82
|
+
if ( aa > 104 ) { aa=260-aa; }
|
|
83
|
+
out = beta[aa,2*(-n)-1]; return (out);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
example
|
|
89
|
+
{ "EXAMPLE:"; echo = 2;
|
|
90
|
+
A_Z("c",5);
|
|
91
|
+
A_Z("Z",-5);
|
|
92
|
+
ring R = create_ring("(0,"+A_Z("A",6)+")", "("+A_Z("a",10)+")", "dp");
|
|
93
|
+
R;
|
|
94
|
+
}
|
|
95
|
+
proc A_Z_L (string s,int n)
|
|
96
|
+
"USAGE: A_Z_L(\"a\",n); a any letter, n integer (-26<= n <=26, !=0)
|
|
97
|
+
RETURN: list of n small (if a is small) or capital (if a is capital)
|
|
98
|
+
letters, beginning with a, in alphabetical
|
|
99
|
+
order (or reverse alphabetical order if n<0)
|
|
100
|
+
EXAMPLE: example A_Z_L; shows an example
|
|
101
|
+
"
|
|
102
|
+
{
|
|
103
|
+
list l;
|
|
104
|
+
int ii;
|
|
105
|
+
if ( n>=-26 and n<=26 and n!=0 and size(s)==1)
|
|
106
|
+
{
|
|
107
|
+
string alpha =
|
|
108
|
+
"abcdefghijklmnopqrstuvwxyz"+
|
|
109
|
+
"abcdefghijklmnopqrstuvwxyz";
|
|
110
|
+
int aa=find(alpha,s);
|
|
111
|
+
if (aa==0)
|
|
112
|
+
{
|
|
113
|
+
alpha =
|
|
114
|
+
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"+
|
|
115
|
+
"ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
116
|
+
aa=find(alpha,s);
|
|
117
|
+
}
|
|
118
|
+
if (aa>0)
|
|
119
|
+
{
|
|
120
|
+
if (n>0)
|
|
121
|
+
{
|
|
122
|
+
for(ii=aa; ii<aa+n; ii++) { l=l+list(alpha[ii]); }
|
|
123
|
+
return(l);
|
|
124
|
+
}
|
|
125
|
+
else
|
|
126
|
+
{
|
|
127
|
+
aa=aa+26;
|
|
128
|
+
for(ii=aa; ii>aa+n; ii--) { l=l+list(alpha[ii]); }
|
|
129
|
+
return(l);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else
|
|
133
|
+
{ ERROR(s+" sis not a letter");}
|
|
134
|
+
}
|
|
135
|
+
if (n>26) { s=s[1]+"("; }
|
|
136
|
+
if (s[2]=="(")
|
|
137
|
+
{
|
|
138
|
+
for(ii=1;ii<=n;ii++)
|
|
139
|
+
{
|
|
140
|
+
l=l+list(s+string(ii)+")");
|
|
141
|
+
}
|
|
142
|
+
return(l);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
example
|
|
146
|
+
{ "EXAMPLE:"; echo = 2;
|
|
147
|
+
A_Z_L("c",5);
|
|
148
|
+
A_Z_L("Z",-5);
|
|
149
|
+
ring r;
|
|
150
|
+
list L=list(0,A_Z_L("A",6),list(list("dp",1:6),list("C",0)),ideal(0));
|
|
151
|
+
ring R=ring(L);
|
|
152
|
+
R;
|
|
153
|
+
}
|
|
154
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
155
|
+
proc ASCII (list #)
|
|
156
|
+
"USAGE: ASCII([n,m]); n,m= integers (32 <= n <= m <= 126)
|
|
157
|
+
RETURN: string of printable ASCII characters (no native language support)@*
|
|
158
|
+
ASCII(): string of all ASCII characters with its numbers,@*
|
|
159
|
+
ASCII(n): n-th ASCII character@*
|
|
160
|
+
ASCII(n,m): n-th up to m-th ASCII character (inclusive)
|
|
161
|
+
EXAMPLE: example ASCII; shows an example
|
|
162
|
+
"
|
|
163
|
+
{
|
|
164
|
+
string s1 =
|
|
165
|
+
" ! \" # $ % & ' ( ) * + , - .
|
|
166
|
+
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
|
167
|
+
/ 0 1 2 3 4 5 6 7 8 9 : ; < =
|
|
168
|
+
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
|
169
|
+
> ? @ A B C D E F G H I J K L
|
|
170
|
+
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
|
171
|
+
M N O P Q R S T U V W X Y Z [
|
|
172
|
+
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
|
173
|
+
\\ ] ^ _ ` a b c d e f g h i j
|
|
174
|
+
92 93 94 95 96 97 98 99 100 101 102 103 104 105 10
|
|
175
|
+
k l m n o p q r s t u v w x y
|
|
176
|
+
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
|
|
177
|
+
z { | } ~
|
|
178
|
+
122 123 124 125 126 ";
|
|
179
|
+
|
|
180
|
+
string s2 =
|
|
181
|
+
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
|
|
182
|
+
|
|
183
|
+
if ( size(#) == 0 )
|
|
184
|
+
{
|
|
185
|
+
return(s1);
|
|
186
|
+
}
|
|
187
|
+
if ( size(#) == 1 )
|
|
188
|
+
{
|
|
189
|
+
return( s2[#[1]-31] );
|
|
190
|
+
}
|
|
191
|
+
if ( size(#) == 2 )
|
|
192
|
+
{
|
|
193
|
+
return( s2[#[1]-31,#[2]-#[1]+1] );
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
example
|
|
197
|
+
{ "EXAMPLE:"; echo = 2;
|
|
198
|
+
ASCII();"";
|
|
199
|
+
ASCII(42);
|
|
200
|
+
ASCII(32,126);
|
|
201
|
+
}
|
|
202
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
203
|
+
|
|
204
|
+
proc absValue(def c)
|
|
205
|
+
"USAGE: absValue(c); c int, number or poly
|
|
206
|
+
RETURN: absValue(c); the absolute value of c
|
|
207
|
+
NOTE: absValue(c)=c if c>=0; absValue=-c if c<=0.
|
|
208
|
+
@* So the function can be applied to any type, for which comparison
|
|
209
|
+
@* operators are defined.
|
|
210
|
+
EXAMPLE: example absValue; shows an example
|
|
211
|
+
"
|
|
212
|
+
{
|
|
213
|
+
if (c>=0) { return(c); }
|
|
214
|
+
else { return(-c); }
|
|
215
|
+
}
|
|
216
|
+
example
|
|
217
|
+
{ "EXAMPLE:"; echo = 2;
|
|
218
|
+
ring r1 = 0,x,dp;
|
|
219
|
+
absValue(-2002);
|
|
220
|
+
|
|
221
|
+
poly f=-4;
|
|
222
|
+
absValue(f);
|
|
223
|
+
}
|
|
224
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
225
|
+
|
|
226
|
+
proc binomial (int n, int k)
|
|
227
|
+
"USAGE: binomial(n,k); n,k integers
|
|
228
|
+
RETURN: binomial(n,k); binomial coefficient n choose k
|
|
229
|
+
EXAMPLE: example binomial; shows an example
|
|
230
|
+
"
|
|
231
|
+
{
|
|
232
|
+
bigint l;
|
|
233
|
+
bigint r=1;
|
|
234
|
+
bigint kk=k;
|
|
235
|
+
bigint nn=n;
|
|
236
|
+
if ( k > n-k )
|
|
237
|
+
{ k = n-k; }
|
|
238
|
+
if ( k<=0 or k>n ) //trivial cases
|
|
239
|
+
{ r = (k==0)*r; }
|
|
240
|
+
for (l=1; l<=kk; l=l+1 )
|
|
241
|
+
{
|
|
242
|
+
r=r*(nn+1-l)/l;
|
|
243
|
+
}
|
|
244
|
+
return(r);
|
|
245
|
+
}
|
|
246
|
+
example
|
|
247
|
+
{ "EXAMPLE:"; echo = 2;
|
|
248
|
+
binomial(200,100);""; //type bigint
|
|
249
|
+
int n,k = 200,100;
|
|
250
|
+
bigint b1 = binomial(n,k);
|
|
251
|
+
ring r = 0,x,dp;
|
|
252
|
+
poly b2 = coeffs((x+1)^n,x)[k+1,1]; //coefficient of x^k in (x+1)^n
|
|
253
|
+
b1-b2; //b1 and b2 should coincide
|
|
254
|
+
}
|
|
255
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
256
|
+
|
|
257
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
258
|
+
|
|
259
|
+
proc factorial (int n)
|
|
260
|
+
"USAGE: factorial(n); n integer
|
|
261
|
+
RETURN: factorial(n): n! of type bigint.
|
|
262
|
+
SEE ALSO: prime
|
|
263
|
+
EXAMPLE: example factorial; shows an example
|
|
264
|
+
"
|
|
265
|
+
{
|
|
266
|
+
bigint r=1;
|
|
267
|
+
//------------------------------ computation --------------------------------
|
|
268
|
+
for (int l=2; l<=n; l++)
|
|
269
|
+
{
|
|
270
|
+
r=r*l;
|
|
271
|
+
}
|
|
272
|
+
return(r);
|
|
273
|
+
}
|
|
274
|
+
example
|
|
275
|
+
{ "EXAMPLE:"; echo = 2;
|
|
276
|
+
factorial(37);
|
|
277
|
+
}
|
|
278
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
279
|
+
|
|
280
|
+
proc fibonacci (int n)
|
|
281
|
+
"USAGE: fibonacci(n); n,p integers
|
|
282
|
+
RETURN: fibonacci(n): nth Fibonacci number, f(0)=f(1)=1, f(i+1)=f(i-1)+f(i)
|
|
283
|
+
@* - computed in characteristic 0, of type bigint
|
|
284
|
+
SEE ALSO: prime
|
|
285
|
+
EXAMPLE: example fibonacci; shows an example
|
|
286
|
+
"
|
|
287
|
+
{
|
|
288
|
+
bigint f,g,h=1,1,1;
|
|
289
|
+
//------------------------------ computation --------------------------------
|
|
290
|
+
for (int ii=3; ii<=n; ii++)
|
|
291
|
+
{
|
|
292
|
+
h = f+g; f = g; g = h;
|
|
293
|
+
}
|
|
294
|
+
return(h);
|
|
295
|
+
}
|
|
296
|
+
example
|
|
297
|
+
{ "EXAMPLE:"; echo = 2;
|
|
298
|
+
fibonacci(42);
|
|
299
|
+
}
|
|
300
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
301
|
+
|
|
302
|
+
proc kmemory (list #)
|
|
303
|
+
"USAGE: kmemory([n,[v]]); n,v integers
|
|
304
|
+
RETURN: memory in kilobyte of type bigint
|
|
305
|
+
@* n=0: memory used by active variables (same as no parameters)
|
|
306
|
+
@* n=1: total memory allocated by Singular
|
|
307
|
+
DISPLAY: detailed information about allocated and used memory if v!=0
|
|
308
|
+
NOTE: kmemory uses internal function 'memory' to compute kilobyte, and
|
|
309
|
+
is the same as 'memory' for n!=0,1,2
|
|
310
|
+
EXAMPLE: example kmemory; shows an example
|
|
311
|
+
"
|
|
312
|
+
{
|
|
313
|
+
int n;
|
|
314
|
+
int verb;
|
|
315
|
+
if (size(#) != 0)
|
|
316
|
+
{
|
|
317
|
+
n=#[1];
|
|
318
|
+
if (size(#) >1)
|
|
319
|
+
{ verb=#[2]; }
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
if ( verb != 0)
|
|
323
|
+
{
|
|
324
|
+
if ( n==0)
|
|
325
|
+
{ dbprint(printlevel-voice+3,
|
|
326
|
+
"// memory used, at the moment, by active variables (kilobyte):"); }
|
|
327
|
+
if ( n==1 )
|
|
328
|
+
{ dbprint(printlevel-voice+3,
|
|
329
|
+
"// total memory allocated, at the moment, by SINGULAR (kilobyte):"); }
|
|
330
|
+
}
|
|
331
|
+
return ((memory(n)+1023) div 1024);
|
|
332
|
+
}
|
|
333
|
+
example
|
|
334
|
+
{ "EXAMPLE:"; echo = 2;
|
|
335
|
+
kmemory();
|
|
336
|
+
kmemory(1,1);
|
|
337
|
+
}
|
|
338
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
339
|
+
|
|
340
|
+
proc killall
|
|
341
|
+
"USAGE: killall(); (no parameter)
|
|
342
|
+
killall(\"type_name\");
|
|
343
|
+
killall(\"not\", \"type_name\");
|
|
344
|
+
RETURN: killall(); kills all user-defined variables except loaded procedures,
|
|
345
|
+
no return value.
|
|
346
|
+
@* - killall(\"type_name\"); kills all user-defined variables,
|
|
347
|
+
of type \"type_name\"
|
|
348
|
+
@* - killall(\"not\", \"type_name\"); kills all user-defined variables,
|
|
349
|
+
except those of type \"type_name\" and except loaded procedures
|
|
350
|
+
@* - killall(\"not\", \"name_1\", \"name_2\", ...);
|
|
351
|
+
kills all user-defined variables, except those of name \"name_i\"
|
|
352
|
+
and except loaded procedures
|
|
353
|
+
NOTE: killall should never be used inside a procedure
|
|
354
|
+
EXAMPLE: example killall; shows an example AND KILLS ALL YOUR VARIABLES
|
|
355
|
+
"
|
|
356
|
+
{
|
|
357
|
+
list @marie=names(Top);
|
|
358
|
+
int j, no_kill, @joni;
|
|
359
|
+
for ( @joni=1; @joni<=size(#); @joni++)
|
|
360
|
+
{
|
|
361
|
+
if (typeof(#[@joni]) != "string")
|
|
362
|
+
{
|
|
363
|
+
ERROR("Need string as " + string(@joni) + "th argument");
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// kills all user-defined variables but not loaded procedures
|
|
368
|
+
if( size(#)==0 )
|
|
369
|
+
{
|
|
370
|
+
for ( @joni=size(@marie); @joni>0; @joni-- )
|
|
371
|
+
{
|
|
372
|
+
if( typeof(`@marie[@joni]`)!="proc"
|
|
373
|
+
and typeof(`@marie[@joni]`)!="package"
|
|
374
|
+
and typeof(`@marie[@joni]`)!="cring")
|
|
375
|
+
{ kill `@marie[@joni]`; }
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
else
|
|
379
|
+
{
|
|
380
|
+
// kills all user-defined variables
|
|
381
|
+
if( size(#)==1 )
|
|
382
|
+
{
|
|
383
|
+
// of type proc
|
|
384
|
+
if( #[1] == "proc" )
|
|
385
|
+
{
|
|
386
|
+
for ( @joni=size(@marie); @joni>0; @joni-- )
|
|
387
|
+
{
|
|
388
|
+
if( (@marie[@joni]!="General")
|
|
389
|
+
and (@marie[@joni]!="Top")
|
|
390
|
+
and (@marie[@joni]!="killall")
|
|
391
|
+
and (@marie[@joni]!="LIB") and
|
|
392
|
+
((typeof(`@marie[@joni]`)=="package") or
|
|
393
|
+
(typeof(`@marie[@joni]`)=="proc")))
|
|
394
|
+
{
|
|
395
|
+
if (defined(`@marie[@joni]`)) {kill `@marie[@joni]`;}
|
|
396
|
+
}
|
|
397
|
+
if (!defined(@joni)) break;
|
|
398
|
+
}
|
|
399
|
+
if (defined(General))
|
|
400
|
+
{
|
|
401
|
+
@marie=names(General);
|
|
402
|
+
for ( @joni=size(@marie); @joni>0; @joni-- )
|
|
403
|
+
{
|
|
404
|
+
if(@marie[@joni]!="killall"
|
|
405
|
+
and typeof(`@marie[@joni]`)=="proc")
|
|
406
|
+
{ kill General::`@marie[@joni]`; }
|
|
407
|
+
}
|
|
408
|
+
kill General::killall;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
else
|
|
412
|
+
{
|
|
413
|
+
// other types
|
|
414
|
+
for ( @joni=size(@marie); @joni>2; @joni-- )
|
|
415
|
+
{
|
|
416
|
+
if(typeof(`@marie[@joni]`)==#[1] and @marie[@joni]!="LIB"
|
|
417
|
+
and typeof(`@marie[@joni]`)!="proc"
|
|
418
|
+
and typeof(`@marie[@joni]`)!="cring")
|
|
419
|
+
{ kill `@marie[@joni]`; }
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
else
|
|
424
|
+
{
|
|
425
|
+
// kills all user-defined variables whose name or type is not #i
|
|
426
|
+
for ( @joni=size(@marie); @joni>2; @joni-- )
|
|
427
|
+
{
|
|
428
|
+
if ( @marie[@joni] != "LIB" && @marie[@joni] != "Top"
|
|
429
|
+
&& typeof(`@marie[@joni]`) != "proc"
|
|
430
|
+
&& typeof(`@marie[@joni]`) != "cring")
|
|
431
|
+
{
|
|
432
|
+
no_kill = 0;
|
|
433
|
+
for (j=2; j<= size(#); j++)
|
|
434
|
+
{
|
|
435
|
+
if (typeof(`@marie[@joni]`)==#[j] or @marie[@joni] == #[j])
|
|
436
|
+
{
|
|
437
|
+
no_kill = 1;
|
|
438
|
+
break;
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if (! no_kill)
|
|
442
|
+
{
|
|
443
|
+
kill `@marie[@joni]`;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
if (!defined(@joni)) break;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
example
|
|
452
|
+
{ "EXAMPLE:"; echo = 2;
|
|
453
|
+
ring rtest; ideal i=x,y,z; string str="hi"; int j = 3;
|
|
454
|
+
export rtest,i,str,j; //this makes the local variables global
|
|
455
|
+
listvar();
|
|
456
|
+
killall("ring"); // kills all rings
|
|
457
|
+
listvar();
|
|
458
|
+
killall("not", "int"); // kills all variables except int's (and procs)
|
|
459
|
+
listvar();
|
|
460
|
+
killall(); // kills all vars except loaded procs
|
|
461
|
+
listvar();
|
|
462
|
+
}
|
|
463
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
464
|
+
|
|
465
|
+
proc number_e (int n)
|
|
466
|
+
"USAGE: number_e(n); n integer
|
|
467
|
+
RETURN: Euler number e=exp(1) up to n decimal digits (no rounding)
|
|
468
|
+
@* - of type string if no basering of char 0 is defined
|
|
469
|
+
@* - of type number if a basering of char 0 is defined
|
|
470
|
+
DISPLAY: decimal format of e if printlevel > 0 (default:printlevel=0 )
|
|
471
|
+
NOTE: procedure uses algorithm of A.H.J. Sale
|
|
472
|
+
EXAMPLE: example number_e; shows an example
|
|
473
|
+
"
|
|
474
|
+
{
|
|
475
|
+
int i,m,s,t;
|
|
476
|
+
intvec u,e;
|
|
477
|
+
u[n+2]=0; e[n+1]=0; e=e+1;
|
|
478
|
+
if( defined(basering) )
|
|
479
|
+
{
|
|
480
|
+
if( char(basering)==0 ) { number r=2; t=1; }
|
|
481
|
+
}
|
|
482
|
+
string result = "2.";
|
|
483
|
+
for( i=1; i<=n+1; i=i+1 )
|
|
484
|
+
{
|
|
485
|
+
e = e*10;
|
|
486
|
+
for( m=n+1; m>=1; m=m-1 )
|
|
487
|
+
{
|
|
488
|
+
s = e[m]+u[m+1];
|
|
489
|
+
u[m] = s div (m+1);
|
|
490
|
+
e[m] = s%(m+1);
|
|
491
|
+
}
|
|
492
|
+
result = result+string(u[1]);
|
|
493
|
+
if( t==1 ) { r = r+number(u[1])/number(10)^i; }
|
|
494
|
+
}
|
|
495
|
+
if( t==1 )
|
|
496
|
+
{ dbprint(printlevel-voice+2,"// "+result[1,n+1]);
|
|
497
|
+
return(r);
|
|
498
|
+
}
|
|
499
|
+
return(result[1,n+1]);
|
|
500
|
+
}
|
|
501
|
+
example
|
|
502
|
+
{ "EXAMPLE:"; echo = 2;
|
|
503
|
+
number_e(30);"";
|
|
504
|
+
ring R = 0,t,lp;
|
|
505
|
+
number e = number_e(30);
|
|
506
|
+
e;
|
|
507
|
+
}
|
|
508
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
509
|
+
|
|
510
|
+
proc number_pi (int n)
|
|
511
|
+
"USAGE: number_pi(n); n positive integer
|
|
512
|
+
RETURN: pi (area of unit circle) up to n decimal digits (no rounding)
|
|
513
|
+
@* - of type string if no basering of char 0 is defined,
|
|
514
|
+
@* - of type number, if a basering of char 0 is defined
|
|
515
|
+
DISPLAY: decimal format of pi if printlevel > 0 (default:printlevel=0 )
|
|
516
|
+
NOTE: procedure uses algorithm of S. Rabinowitz
|
|
517
|
+
EXAMPLE: example number_pi; shows an example
|
|
518
|
+
"
|
|
519
|
+
{
|
|
520
|
+
int i,m,t,e,q,N;
|
|
521
|
+
intvec r,p,B,Prelim;
|
|
522
|
+
string result,prelim;
|
|
523
|
+
N = (10*n) div 3 + 2;
|
|
524
|
+
p[N+1]=0; p=p+2; r=p;
|
|
525
|
+
for( i=1; i<=N+1; i=i+1 ) { B[i]=2*i-1; }
|
|
526
|
+
if( defined(basering) )
|
|
527
|
+
{
|
|
528
|
+
if( char(basering)==0 ) { number pi; number pri; t=1; }
|
|
529
|
+
}
|
|
530
|
+
for( i=0; i<=n; i=i+1 )
|
|
531
|
+
{
|
|
532
|
+
p = r*10;
|
|
533
|
+
e = p[N+1];
|
|
534
|
+
for( m=N+1; m>=2; m=m-1 )
|
|
535
|
+
{
|
|
536
|
+
r[m] = e%B[m];
|
|
537
|
+
q = e div B[m];
|
|
538
|
+
e = q*(m-1)+p[m-1];
|
|
539
|
+
}
|
|
540
|
+
r[1] = e%10;
|
|
541
|
+
q = e div 10;
|
|
542
|
+
if( q!=10 and q!=9 )
|
|
543
|
+
{
|
|
544
|
+
result = result+prelim;
|
|
545
|
+
Prelim = q;
|
|
546
|
+
prelim = string(q);
|
|
547
|
+
}
|
|
548
|
+
if( q==9 )
|
|
549
|
+
{
|
|
550
|
+
Prelim = Prelim,9;
|
|
551
|
+
prelim = prelim+"9";
|
|
552
|
+
}
|
|
553
|
+
if( q==10 )
|
|
554
|
+
{
|
|
555
|
+
Prelim = (Prelim+1)-((Prelim+1) div 10)*10;
|
|
556
|
+
for( m=size(Prelim); m>0; m=m-1)
|
|
557
|
+
{
|
|
558
|
+
prelim[m] = string(Prelim[m]);
|
|
559
|
+
}
|
|
560
|
+
result = result+prelim;
|
|
561
|
+
if( t==1 ) { pi=pi+pri; }
|
|
562
|
+
Prelim = 0;
|
|
563
|
+
prelim = "0";
|
|
564
|
+
}
|
|
565
|
+
if( t==1 ) { pi=pi+number(q)/number(10)^i; }
|
|
566
|
+
}
|
|
567
|
+
result = result,prelim[1];
|
|
568
|
+
result = "3."+result[2,n-1];
|
|
569
|
+
if( t==1 )
|
|
570
|
+
{ dbprint(printlevel-voice+2,"// "+result);
|
|
571
|
+
return(pi);
|
|
572
|
+
}
|
|
573
|
+
return(result);
|
|
574
|
+
}
|
|
575
|
+
example
|
|
576
|
+
{ "EXAMPLE:"; echo = 2;
|
|
577
|
+
number_pi(11);"";
|
|
578
|
+
ring r = (real,10),t,dp;
|
|
579
|
+
number pi = number_pi(11); pi;
|
|
580
|
+
}
|
|
581
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
582
|
+
|
|
583
|
+
proc primes (int n, int m)
|
|
584
|
+
"USAGE: primes(n,m); n,m integers
|
|
585
|
+
RETURN: intvec, consisting of all primes p, prime(n)<=p<=m, in increasing
|
|
586
|
+
order if n<=m, resp. prime(m)<=p<=n, in decreasing order if m<n.
|
|
587
|
+
NOTE: prime(n); returns the biggest prime number <= min(n,32003)
|
|
588
|
+
if n>=2, else 2
|
|
589
|
+
EXAMPLE: example primes; shows an example
|
|
590
|
+
"
|
|
591
|
+
{ int change;
|
|
592
|
+
if ( n>m ) { change=n; n=m ; m=change; change=1; }
|
|
593
|
+
int q,p = prime(m),prime(n); intvec v = q; q = q-1;
|
|
594
|
+
while ( q>=p ) { q = prime(q); v = q,v; q = q-1; }
|
|
595
|
+
if ( change==1 ) { v = v[size(v)..1]; }
|
|
596
|
+
return(v);
|
|
597
|
+
}
|
|
598
|
+
example
|
|
599
|
+
{ "EXAMPLE:"; echo = 2;
|
|
600
|
+
primes(50,100);"";
|
|
601
|
+
intvec v = primes(37,1); v;
|
|
602
|
+
}
|
|
603
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
604
|
+
|
|
605
|
+
proc product (def id, list #)
|
|
606
|
+
"USAGE: product(id[,v]); id ideal/vector/module/matrix/intvec/intmat/list,
|
|
607
|
+
v intvec (default: v=1..number of entries of id)
|
|
608
|
+
ASSUME: list members can be multiplied.
|
|
609
|
+
RETURN: The product of all entries of id [with index given by v] of type
|
|
610
|
+
depending on the entries of id.
|
|
611
|
+
NOTE: If id is not a list, id is treated as a list of polys resp. integers.
|
|
612
|
+
A module m is identified with the corresponding matrix M (columns
|
|
613
|
+
of M generate m).
|
|
614
|
+
@* If v is outside the range of id, we have the empty product and the
|
|
615
|
+
result will be 1 (of type int).
|
|
616
|
+
EXAMPLE: example product; shows an example
|
|
617
|
+
"
|
|
618
|
+
{
|
|
619
|
+
//-------------------- initialization and special feature ---------------------
|
|
620
|
+
int n,j,tt;
|
|
621
|
+
string ty; //will become type of id
|
|
622
|
+
list l;
|
|
623
|
+
|
|
624
|
+
// We wish to allow something like product(x(1..10)) if x(1),...,x(10) are
|
|
625
|
+
// variables. x(1..10) is a list of polys and enters the procedure with
|
|
626
|
+
// id=x(1) and # a list with 9 polys, #[1]= x(2),...,#[9]= x(10). Hence, in
|
|
627
|
+
// this case # is never empty. If an additional intvec v is given,
|
|
628
|
+
// it is added to #, so we have to separate it first and make
|
|
629
|
+
// the rest a list which has to be multiplied.
|
|
630
|
+
|
|
631
|
+
int s = size(#);
|
|
632
|
+
if( s!=0 )
|
|
633
|
+
{ if ( typeof(#[s])=="intvec" or typeof(#[s])=="int")
|
|
634
|
+
{
|
|
635
|
+
intvec v = #[s];
|
|
636
|
+
tt=1;
|
|
637
|
+
s=s-1;
|
|
638
|
+
if ( s>0 ) { # = #[1..s]; }
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
if ( s>0 )
|
|
642
|
+
{
|
|
643
|
+
l = list(id)+#;
|
|
644
|
+
kill id;
|
|
645
|
+
list id = l; //case: id = list
|
|
646
|
+
ty = "list";
|
|
647
|
+
n = size(id);
|
|
648
|
+
}
|
|
649
|
+
else
|
|
650
|
+
{
|
|
651
|
+
ty = typeof(id);
|
|
652
|
+
if( ty == "list" )
|
|
653
|
+
{ n = size(id); }
|
|
654
|
+
}
|
|
655
|
+
//------------------------------ reduce to 3 cases ---------------------------
|
|
656
|
+
if( ty=="poly" or ty=="ideal" or ty=="vector"
|
|
657
|
+
or ty=="module" or ty=="matrix" )
|
|
658
|
+
{
|
|
659
|
+
ideal i = ideal(matrix(id));
|
|
660
|
+
kill id;
|
|
661
|
+
ideal id = i; //case: id = ideal
|
|
662
|
+
n = ncols(id);
|
|
663
|
+
}
|
|
664
|
+
if( ty=="int" or ty=="intvec" or ty=="intmat" )
|
|
665
|
+
{
|
|
666
|
+
if ( ty == "int" ) { intmat S =id; }
|
|
667
|
+
else { intmat S = intmat(id); }
|
|
668
|
+
intvec i = S[1..nrows(S),1..ncols(S)];
|
|
669
|
+
kill id;
|
|
670
|
+
intvec id = i; //case: id = intvec
|
|
671
|
+
n = size(id);
|
|
672
|
+
}
|
|
673
|
+
//--------------- consider intvec v and empty product -----------------------
|
|
674
|
+
if( tt!=0 )
|
|
675
|
+
{
|
|
676
|
+
for (j=1; j<=size(v); j++)
|
|
677
|
+
{
|
|
678
|
+
if ( v[j] <= 0 or v[j] > n ) //v outside range of id
|
|
679
|
+
{
|
|
680
|
+
return(1); //empty product is 1
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
id = id[v]; //consider part of id
|
|
684
|
+
} //corresponding to v
|
|
685
|
+
//--------------------- special case: one factor is zero ---------------------
|
|
686
|
+
if ( typeof(id) == "ideal")
|
|
687
|
+
{
|
|
688
|
+
if( size(id) < ncols(id) )
|
|
689
|
+
{
|
|
690
|
+
poly f; return(f);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
//-------------------------- finally, multiply objects -----------------------
|
|
694
|
+
n = size(id);
|
|
695
|
+
def f(1) = id[1];
|
|
696
|
+
for( j=2; j<=n; j=j+1 ) { def f(j)=f(j-1)*id[j]; }
|
|
697
|
+
return(f(n));
|
|
698
|
+
}
|
|
699
|
+
example
|
|
700
|
+
{ "EXAMPLE:"; echo = 2;
|
|
701
|
+
ring r= 0,(x,y,z),dp;
|
|
702
|
+
ideal m = maxideal(1);
|
|
703
|
+
product(m);
|
|
704
|
+
product(m[2..3]);
|
|
705
|
+
matrix M[2][3] = 1,x,2,y,3,z;
|
|
706
|
+
product(M);
|
|
707
|
+
intvec v=2,4,6;
|
|
708
|
+
product(M,v);
|
|
709
|
+
intvec iv = 1,2,3,4,5,6,7,8,9;
|
|
710
|
+
v=1..5,7,9;
|
|
711
|
+
product(iv,v);
|
|
712
|
+
intmat A[2][3] = 1,1,1,2,2,2;
|
|
713
|
+
product(A,3..5);
|
|
714
|
+
}
|
|
715
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
716
|
+
|
|
717
|
+
proc sort (def id, list #)
|
|
718
|
+
"USAGE: sort(id[,v,o,n]); id = ideal/module/intvec/list
|
|
719
|
+
@* sort may be called with 1, 2 or 3 arguments in the following way:
|
|
720
|
+
@* sort(id[,v,n]); v=intvec of positive integers, n=integer,
|
|
721
|
+
@* sort(id[,o,n]); o=string (any allowed ordstr of a ring), n=integer
|
|
722
|
+
RETURN: a list l of two elements:
|
|
723
|
+
@format
|
|
724
|
+
l[1]: object of same type as input but sorted in the following way:
|
|
725
|
+
- if id=ideal/module: generators of id are sorted w.r.t. intvec v
|
|
726
|
+
(id[v[1]] becomes 1-st, id[v[2]] 2-nd element, etc.). If no v is
|
|
727
|
+
present, id is sorted w.r.t. ordering o (if o is given) or w.r.t.
|
|
728
|
+
actual monomial ordering (if no o is given):
|
|
729
|
+
NOTE: generators with SMALLER(!) leading term come FIRST
|
|
730
|
+
(e.g. sort(id); sorts backwards to actual monomial ordering)
|
|
731
|
+
- if id=list or intvec: sorted w.r.t. < (indep. of other arguments)
|
|
732
|
+
- if n!=0 the ordering is inverse, i.e. w.r.t. v(size(v)..1)
|
|
733
|
+
default: n=0
|
|
734
|
+
l[2]: intvec, describing the permutation of the input (hence l[2]=v
|
|
735
|
+
if v is given (with positive integers))
|
|
736
|
+
@end format
|
|
737
|
+
NOTE: If v is given id may be any simply indexed object (e.g. any list or
|
|
738
|
+
string); if v[i]<0 and i<=size(id) v[i] is set internally to i;
|
|
739
|
+
entries of v must be pairwise distinct to get a permutation id.
|
|
740
|
+
Zero generators of ideal/module are deleted
|
|
741
|
+
If 'o' is given, the input is sorted by considering leading terms
|
|
742
|
+
w.r.t. the new ring ordering given by 'o'
|
|
743
|
+
EXAMPLE: example sort; shows an example
|
|
744
|
+
"
|
|
745
|
+
{ int ii,jj,s,n = 0,0,1,0;
|
|
746
|
+
string id_typ=typeof(id);
|
|
747
|
+
if ((id_typ!="ideal")
|
|
748
|
+
and (id_typ!="module")
|
|
749
|
+
and (id_typ!="matrix")
|
|
750
|
+
and (id_typ!="list")
|
|
751
|
+
and (id_typ!="intvec")) { return (id,0); }
|
|
752
|
+
intvec v;
|
|
753
|
+
if ( defined(basering) ) { def P = basering; }
|
|
754
|
+
if ( size(#)==0 and (typeof(id)=="ideal" or typeof(id)=="module"
|
|
755
|
+
or typeof(id)=="matrix"))
|
|
756
|
+
{
|
|
757
|
+
id = simplify(id,2);
|
|
758
|
+
for ( ii=1; ii<ncols(id); ii++ )
|
|
759
|
+
{
|
|
760
|
+
if ( id[ii]!=id[ii+1] ) { break;}
|
|
761
|
+
}
|
|
762
|
+
if ( ii != ncols(id) ) { v = sortvec(id); }
|
|
763
|
+
else { v = ncols(id)..1; }
|
|
764
|
+
}
|
|
765
|
+
if ( size(#)>=1 and (typeof(id)=="ideal" or typeof(id)=="module"
|
|
766
|
+
or typeof(id)=="matrix") )
|
|
767
|
+
{
|
|
768
|
+
if ( typeof(#[1])=="string" )
|
|
769
|
+
{
|
|
770
|
+
ring r1 = create_ring(ring_list(P)[1],"("+varstr(P)+")","("+#[1]+")","no_minpoly");
|
|
771
|
+
def i = imap(P,id);
|
|
772
|
+
v = sortvec(i);
|
|
773
|
+
setring P;
|
|
774
|
+
n=2;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
if ( typeof(id)=="intvec" or typeof(id)=="list" )
|
|
778
|
+
{
|
|
779
|
+
int Bn,Bi,Bj,Bb;
|
|
780
|
+
intvec pivot;
|
|
781
|
+
for(Bi=size(id);Bi>0;Bi--) { pivot[Bi]=Bi; }
|
|
782
|
+
while(Bj==0)
|
|
783
|
+
{
|
|
784
|
+
Bi++;
|
|
785
|
+
Bj=1;
|
|
786
|
+
for(Bn=1;Bn<=size(id)-Bi;Bn++)
|
|
787
|
+
{
|
|
788
|
+
if(id[pivot[Bn]]>id[pivot[Bn+1]])
|
|
789
|
+
{
|
|
790
|
+
Bb=pivot[Bn];
|
|
791
|
+
pivot[Bn]=pivot[Bn+1];
|
|
792
|
+
pivot[Bn+1]=Bb;
|
|
793
|
+
Bj=0;
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
def Br=id;
|
|
798
|
+
for(Bi=size(id);Bi>0;Bi--) { Br[Bi]=id[pivot[Bi]]; }
|
|
799
|
+
return(list(Br,pivot));
|
|
800
|
+
}
|
|
801
|
+
if ( size(#)!=0 and n==0 ) { v = #[1]; }
|
|
802
|
+
if( size(#)==2 )
|
|
803
|
+
{
|
|
804
|
+
if ( #[2] != 0 ) { v = v[size(v)..1]; }
|
|
805
|
+
}
|
|
806
|
+
s = size(v);
|
|
807
|
+
if( size(id) < s ) { s = size(id); }
|
|
808
|
+
def m = id;
|
|
809
|
+
if ( size(m) != 0 )
|
|
810
|
+
{
|
|
811
|
+
for ( jj=1; jj<=s; jj++)
|
|
812
|
+
{
|
|
813
|
+
if ( v[jj]<=0 ) { v[jj]=jj; }
|
|
814
|
+
m[jj] = id[v[jj]];
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
if ( v == 0 ) { v = 1; }
|
|
818
|
+
list L=m,v;
|
|
819
|
+
return(L);
|
|
820
|
+
}
|
|
821
|
+
example
|
|
822
|
+
{ "EXAMPLE:"; echo = 2;
|
|
823
|
+
ring r0 = 0,(x,y,z,t),lp;
|
|
824
|
+
ideal i = x3,z3,xyz;
|
|
825
|
+
sort(i); //sorts using lex ordering, smaller polys come first
|
|
826
|
+
|
|
827
|
+
sort(i,3..1);
|
|
828
|
+
|
|
829
|
+
sort(i,"ls")[1]; //sort w.r.t. negative lex ordering
|
|
830
|
+
|
|
831
|
+
intvec v =1,10..5,2..4;v;
|
|
832
|
+
sort(v)[1]; // sort v lexicographically
|
|
833
|
+
|
|
834
|
+
sort(v,"Dp",1)[1]; // sort v w.r.t (total sum, reverse lex)
|
|
835
|
+
|
|
836
|
+
// Note that in general: lead(sort(M)) != sort(lead(M)), e.g:
|
|
837
|
+
module M = [0, 1, 1, 0], [1, 0, 0, 1]; M;
|
|
838
|
+
sort(lead(M), "c, dp")[1];
|
|
839
|
+
lead(sort(M, "c, dp")[1]);
|
|
840
|
+
|
|
841
|
+
// In order to sort M wrt a NEW ordering by considering OLD leading
|
|
842
|
+
// terms use one of the following equivalent commands:
|
|
843
|
+
module( M[ sort(lead(M), "c,dp")[2] ] );
|
|
844
|
+
sort( M, sort(lead(M), "c,dp")[2] )[1];
|
|
845
|
+
|
|
846
|
+
// BUG: Please, don't use this sort for integer vectors or lists
|
|
847
|
+
// with them if there can be negative integers!
|
|
848
|
+
// TODO: for some HiWi
|
|
849
|
+
sort(3..-3)[1];
|
|
850
|
+
sort(list(-v, v))[1];
|
|
851
|
+
|
|
852
|
+
}
|
|
853
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
854
|
+
|
|
855
|
+
static proc lsum (int n, list l)
|
|
856
|
+
{ if (n>10)
|
|
857
|
+
{ return( lsum(n div 2,list(l[1..(n div 2)])) + lsum(n-n div 2, list(l[(n div 2+1)..n])) );
|
|
858
|
+
}
|
|
859
|
+
else
|
|
860
|
+
{ def Summe=l[1];
|
|
861
|
+
for (int i=2;i<=n;i++)
|
|
862
|
+
{ Summe=Summe+l[i];
|
|
863
|
+
}
|
|
864
|
+
return(Summe);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
869
|
+
|
|
870
|
+
proc sum (def id, list #)
|
|
871
|
+
"USAGE: sum(id[,v]); id ideal/vector/module/matrix/intvec/intmat/list,
|
|
872
|
+
v intvec (default: v=1..number of entries of id)
|
|
873
|
+
ASSUME: list members can be added.
|
|
874
|
+
RETURN: The sum of all entries of id [with index given by v] of type
|
|
875
|
+
depending on the entries of id.
|
|
876
|
+
NOTE: If id is not a list, id is treated as a list of polys resp. integers.
|
|
877
|
+
A module m is identified with the corresponding matrix M (columns
|
|
878
|
+
of M generate m).
|
|
879
|
+
@* If v is outside the range of id, we have the empty sum and the
|
|
880
|
+
result will be 0 (of type int).
|
|
881
|
+
EXAMPLE: example sum; shows an example
|
|
882
|
+
"
|
|
883
|
+
{
|
|
884
|
+
//-------------------- initialization and special feature ---------------------
|
|
885
|
+
int n,j,tt;
|
|
886
|
+
string ty; // will become type of id
|
|
887
|
+
list l;
|
|
888
|
+
|
|
889
|
+
// We wish to allow something like sum(x(1..10)) if x(1),...,x(10) are
|
|
890
|
+
// variables. x(1..10) is a list of polys and enters the procedure with
|
|
891
|
+
// id=x(1) and # a list with 9 polys, #[1]= x(2),...,#[9]= x(10). Hence, in
|
|
892
|
+
// this case # is never empty. If an additional intvec v is given,
|
|
893
|
+
// it is added to #, so we have to separate it first and make
|
|
894
|
+
// the rest a list which has to be added.
|
|
895
|
+
|
|
896
|
+
int s = size(#);
|
|
897
|
+
if( s!=0 )
|
|
898
|
+
{ if ( typeof(#[s])=="intvec" or typeof(#[s])=="int")
|
|
899
|
+
{ intvec v = #[s];
|
|
900
|
+
tt=1;
|
|
901
|
+
s=s-1;
|
|
902
|
+
if ( s>0 ) { # = #[1..s]; }
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
if ( s>0 )
|
|
906
|
+
{
|
|
907
|
+
l = list(id)+#;
|
|
908
|
+
kill id;
|
|
909
|
+
list id = l; //case: id = list
|
|
910
|
+
ty = "list";
|
|
911
|
+
}
|
|
912
|
+
else
|
|
913
|
+
{
|
|
914
|
+
ty = typeof(id);
|
|
915
|
+
}
|
|
916
|
+
//------------------------------ reduce to 3 cases ---------------------------
|
|
917
|
+
if( ty=="poly" or ty=="ideal" or ty=="vector"
|
|
918
|
+
or ty=="module" or ty=="matrix" )
|
|
919
|
+
{ //case: id = ideal
|
|
920
|
+
ideal i = ideal(matrix(id));
|
|
921
|
+
kill id;
|
|
922
|
+
ideal id = simplify(i,2); //delete 0 entries
|
|
923
|
+
if (ty=="module") {vector Summe;}
|
|
924
|
+
else {poly Summe;}
|
|
925
|
+
}
|
|
926
|
+
if( ty=="int" or ty=="intvec" or ty=="intmat" )
|
|
927
|
+
{ //case: id = intvec
|
|
928
|
+
if ( ty == "int" ) { intmat S =id; }
|
|
929
|
+
else { intmat S = intmat(id); }
|
|
930
|
+
intvec i = S[1..nrows(S),1..ncols(S)];
|
|
931
|
+
kill id;
|
|
932
|
+
intvec id = i;
|
|
933
|
+
int Summe;
|
|
934
|
+
}
|
|
935
|
+
if(ty=="number") {number Summe;}
|
|
936
|
+
//------------------- consider intvec v and empty sum -----------------------
|
|
937
|
+
if( tt!=0 )
|
|
938
|
+
{
|
|
939
|
+
for (j=1; j<=size(v); j++)
|
|
940
|
+
{
|
|
941
|
+
if ( v[j] <= 0 or v[j] > size(id) ) //v outside range of id
|
|
942
|
+
{
|
|
943
|
+
return(0); //empty sum is 0
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
id = id[v]; //consider part of id
|
|
947
|
+
} //corresponding to v
|
|
948
|
+
|
|
949
|
+
//-------------------------- finally, add objects ---------------------------
|
|
950
|
+
n = size(id);
|
|
951
|
+
if (n>10)
|
|
952
|
+
{ return( lsum(n div 2,list(id[1..(n div 2)])) + lsum(n-n div 2, list(id[(n div 2+1)..n])) );
|
|
953
|
+
}
|
|
954
|
+
else
|
|
955
|
+
{
|
|
956
|
+
if(!defined(Summe))
|
|
957
|
+
{ if(n>0) {def Summe=id[1];Summe=0;}
|
|
958
|
+
else {return(0);}
|
|
959
|
+
}
|
|
960
|
+
for (int lauf=1;lauf<=n;lauf++)
|
|
961
|
+
{ Summe=Summe+id[lauf];
|
|
962
|
+
}
|
|
963
|
+
return(Summe);
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
example
|
|
967
|
+
{ "EXAMPLE:"; echo = 2;
|
|
968
|
+
ring r1 = 0,(x,y,z),dp;
|
|
969
|
+
vector pv = [xy,xz,yz,x2,y2,z2];
|
|
970
|
+
sum(pv);
|
|
971
|
+
sum(pv,2..5);
|
|
972
|
+
matrix M[2][3] = 1,x,2,y,3,z;
|
|
973
|
+
intvec w=2,4,6;
|
|
974
|
+
sum(M,w);
|
|
975
|
+
intvec iv = 1,2,3,4,5,6,7,8,9;
|
|
976
|
+
sum(iv,2..4);
|
|
977
|
+
iv = intvec(1..100);
|
|
978
|
+
sum(iv);
|
|
979
|
+
ring r2 = 0,(x(1..10)),dp;
|
|
980
|
+
sum(x(3..7),intvec(1,3,5));
|
|
981
|
+
}
|
|
982
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
983
|
+
|
|
984
|
+
|
|
985
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
986
|
+
|
|
987
|
+
proc watchdog(int i, string cmd)
|
|
988
|
+
"USAGE: watchdog(i,cmd); i integer, cmd string
|
|
989
|
+
RETURN: Result of cmd, if the result can be computed in i seconds.
|
|
990
|
+
Otherwise the computation is interrupted after i seconds,
|
|
991
|
+
the string "Killed" is returned and the global variable
|
|
992
|
+
'watchdog_interrupt' is defined.
|
|
993
|
+
NOTE: * the current basering should not be watchdog_rneu, since
|
|
994
|
+
watchdog_rneu will be killed
|
|
995
|
+
* if there are variable names of the structure x(i) all
|
|
996
|
+
polynomials have to be put into eval(...) in order to be
|
|
997
|
+
interpreted correctly
|
|
998
|
+
* a second Singular process is started by this procedure
|
|
999
|
+
EXAMPLE: example watchdog; shows an example
|
|
1000
|
+
"
|
|
1001
|
+
{
|
|
1002
|
+
if (defined(basering))
|
|
1003
|
+
{
|
|
1004
|
+
string rname=nameof(basering);
|
|
1005
|
+
def rsave=basering;
|
|
1006
|
+
}
|
|
1007
|
+
if (defined(watchdog_rneu))
|
|
1008
|
+
{
|
|
1009
|
+
kill watchdog_rneu;
|
|
1010
|
+
}
|
|
1011
|
+
if ( i > 0 )
|
|
1012
|
+
{
|
|
1013
|
+
// fork, get the pid of the child and send it the command
|
|
1014
|
+
link l_fork="ssi:fork";
|
|
1015
|
+
open(l_fork);
|
|
1016
|
+
execute("write(l_fork,quote(" + cmd + "));");
|
|
1017
|
+
list L=l_fork;
|
|
1018
|
+
int j=waitfirst(L,i*1000);
|
|
1019
|
+
// check, whether we have a result, and return it
|
|
1020
|
+
if (j==1)
|
|
1021
|
+
{
|
|
1022
|
+
def result = read(l_fork);
|
|
1023
|
+
if (defined(rsave))
|
|
1024
|
+
{
|
|
1025
|
+
if (nameof(basering)!=rname)
|
|
1026
|
+
{
|
|
1027
|
+
def watchdog_rneu=basering;
|
|
1028
|
+
setring rsave;
|
|
1029
|
+
if (!defined(result))
|
|
1030
|
+
{
|
|
1031
|
+
def result=fetch(watchdog_rneu,result);
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
if(defined(watchdog_interrupt))
|
|
1036
|
+
{
|
|
1037
|
+
kill watchdog_interrupt;
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
else
|
|
1041
|
+
{
|
|
1042
|
+
string result="Killed";
|
|
1043
|
+
if(!defined(watchdog_interrupt))
|
|
1044
|
+
{
|
|
1045
|
+
int watchdog_interrupt=1;
|
|
1046
|
+
export watchdog_interrupt;
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
close(l_fork);
|
|
1050
|
+
return(result);
|
|
1051
|
+
}
|
|
1052
|
+
else
|
|
1053
|
+
{
|
|
1054
|
+
ERROR("First argument of watchdog has to be a positive integer.");
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
example
|
|
1058
|
+
{ "EXAMPLE:"; echo=2;
|
|
1059
|
+
proc sleep(int s) {return(system("sh","sleep "+string(s)));}
|
|
1060
|
+
watchdog(1,"sleep(5)");
|
|
1061
|
+
watchdog(10,"sleep(5)");
|
|
1062
|
+
}
|
|
1063
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1064
|
+
|
|
1065
|
+
proc deleteSublist(intvec v,list l)
|
|
1066
|
+
"USAGE: deleteSublist(v,l); intvec v; list l
|
|
1067
|
+
where the entries of the integer vector v correspond to the
|
|
1068
|
+
positions of the elements to be deleted
|
|
1069
|
+
RETURN: list without the deleted elements
|
|
1070
|
+
EXAMPLE: example deleteSublist; shows an example"
|
|
1071
|
+
{
|
|
1072
|
+
list k;
|
|
1073
|
+
int i,j,skip;
|
|
1074
|
+
j=1;
|
|
1075
|
+
skip=0;
|
|
1076
|
+
intvec vs=sort(v)[1];
|
|
1077
|
+
for ( i=1 ; i <=size(vs) ; i++)
|
|
1078
|
+
{
|
|
1079
|
+
while ((j+skip) < vs[i])
|
|
1080
|
+
{
|
|
1081
|
+
k[j] = l[j+skip];
|
|
1082
|
+
j++;
|
|
1083
|
+
}
|
|
1084
|
+
skip++;
|
|
1085
|
+
}
|
|
1086
|
+
if(vs[size(vs)]<size(l))
|
|
1087
|
+
{
|
|
1088
|
+
k=k+list(l[(vs[size(vs)]+1)..size(l)]);
|
|
1089
|
+
}
|
|
1090
|
+
return(k);
|
|
1091
|
+
}
|
|
1092
|
+
example
|
|
1093
|
+
{ "EXAMPLE:"; echo=2;
|
|
1094
|
+
list l=1,2,3,4,5;
|
|
1095
|
+
intvec v=1,3,4;
|
|
1096
|
+
l=deleteSublist(v,l);
|
|
1097
|
+
l;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1101
|
+
proc primecoeffs(def J, list #)
|
|
1102
|
+
"USAGE: primecoeffs(J[,p]); J any type which can be converted to a matrix
|
|
1103
|
+
e.g. ideal, matrix, vector, module, int, intvec
|
|
1104
|
+
p = integer
|
|
1105
|
+
COMPUTE: primefactors <= p of coeffs of J (default p = 32003)
|
|
1106
|
+
RETURN: a list, say l, of two intvectors:@*
|
|
1107
|
+
l[1] : the different primefactors of all coefficients of J@*
|
|
1108
|
+
l[2] : the different remaining factors
|
|
1109
|
+
EXAMPLE: example primecoeffs; shows an example
|
|
1110
|
+
"
|
|
1111
|
+
{
|
|
1112
|
+
int q,ii,n,mark;;
|
|
1113
|
+
if (size(#) == 0)
|
|
1114
|
+
{
|
|
1115
|
+
q=32003;
|
|
1116
|
+
}
|
|
1117
|
+
else
|
|
1118
|
+
{
|
|
1119
|
+
if( typeof(#[1]) != "int")
|
|
1120
|
+
{
|
|
1121
|
+
ERROR("2nd parameter must be of type int"+newline);
|
|
1122
|
+
}
|
|
1123
|
+
q=#[1];
|
|
1124
|
+
if (q > 32003) { q = 32003; }
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
if (defined(basering) == 0)
|
|
1128
|
+
{
|
|
1129
|
+
mark=1;
|
|
1130
|
+
ring r = 0,x,dp;
|
|
1131
|
+
}
|
|
1132
|
+
def I = ideal(matrix(J));
|
|
1133
|
+
poly p = product(maxideal(1));
|
|
1134
|
+
matrix Coef=coef(I[1],p);
|
|
1135
|
+
ideal id, jd, rest;
|
|
1136
|
+
intvec v,re;
|
|
1137
|
+
list result,l;
|
|
1138
|
+
for(ii=2; ii<=ncols(I); ii++)
|
|
1139
|
+
{
|
|
1140
|
+
Coef=concat(Coef,coef(I[ii],p));
|
|
1141
|
+
}
|
|
1142
|
+
id = Coef[2,1..ncols(Coef)];
|
|
1143
|
+
id = simplify(id,6);
|
|
1144
|
+
for (ii=1; ii<=size(id); ii++)
|
|
1145
|
+
{
|
|
1146
|
+
l = primefactors(number(id[ii]),q);
|
|
1147
|
+
list jdl=l[1];
|
|
1148
|
+
jd = jd,jdl[1..size(jdl)];
|
|
1149
|
+
kill jdl;
|
|
1150
|
+
rest=rest, l[3];
|
|
1151
|
+
}
|
|
1152
|
+
jd = simplify(jd,6);
|
|
1153
|
+
for (ii=1; ii<=size(jd); ii++)
|
|
1154
|
+
{
|
|
1155
|
+
v[ii]=int(jd[ii]);
|
|
1156
|
+
}
|
|
1157
|
+
v = sort(v)[1];
|
|
1158
|
+
rest = simplify(rest,6);
|
|
1159
|
+
id = sort(id)[1];
|
|
1160
|
+
if (mark)
|
|
1161
|
+
{
|
|
1162
|
+
for (ii=1; ii<=size(rest); ii++)
|
|
1163
|
+
{
|
|
1164
|
+
re[ii] = int(rest[ii]);
|
|
1165
|
+
}
|
|
1166
|
+
result = v,re;
|
|
1167
|
+
}
|
|
1168
|
+
else
|
|
1169
|
+
{
|
|
1170
|
+
result = v,rest;
|
|
1171
|
+
}
|
|
1172
|
+
return(result);
|
|
1173
|
+
}
|
|
1174
|
+
example
|
|
1175
|
+
{ "EXAMPLE:"; echo = 2;
|
|
1176
|
+
primecoeffs(intvec(7*8*121,7*8));"";
|
|
1177
|
+
ring r = 0,(b,c,t),dp;
|
|
1178
|
+
ideal I = -13b6c3t+4b5c4t,-10b4c2t-5b4ct2;
|
|
1179
|
+
primecoeffs(I);
|
|
1180
|
+
}
|
|
1181
|
+
///////////////////////////////////////////////////////////////////////////////
|
|
1182
|
+
proc timeFactorize(poly i,list #)
|
|
1183
|
+
"USAGE: timeFactorize(p,d); poly p , integer d
|
|
1184
|
+
RETURN: factorize(p) if the factorization finished after d-1
|
|
1185
|
+
seconds otherwise f is considered to be irreducible
|
|
1186
|
+
EXAMPLE: example timeFactorize; shows an example
|
|
1187
|
+
"
|
|
1188
|
+
{
|
|
1189
|
+
def P=basering;
|
|
1190
|
+
if (size(#) > 0)
|
|
1191
|
+
{
|
|
1192
|
+
if ((typeof(#[1]) == "int")&&(#[1]))
|
|
1193
|
+
{
|
|
1194
|
+
int wait = #[1];
|
|
1195
|
+
int j = 10;
|
|
1196
|
+
|
|
1197
|
+
string bs = nameof(basering);
|
|
1198
|
+
link l_fork = "ssi:fork";
|
|
1199
|
+
open(l_fork);
|
|
1200
|
+
write(l_fork, quote(timeFactorize(eval(i))));
|
|
1201
|
+
|
|
1202
|
+
// sleep in small intervals for appr. one second
|
|
1203
|
+
if (wait > 0)
|
|
1204
|
+
{
|
|
1205
|
+
while(j < 1000000)
|
|
1206
|
+
{
|
|
1207
|
+
if (status(l_fork, "read", "ready", j)) {break;}
|
|
1208
|
+
j = j + j;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
// sleep in intervals of one second from now on
|
|
1213
|
+
j = 1;
|
|
1214
|
+
while (j < wait)
|
|
1215
|
+
{
|
|
1216
|
+
if (status(l_fork, "read", "ready", 1000000)) {break;}
|
|
1217
|
+
j = j + 1;
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
if (status(l_fork, "read", "ready"))
|
|
1221
|
+
{
|
|
1222
|
+
def result = read(l_fork);
|
|
1223
|
+
if (bs != nameof(basering))
|
|
1224
|
+
{
|
|
1225
|
+
def PP = basering;
|
|
1226
|
+
setring P;
|
|
1227
|
+
def result = imap(PP, result);
|
|
1228
|
+
kill PP;
|
|
1229
|
+
}
|
|
1230
|
+
close(l_fork);
|
|
1231
|
+
}
|
|
1232
|
+
else
|
|
1233
|
+
{
|
|
1234
|
+
list result;
|
|
1235
|
+
intvec v=1,1;
|
|
1236
|
+
result[1]=list(1,i);
|
|
1237
|
+
result[2]=v;
|
|
1238
|
+
close(l_fork);
|
|
1239
|
+
}
|
|
1240
|
+
return (result);
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
return(factorH(i));
|
|
1244
|
+
}
|
|
1245
|
+
example
|
|
1246
|
+
{ "EXAMPLE:"; echo = 2;
|
|
1247
|
+
ring r=0,(x,y),dp;
|
|
1248
|
+
poly p=((x2+y3)^2+xy6)*((x3+y2)^2+x10y);
|
|
1249
|
+
p=p^2;
|
|
1250
|
+
timeFactorize(p,2);
|
|
1251
|
+
//timeFactorize(p,20);
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
proc timeStd(ideal i,list #)
|
|
1255
|
+
"USAGE: timeStd(i,d), i ideal, d integer
|
|
1256
|
+
RETURN: std(i) if the standard basis computation finished after
|
|
1257
|
+
d-1 seconds and i otherwise
|
|
1258
|
+
EXAMPLE: example timeStd; shows an example
|
|
1259
|
+
"
|
|
1260
|
+
{
|
|
1261
|
+
def P=basering;
|
|
1262
|
+
if (size(#) > 0)
|
|
1263
|
+
{
|
|
1264
|
+
if ((typeof(#[1]) == "int")&&(#[1]))
|
|
1265
|
+
{
|
|
1266
|
+
int wait = #[1]*1000;
|
|
1267
|
+
|
|
1268
|
+
string bs = nameof(basering);
|
|
1269
|
+
link l_fork = "ssi:fork";
|
|
1270
|
+
open(l_fork);
|
|
1271
|
+
write(l_fork, quote(std(eval(i))));
|
|
1272
|
+
list L=l_fork;
|
|
1273
|
+
int j=waitfirst(L,wait);
|
|
1274
|
+
if (j==0) // timeout
|
|
1275
|
+
{
|
|
1276
|
+
ideal result=i;
|
|
1277
|
+
}
|
|
1278
|
+
else
|
|
1279
|
+
{
|
|
1280
|
+
def result = read(l_fork);
|
|
1281
|
+
if (bs != nameof(basering))
|
|
1282
|
+
{
|
|
1283
|
+
def PP = basering;
|
|
1284
|
+
setring P;
|
|
1285
|
+
def result = imap(PP, result);
|
|
1286
|
+
kill PP;
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
close(l_fork);
|
|
1290
|
+
return (result);
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
return(std(i));
|
|
1294
|
+
}
|
|
1295
|
+
example
|
|
1296
|
+
{ "EXAMPLE:"; echo = 2;
|
|
1297
|
+
ring r=32003,(a,b,c,d,e),dp;
|
|
1298
|
+
int n=7;
|
|
1299
|
+
ideal i=
|
|
1300
|
+
a^n-b^n,
|
|
1301
|
+
b^n-c^n,
|
|
1302
|
+
c^n-d^n,
|
|
1303
|
+
d^n-e^n,
|
|
1304
|
+
a^(n-1)*b+b^(n-1)*c+c^(n-1)*d+d^(n-1)*e+e^(n-1)*a;
|
|
1305
|
+
def i1=timeStd(i,1);
|
|
1306
|
+
def i2=timeStd(i,20);
|
|
1307
|
+
listvar();
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
proc factorH(poly p)
|
|
1311
|
+
"USAGE: factorH(p) p poly
|
|
1312
|
+
RETURN: factorize(p)
|
|
1313
|
+
NOTE: changes variables to make the last variable the principal
|
|
1314
|
+
one in the multivariate factorization and factorizes then
|
|
1315
|
+
the polynomial
|
|
1316
|
+
EXAMPLE: example factorH; shows an example
|
|
1317
|
+
"
|
|
1318
|
+
{
|
|
1319
|
+
def R=basering;
|
|
1320
|
+
int i,j;
|
|
1321
|
+
int n=1;
|
|
1322
|
+
int d=nrows(coeffs(p,var(1)));
|
|
1323
|
+
for(i=1;i<=nvars(R);i++)
|
|
1324
|
+
{
|
|
1325
|
+
j=nrows(coeffs(p,var(i)));
|
|
1326
|
+
if(d>j)
|
|
1327
|
+
{
|
|
1328
|
+
n=i;
|
|
1329
|
+
d=j;
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
ideal ma=maxideal(1); //die letzte Variable ist die Hauptvariable
|
|
1333
|
+
ma[nvars(R)]=var(n);
|
|
1334
|
+
ma[n]=var(nvars(R));
|
|
1335
|
+
map phi=R,ma;
|
|
1336
|
+
list fac=factorize(phi(p));
|
|
1337
|
+
list re=phi(fac);
|
|
1338
|
+
return(re);
|
|
1339
|
+
}
|
|
1340
|
+
example
|
|
1341
|
+
{ "EXAMPLE:"; echo = 2;
|
|
1342
|
+
system("random",992851144);
|
|
1343
|
+
ring r=32003,(x,y,z,w,t),lp;
|
|
1344
|
+
poly p=y2w9+yz7t-yz5w4-z2w4t4-w8t3;
|
|
1345
|
+
factorize(p); //fast
|
|
1346
|
+
system("random",992851262);
|
|
1347
|
+
//factorize(p); //slow
|
|
1348
|
+
system("random",992851262);
|
|
1349
|
+
factorH(p);
|
|
1350
|
+
}
|