passagemath-categories 10.6.32__cp314-cp314t-musllinux_1_2_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- passagemath_categories-10.6.32.dist-info/METADATA +156 -0
- passagemath_categories-10.6.32.dist-info/RECORD +719 -0
- passagemath_categories-10.6.32.dist-info/WHEEL +5 -0
- passagemath_categories-10.6.32.dist-info/top_level.txt +2 -0
- passagemath_categories.libs/libgcc_s-2d945d6c.so.1 +0 -0
- passagemath_categories.libs/libgmp-28992bcb.so.10.5.0 +0 -0
- passagemath_categories.libs/libstdc++-85f2cd6d.so.6.0.33 +0 -0
- sage/all__sagemath_categories.py +28 -0
- sage/arith/all.py +38 -0
- sage/arith/constants.pxd +27 -0
- sage/arith/functions.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/functions.pxd +4 -0
- sage/arith/functions.pyx +221 -0
- sage/arith/misc.py +6552 -0
- sage/arith/multi_modular.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/multi_modular.pxd +39 -0
- sage/arith/multi_modular.pyx +994 -0
- sage/arith/rational_reconstruction.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/rational_reconstruction.pxd +4 -0
- sage/arith/rational_reconstruction.pyx +115 -0
- sage/arith/srange.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/srange.pyx +571 -0
- sage/calculus/all__sagemath_categories.py +2 -0
- sage/calculus/functional.py +481 -0
- sage/calculus/functions.py +151 -0
- sage/categories/additive_groups.py +73 -0
- sage/categories/additive_magmas.py +1044 -0
- sage/categories/additive_monoids.py +114 -0
- sage/categories/additive_semigroups.py +184 -0
- sage/categories/affine_weyl_groups.py +238 -0
- sage/categories/algebra_ideals.py +95 -0
- sage/categories/algebra_modules.py +96 -0
- sage/categories/algebras.py +349 -0
- sage/categories/algebras_with_basis.py +377 -0
- sage/categories/all.py +160 -0
- sage/categories/aperiodic_semigroups.py +29 -0
- sage/categories/associative_algebras.py +47 -0
- sage/categories/bialgebras.py +101 -0
- sage/categories/bialgebras_with_basis.py +414 -0
- sage/categories/bimodules.py +206 -0
- sage/categories/chain_complexes.py +268 -0
- sage/categories/classical_crystals.py +480 -0
- sage/categories/coalgebras.py +405 -0
- sage/categories/coalgebras_with_basis.py +232 -0
- sage/categories/coercion_methods.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/categories/coercion_methods.pyx +52 -0
- sage/categories/commutative_additive_groups.py +104 -0
- sage/categories/commutative_additive_monoids.py +45 -0
- sage/categories/commutative_additive_semigroups.py +48 -0
- sage/categories/commutative_algebra_ideals.py +87 -0
- sage/categories/commutative_algebras.py +94 -0
- sage/categories/commutative_ring_ideals.py +58 -0
- sage/categories/commutative_rings.py +736 -0
- sage/categories/complete_discrete_valuation.py +293 -0
- sage/categories/complex_reflection_groups.py +145 -0
- sage/categories/complex_reflection_or_generalized_coxeter_groups.py +1249 -0
- sage/categories/coxeter_group_algebras.py +186 -0
- sage/categories/coxeter_groups.py +3402 -0
- sage/categories/crystals.py +2628 -0
- sage/categories/cw_complexes.py +216 -0
- sage/categories/dedekind_domains.py +137 -0
- sage/categories/discrete_valuation.py +325 -0
- sage/categories/distributive_magmas_and_additive_magmas.py +100 -0
- sage/categories/division_rings.py +114 -0
- sage/categories/domains.py +95 -0
- sage/categories/drinfeld_modules.py +789 -0
- sage/categories/dual.py +42 -0
- sage/categories/enumerated_sets.py +1146 -0
- sage/categories/euclidean_domains.py +271 -0
- sage/categories/examples/algebras_with_basis.py +102 -0
- sage/categories/examples/all.py +1 -0
- sage/categories/examples/commutative_additive_monoids.py +130 -0
- sage/categories/examples/commutative_additive_semigroups.py +199 -0
- sage/categories/examples/coxeter_groups.py +8 -0
- sage/categories/examples/crystals.py +236 -0
- sage/categories/examples/cw_complexes.py +163 -0
- sage/categories/examples/facade_sets.py +187 -0
- sage/categories/examples/filtered_algebras_with_basis.py +204 -0
- sage/categories/examples/filtered_modules_with_basis.py +154 -0
- sage/categories/examples/finite_coxeter_groups.py +252 -0
- sage/categories/examples/finite_dimensional_algebras_with_basis.py +148 -0
- sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py +495 -0
- sage/categories/examples/finite_enumerated_sets.py +208 -0
- sage/categories/examples/finite_monoids.py +150 -0
- sage/categories/examples/finite_semigroups.py +190 -0
- sage/categories/examples/finite_weyl_groups.py +191 -0
- sage/categories/examples/graded_connected_hopf_algebras_with_basis.py +152 -0
- sage/categories/examples/graded_modules_with_basis.py +168 -0
- sage/categories/examples/graphs.py +122 -0
- sage/categories/examples/hopf_algebras_with_basis.py +145 -0
- sage/categories/examples/infinite_enumerated_sets.py +190 -0
- sage/categories/examples/lie_algebras.py +352 -0
- sage/categories/examples/lie_algebras_with_basis.py +196 -0
- sage/categories/examples/magmas.py +162 -0
- sage/categories/examples/manifolds.py +94 -0
- sage/categories/examples/monoids.py +144 -0
- sage/categories/examples/posets.py +178 -0
- sage/categories/examples/semigroups.py +580 -0
- sage/categories/examples/semigroups_cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/categories/examples/semigroups_cython.pyx +221 -0
- sage/categories/examples/semirings.py +249 -0
- sage/categories/examples/sets_cat.py +706 -0
- sage/categories/examples/sets_with_grading.py +101 -0
- sage/categories/examples/with_realizations.py +542 -0
- sage/categories/fields.py +991 -0
- sage/categories/filtered_algebras.py +63 -0
- sage/categories/filtered_algebras_with_basis.py +548 -0
- sage/categories/filtered_hopf_algebras_with_basis.py +138 -0
- sage/categories/filtered_modules.py +210 -0
- sage/categories/filtered_modules_with_basis.py +1209 -0
- sage/categories/finite_complex_reflection_groups.py +1506 -0
- sage/categories/finite_coxeter_groups.py +1138 -0
- sage/categories/finite_crystals.py +103 -0
- sage/categories/finite_dimensional_algebras_with_basis.py +1860 -0
- sage/categories/finite_dimensional_bialgebras_with_basis.py +33 -0
- sage/categories/finite_dimensional_coalgebras_with_basis.py +33 -0
- sage/categories/finite_dimensional_graded_lie_algebras_with_basis.py +231 -0
- sage/categories/finite_dimensional_hopf_algebras_with_basis.py +38 -0
- sage/categories/finite_dimensional_lie_algebras_with_basis.py +2774 -0
- sage/categories/finite_dimensional_modules_with_basis.py +1407 -0
- sage/categories/finite_dimensional_nilpotent_lie_algebras_with_basis.py +167 -0
- sage/categories/finite_dimensional_semisimple_algebras_with_basis.py +270 -0
- sage/categories/finite_enumerated_sets.py +769 -0
- sage/categories/finite_fields.py +252 -0
- sage/categories/finite_groups.py +256 -0
- sage/categories/finite_lattice_posets.py +242 -0
- sage/categories/finite_monoids.py +316 -0
- sage/categories/finite_permutation_groups.py +339 -0
- sage/categories/finite_posets.py +1994 -0
- sage/categories/finite_semigroups.py +136 -0
- sage/categories/finite_sets.py +93 -0
- sage/categories/finite_weyl_groups.py +39 -0
- sage/categories/finitely_generated_lambda_bracket_algebras.py +112 -0
- sage/categories/finitely_generated_lie_conformal_algebras.py +114 -0
- sage/categories/finitely_generated_magmas.py +57 -0
- sage/categories/finitely_generated_semigroups.py +214 -0
- sage/categories/function_fields.py +76 -0
- sage/categories/g_sets.py +77 -0
- sage/categories/gcd_domains.py +65 -0
- sage/categories/generalized_coxeter_groups.py +94 -0
- sage/categories/graded_algebras.py +85 -0
- sage/categories/graded_algebras_with_basis.py +258 -0
- sage/categories/graded_bialgebras.py +32 -0
- sage/categories/graded_bialgebras_with_basis.py +32 -0
- sage/categories/graded_coalgebras.py +65 -0
- sage/categories/graded_coalgebras_with_basis.py +51 -0
- sage/categories/graded_hopf_algebras.py +41 -0
- sage/categories/graded_hopf_algebras_with_basis.py +169 -0
- sage/categories/graded_lie_algebras.py +91 -0
- sage/categories/graded_lie_algebras_with_basis.py +44 -0
- sage/categories/graded_lie_conformal_algebras.py +74 -0
- sage/categories/graded_modules.py +133 -0
- sage/categories/graded_modules_with_basis.py +329 -0
- sage/categories/graphs.py +138 -0
- sage/categories/group_algebras.py +430 -0
- sage/categories/groupoid.py +94 -0
- sage/categories/groups.py +667 -0
- sage/categories/h_trivial_semigroups.py +64 -0
- sage/categories/hecke_modules.py +185 -0
- sage/categories/highest_weight_crystals.py +980 -0
- sage/categories/hopf_algebras.py +219 -0
- sage/categories/hopf_algebras_with_basis.py +309 -0
- sage/categories/infinite_enumerated_sets.py +115 -0
- sage/categories/integral_domains.py +203 -0
- sage/categories/j_trivial_semigroups.py +29 -0
- sage/categories/kac_moody_algebras.py +82 -0
- sage/categories/kahler_algebras.py +203 -0
- sage/categories/l_trivial_semigroups.py +63 -0
- sage/categories/lambda_bracket_algebras.py +280 -0
- sage/categories/lambda_bracket_algebras_with_basis.py +107 -0
- sage/categories/lattice_posets.py +89 -0
- sage/categories/left_modules.py +49 -0
- sage/categories/lie_algebras.py +1070 -0
- sage/categories/lie_algebras_with_basis.py +261 -0
- sage/categories/lie_conformal_algebras.py +350 -0
- sage/categories/lie_conformal_algebras_with_basis.py +147 -0
- sage/categories/lie_groups.py +73 -0
- sage/categories/loop_crystals.py +1290 -0
- sage/categories/magmas.py +1189 -0
- sage/categories/magmas_and_additive_magmas.py +149 -0
- sage/categories/magmatic_algebras.py +365 -0
- sage/categories/manifolds.py +352 -0
- sage/categories/matrix_algebras.py +40 -0
- sage/categories/metric_spaces.py +387 -0
- sage/categories/modular_abelian_varieties.py +78 -0
- sage/categories/modules.py +989 -0
- sage/categories/modules_with_basis.py +2794 -0
- sage/categories/monoid_algebras.py +38 -0
- sage/categories/monoids.py +739 -0
- sage/categories/noetherian_rings.py +87 -0
- sage/categories/number_fields.py +242 -0
- sage/categories/ore_modules.py +189 -0
- sage/categories/partially_ordered_monoids.py +49 -0
- sage/categories/permutation_groups.py +63 -0
- sage/categories/pointed_sets.py +42 -0
- sage/categories/polyhedra.py +74 -0
- sage/categories/poor_man_map.py +270 -0
- sage/categories/posets.py +722 -0
- sage/categories/principal_ideal_domains.py +270 -0
- sage/categories/quantum_group_representations.py +543 -0
- sage/categories/quotient_fields.py +728 -0
- sage/categories/r_trivial_semigroups.py +45 -0
- sage/categories/regular_crystals.py +898 -0
- sage/categories/regular_supercrystals.py +170 -0
- sage/categories/right_modules.py +49 -0
- sage/categories/ring_ideals.py +74 -0
- sage/categories/rings.py +1904 -0
- sage/categories/rngs.py +175 -0
- sage/categories/schemes.py +393 -0
- sage/categories/semigroups.py +1060 -0
- sage/categories/semirings.py +71 -0
- sage/categories/semisimple_algebras.py +114 -0
- sage/categories/sets_with_grading.py +235 -0
- sage/categories/shephard_groups.py +43 -0
- sage/categories/signed_tensor.py +120 -0
- sage/categories/simplicial_complexes.py +134 -0
- sage/categories/simplicial_sets.py +1206 -0
- sage/categories/super_algebras.py +149 -0
- sage/categories/super_algebras_with_basis.py +144 -0
- sage/categories/super_hopf_algebras_with_basis.py +126 -0
- sage/categories/super_lie_conformal_algebras.py +193 -0
- sage/categories/super_modules.py +229 -0
- sage/categories/super_modules_with_basis.py +193 -0
- sage/categories/supercommutative_algebras.py +99 -0
- sage/categories/supercrystals.py +406 -0
- sage/categories/tensor.py +110 -0
- sage/categories/topological_spaces.py +170 -0
- sage/categories/triangular_kac_moody_algebras.py +439 -0
- sage/categories/tutorial.py +58 -0
- sage/categories/unique_factorization_domains.py +318 -0
- sage/categories/unital_algebras.py +426 -0
- sage/categories/vector_bundles.py +159 -0
- sage/categories/vector_spaces.py +357 -0
- sage/categories/weyl_groups.py +853 -0
- sage/combinat/all__sagemath_categories.py +34 -0
- sage/combinat/backtrack.py +180 -0
- sage/combinat/combinat.py +2269 -0
- sage/combinat/combinat_cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/combinat_cython.pxd +6 -0
- sage/combinat/combinat_cython.pyx +390 -0
- sage/combinat/combination.py +796 -0
- sage/combinat/combinatorial_map.py +416 -0
- sage/combinat/composition.py +2192 -0
- sage/combinat/dlx.py +510 -0
- sage/combinat/integer_lists/__init__.py +7 -0
- sage/combinat/integer_lists/base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/integer_lists/base.pxd +16 -0
- sage/combinat/integer_lists/base.pyx +713 -0
- sage/combinat/integer_lists/invlex.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/integer_lists/invlex.pxd +4 -0
- sage/combinat/integer_lists/invlex.pyx +1650 -0
- sage/combinat/integer_lists/lists.py +328 -0
- sage/combinat/integer_lists/nn.py +48 -0
- sage/combinat/integer_vector.py +1818 -0
- sage/combinat/integer_vector_weighted.py +413 -0
- sage/combinat/matrices/all__sagemath_categories.py +5 -0
- sage/combinat/matrices/dancing_links.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/matrices/dancing_links.pyx +1159 -0
- sage/combinat/matrices/dancing_links_c.h +380 -0
- sage/combinat/matrices/dlxcpp.py +136 -0
- sage/combinat/partition.py +10070 -0
- sage/combinat/partitions.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/partitions.pyx +743 -0
- sage/combinat/permutation.py +10168 -0
- sage/combinat/permutation_cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/permutation_cython.pxd +11 -0
- sage/combinat/permutation_cython.pyx +407 -0
- sage/combinat/q_analogues.py +1090 -0
- sage/combinat/ranker.py +268 -0
- sage/combinat/subset.py +1561 -0
- sage/combinat/subsets_hereditary.py +202 -0
- sage/combinat/subsets_pairwise.py +184 -0
- sage/combinat/tools.py +63 -0
- sage/combinat/tuple.py +348 -0
- sage/data_structures/all.py +2 -0
- sage/data_structures/all__sagemath_categories.py +2 -0
- sage/data_structures/binary_matrix.pxd +138 -0
- sage/data_structures/binary_search.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/binary_search.pxd +3 -0
- sage/data_structures/binary_search.pyx +66 -0
- sage/data_structures/bitset.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/bitset.pxd +40 -0
- sage/data_structures/bitset.pyx +2385 -0
- sage/data_structures/bitset_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/bitset_base.pxd +926 -0
- sage/data_structures/bitset_base.pyx +117 -0
- sage/data_structures/bitset_intrinsics.h +487 -0
- sage/data_structures/blas_dict.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/blas_dict.pxd +12 -0
- sage/data_structures/blas_dict.pyx +469 -0
- sage/data_structures/list_of_pairs.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/list_of_pairs.pxd +16 -0
- sage/data_structures/list_of_pairs.pyx +122 -0
- sage/data_structures/mutable_poset.py +3312 -0
- sage/data_structures/pairing_heap.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/pairing_heap.h +346 -0
- sage/data_structures/pairing_heap.pxd +88 -0
- sage/data_structures/pairing_heap.pyx +1464 -0
- sage/data_structures/sparse_bitset.pxd +62 -0
- sage/data_structures/stream.py +5070 -0
- sage/databases/all__sagemath_categories.py +7 -0
- sage/databases/sql_db.py +2236 -0
- sage/ext/all__sagemath_categories.py +3 -0
- sage/ext/fast_callable.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/fast_callable.pxd +4 -0
- sage/ext/fast_callable.pyx +2746 -0
- sage/ext/fast_eval.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/fast_eval.pxd +1 -0
- sage/ext/fast_eval.pyx +102 -0
- sage/ext/interpreters/__init__.py +1 -0
- sage/ext/interpreters/all__sagemath_categories.py +2 -0
- sage/ext/interpreters/wrapper_el.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/interpreters/wrapper_el.pxd +18 -0
- sage/ext/interpreters/wrapper_el.pyx +148 -0
- sage/ext/interpreters/wrapper_py.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/interpreters/wrapper_py.pxd +17 -0
- sage/ext/interpreters/wrapper_py.pyx +133 -0
- sage/functions/airy.py +937 -0
- sage/functions/all.py +97 -0
- sage/functions/bessel.py +2102 -0
- sage/functions/error.py +784 -0
- sage/functions/exp_integral.py +1529 -0
- sage/functions/gamma.py +1087 -0
- sage/functions/generalized.py +672 -0
- sage/functions/hyperbolic.py +747 -0
- sage/functions/hypergeometric.py +1156 -0
- sage/functions/jacobi.py +1705 -0
- sage/functions/log.py +1402 -0
- sage/functions/min_max.py +338 -0
- sage/functions/orthogonal_polys.py +3106 -0
- sage/functions/other.py +2303 -0
- sage/functions/piecewise.py +1505 -0
- sage/functions/prime_pi.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/functions/prime_pi.pyx +262 -0
- sage/functions/special.py +1212 -0
- sage/functions/spike_function.py +278 -0
- sage/functions/transcendental.py +690 -0
- sage/functions/trig.py +1062 -0
- sage/functions/wigner.py +726 -0
- sage/geometry/abc.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/geometry/abc.pyx +82 -0
- sage/geometry/all__sagemath_categories.py +1 -0
- sage/groups/all__sagemath_categories.py +11 -0
- sage/groups/generic.py +1733 -0
- sage/groups/groups_catalog.py +113 -0
- sage/groups/perm_gps/all__sagemath_categories.py +1 -0
- sage/groups/perm_gps/partn_ref/all.py +1 -0
- sage/groups/perm_gps/partn_ref/all__sagemath_categories.py +1 -0
- sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.pxd +52 -0
- sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.pyx +906 -0
- sage/groups/perm_gps/partn_ref/canonical_augmentation.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/canonical_augmentation.pxd +85 -0
- sage/groups/perm_gps/partn_ref/canonical_augmentation.pyx +534 -0
- sage/groups/perm_gps/partn_ref/data_structures.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/data_structures.pxd +576 -0
- sage/groups/perm_gps/partn_ref/data_structures.pyx +1792 -0
- sage/groups/perm_gps/partn_ref/double_coset.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/double_coset.pxd +45 -0
- sage/groups/perm_gps/partn_ref/double_coset.pyx +739 -0
- sage/groups/perm_gps/partn_ref/refinement_lists.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_lists.pxd +18 -0
- sage/groups/perm_gps/partn_ref/refinement_lists.pyx +82 -0
- sage/groups/perm_gps/partn_ref/refinement_python.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_python.pxd +16 -0
- sage/groups/perm_gps/partn_ref/refinement_python.pyx +564 -0
- sage/groups/perm_gps/partn_ref/refinement_sets.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_sets.pxd +60 -0
- sage/groups/perm_gps/partn_ref/refinement_sets.pyx +858 -0
- sage/interfaces/abc.py +140 -0
- sage/interfaces/all.py +58 -0
- sage/interfaces/all__sagemath_categories.py +1 -0
- sage/interfaces/expect.py +1643 -0
- sage/interfaces/interface.py +1682 -0
- sage/interfaces/process.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/interfaces/process.pxd +5 -0
- sage/interfaces/process.pyx +288 -0
- sage/interfaces/quit.py +167 -0
- sage/interfaces/sage0.py +604 -0
- sage/interfaces/sagespawn.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/interfaces/sagespawn.pyx +308 -0
- sage/interfaces/tab_completion.py +101 -0
- sage/misc/all__sagemath_categories.py +78 -0
- sage/misc/allocator.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/allocator.pxd +6 -0
- sage/misc/allocator.pyx +47 -0
- sage/misc/binary_tree.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/binary_tree.pxd +29 -0
- sage/misc/binary_tree.pyx +537 -0
- sage/misc/callable_dict.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/callable_dict.pyx +89 -0
- sage/misc/citation.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/citation.pyx +159 -0
- sage/misc/converting_dict.py +293 -0
- sage/misc/defaults.py +129 -0
- sage/misc/derivative.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/derivative.pyx +223 -0
- sage/misc/functional.py +2005 -0
- sage/misc/html.py +589 -0
- sage/misc/latex.py +2673 -0
- sage/misc/latex_macros.py +236 -0
- sage/misc/latex_standalone.py +1833 -0
- sage/misc/map_threaded.py +38 -0
- sage/misc/mathml.py +76 -0
- sage/misc/method_decorator.py +88 -0
- sage/misc/mrange.py +755 -0
- sage/misc/multireplace.py +41 -0
- sage/misc/object_multiplexer.py +92 -0
- sage/misc/parser.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/parser.pyx +1107 -0
- sage/misc/random_testing.py +264 -0
- sage/misc/rest_index_of_methods.py +377 -0
- sage/misc/search.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/search.pxd +2 -0
- sage/misc/search.pyx +68 -0
- sage/misc/stopgap.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/stopgap.pyx +95 -0
- sage/misc/table.py +853 -0
- sage/monoids/all__sagemath_categories.py +1 -0
- sage/monoids/indexed_free_monoid.py +1071 -0
- sage/monoids/monoid.py +82 -0
- sage/numerical/all__sagemath_categories.py +1 -0
- sage/numerical/backends/all__sagemath_categories.py +1 -0
- sage/numerical/backends/generic_backend.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/numerical/backends/generic_backend.pxd +61 -0
- sage/numerical/backends/generic_backend.pyx +1893 -0
- sage/numerical/backends/generic_sdp_backend.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/numerical/backends/generic_sdp_backend.pxd +38 -0
- sage/numerical/backends/generic_sdp_backend.pyx +755 -0
- sage/parallel/all.py +6 -0
- sage/parallel/decorate.py +575 -0
- sage/parallel/map_reduce.py +1997 -0
- sage/parallel/multiprocessing_sage.py +76 -0
- sage/parallel/ncpus.py +35 -0
- sage/parallel/parallelism.py +364 -0
- sage/parallel/reference.py +47 -0
- sage/parallel/use_fork.py +333 -0
- sage/rings/abc.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/abc.pxd +31 -0
- sage/rings/abc.pyx +526 -0
- sage/rings/algebraic_closure_finite_field.py +1154 -0
- sage/rings/all__sagemath_categories.py +91 -0
- sage/rings/big_oh.py +227 -0
- sage/rings/continued_fraction.py +2754 -0
- sage/rings/continued_fraction_gosper.py +220 -0
- sage/rings/factorint.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/factorint.pyx +295 -0
- sage/rings/fast_arith.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/fast_arith.pxd +21 -0
- sage/rings/fast_arith.pyx +535 -0
- sage/rings/finite_rings/all__sagemath_categories.py +9 -0
- sage/rings/finite_rings/conway_polynomials.py +542 -0
- sage/rings/finite_rings/element_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/element_base.pxd +12 -0
- sage/rings/finite_rings/element_base.pyx +1176 -0
- sage/rings/finite_rings/finite_field_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/finite_field_base.pxd +7 -0
- sage/rings/finite_rings/finite_field_base.pyx +2171 -0
- sage/rings/finite_rings/finite_field_constructor.py +827 -0
- sage/rings/finite_rings/finite_field_prime_modn.py +372 -0
- sage/rings/finite_rings/galois_group.py +154 -0
- sage/rings/finite_rings/hom_finite_field.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/hom_finite_field.pxd +23 -0
- sage/rings/finite_rings/hom_finite_field.pyx +856 -0
- sage/rings/finite_rings/hom_prime_finite_field.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/hom_prime_finite_field.pxd +15 -0
- sage/rings/finite_rings/hom_prime_finite_field.pyx +164 -0
- sage/rings/finite_rings/homset.py +357 -0
- sage/rings/finite_rings/integer_mod.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/integer_mod.pxd +56 -0
- sage/rings/finite_rings/integer_mod.pyx +4586 -0
- sage/rings/finite_rings/integer_mod_limits.h +11 -0
- sage/rings/finite_rings/integer_mod_ring.py +2044 -0
- sage/rings/finite_rings/residue_field.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/residue_field.pxd +30 -0
- sage/rings/finite_rings/residue_field.pyx +1811 -0
- sage/rings/finite_rings/stdint.pxd +19 -0
- sage/rings/fraction_field.py +1452 -0
- sage/rings/fraction_field_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/fraction_field_element.pyx +1357 -0
- sage/rings/function_field/all.py +7 -0
- sage/rings/function_field/all__sagemath_categories.py +2 -0
- sage/rings/function_field/constructor.py +218 -0
- sage/rings/function_field/element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/function_field/element.pxd +11 -0
- sage/rings/function_field/element.pyx +1008 -0
- sage/rings/function_field/element_rational.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/function_field/element_rational.pyx +513 -0
- sage/rings/function_field/extensions.py +230 -0
- sage/rings/function_field/function_field.py +1468 -0
- sage/rings/function_field/function_field_rational.py +1005 -0
- sage/rings/function_field/ideal.py +1155 -0
- sage/rings/function_field/ideal_rational.py +629 -0
- sage/rings/function_field/jacobian_base.py +826 -0
- sage/rings/function_field/jacobian_hess.py +1053 -0
- sage/rings/function_field/jacobian_khuri_makdisi.py +1027 -0
- sage/rings/function_field/maps.py +1039 -0
- sage/rings/function_field/order.py +281 -0
- sage/rings/function_field/order_basis.py +586 -0
- sage/rings/function_field/order_rational.py +576 -0
- sage/rings/function_field/place.py +426 -0
- sage/rings/function_field/place_rational.py +181 -0
- sage/rings/generic.py +320 -0
- sage/rings/homset.py +332 -0
- sage/rings/ideal.py +1885 -0
- sage/rings/ideal_monoid.py +215 -0
- sage/rings/infinity.py +1890 -0
- sage/rings/integer.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/integer.pxd +45 -0
- sage/rings/integer.pyx +7874 -0
- sage/rings/integer_ring.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/integer_ring.pxd +8 -0
- sage/rings/integer_ring.pyx +1693 -0
- sage/rings/laurent_series_ring.py +931 -0
- sage/rings/laurent_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/laurent_series_ring_element.pxd +11 -0
- sage/rings/laurent_series_ring_element.pyx +1927 -0
- sage/rings/lazy_series.py +7815 -0
- sage/rings/lazy_series_ring.py +4356 -0
- sage/rings/localization.py +1043 -0
- sage/rings/morphism.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/morphism.pxd +39 -0
- sage/rings/morphism.pyx +3299 -0
- sage/rings/multi_power_series_ring.py +1145 -0
- sage/rings/multi_power_series_ring_element.py +2184 -0
- sage/rings/noncommutative_ideals.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/noncommutative_ideals.pyx +423 -0
- sage/rings/number_field/all__sagemath_categories.py +1 -0
- sage/rings/number_field/number_field_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/number_field/number_field_base.pxd +8 -0
- sage/rings/number_field/number_field_base.pyx +507 -0
- sage/rings/number_field/number_field_element_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/number_field/number_field_element_base.pxd +6 -0
- sage/rings/number_field/number_field_element_base.pyx +36 -0
- sage/rings/number_field/number_field_ideal.py +3550 -0
- sage/rings/padics/all__sagemath_categories.py +4 -0
- sage/rings/padics/local_generic.py +1670 -0
- sage/rings/padics/local_generic_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/padics/local_generic_element.pxd +5 -0
- sage/rings/padics/local_generic_element.pyx +1017 -0
- sage/rings/padics/misc.py +256 -0
- sage/rings/padics/padic_generic.py +1911 -0
- sage/rings/padics/pow_computer.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/padics/pow_computer.pxd +38 -0
- sage/rings/padics/pow_computer.pyx +671 -0
- sage/rings/padics/precision_error.py +24 -0
- sage/rings/polynomial/all__sagemath_categories.py +25 -0
- sage/rings/polynomial/commutative_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/commutative_polynomial.pxd +6 -0
- sage/rings/polynomial/commutative_polynomial.pyx +24 -0
- sage/rings/polynomial/cyclotomic.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/cyclotomic.pyx +404 -0
- sage/rings/polynomial/flatten.py +711 -0
- sage/rings/polynomial/ideal.py +102 -0
- sage/rings/polynomial/infinite_polynomial_element.py +1768 -0
- sage/rings/polynomial/infinite_polynomial_ring.py +1653 -0
- sage/rings/polynomial/laurent_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/laurent_polynomial.pxd +18 -0
- sage/rings/polynomial/laurent_polynomial.pyx +2190 -0
- sage/rings/polynomial/laurent_polynomial_ideal.py +590 -0
- sage/rings/polynomial/laurent_polynomial_ring.py +832 -0
- sage/rings/polynomial/laurent_polynomial_ring_base.py +708 -0
- sage/rings/polynomial/multi_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/multi_polynomial.pxd +12 -0
- sage/rings/polynomial/multi_polynomial.pyx +3082 -0
- sage/rings/polynomial/multi_polynomial_element.py +2570 -0
- sage/rings/polynomial/multi_polynomial_ideal.py +5771 -0
- sage/rings/polynomial/multi_polynomial_ring.py +947 -0
- sage/rings/polynomial/multi_polynomial_ring_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/multi_polynomial_ring_base.pxd +15 -0
- sage/rings/polynomial/multi_polynomial_ring_base.pyx +1855 -0
- sage/rings/polynomial/multi_polynomial_sequence.py +2204 -0
- sage/rings/polynomial/polydict.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polydict.pxd +45 -0
- sage/rings/polynomial/polydict.pyx +2701 -0
- sage/rings/polynomial/polynomial_compiled.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_compiled.pxd +59 -0
- sage/rings/polynomial/polynomial_compiled.pyx +509 -0
- sage/rings/polynomial/polynomial_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_element.pxd +64 -0
- sage/rings/polynomial/polynomial_element.pyx +13255 -0
- sage/rings/polynomial/polynomial_element_generic.py +1637 -0
- sage/rings/polynomial/polynomial_fateman.py +97 -0
- sage/rings/polynomial/polynomial_quotient_ring.py +2465 -0
- sage/rings/polynomial/polynomial_quotient_ring_element.py +779 -0
- sage/rings/polynomial/polynomial_ring.py +3784 -0
- sage/rings/polynomial/polynomial_ring_constructor.py +1051 -0
- sage/rings/polynomial/polynomial_ring_homomorphism.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_ring_homomorphism.pxd +5 -0
- sage/rings/polynomial/polynomial_ring_homomorphism.pyx +121 -0
- sage/rings/polynomial/polynomial_singular_interface.py +549 -0
- sage/rings/polynomial/symmetric_ideal.py +989 -0
- sage/rings/polynomial/symmetric_reduction.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/symmetric_reduction.pxd +8 -0
- sage/rings/polynomial/symmetric_reduction.pyx +669 -0
- sage/rings/polynomial/term_order.py +2279 -0
- sage/rings/polynomial/toy_buchberger.py +449 -0
- sage/rings/polynomial/toy_d_basis.py +387 -0
- sage/rings/polynomial/toy_variety.py +362 -0
- sage/rings/power_series_mpoly.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/power_series_mpoly.pxd +9 -0
- sage/rings/power_series_mpoly.pyx +161 -0
- sage/rings/power_series_poly.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/power_series_poly.pxd +10 -0
- sage/rings/power_series_poly.pyx +1317 -0
- sage/rings/power_series_ring.py +1441 -0
- sage/rings/power_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/power_series_ring_element.pxd +12 -0
- sage/rings/power_series_ring_element.pyx +3028 -0
- sage/rings/puiseux_series_ring.py +487 -0
- sage/rings/puiseux_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/puiseux_series_ring_element.pxd +7 -0
- sage/rings/puiseux_series_ring_element.pyx +1055 -0
- sage/rings/qqbar_decorators.py +167 -0
- sage/rings/quotient_ring.py +1598 -0
- sage/rings/quotient_ring_element.py +979 -0
- sage/rings/rational.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/rational.pxd +20 -0
- sage/rings/rational.pyx +4284 -0
- sage/rings/rational_field.py +1730 -0
- sage/rings/real_double.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/real_double.pxd +16 -0
- sage/rings/real_double.pyx +2218 -0
- sage/rings/real_lazy.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/real_lazy.pxd +30 -0
- sage/rings/real_lazy.pyx +1773 -0
- sage/rings/ring.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/ring.pxd +30 -0
- sage/rings/ring.pyx +850 -0
- sage/rings/semirings/all.py +3 -0
- sage/rings/semirings/non_negative_integer_semiring.py +107 -0
- sage/rings/semirings/tropical_mpolynomial.py +972 -0
- sage/rings/semirings/tropical_polynomial.py +997 -0
- sage/rings/semirings/tropical_semiring.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/semirings/tropical_semiring.pyx +676 -0
- sage/rings/semirings/tropical_variety.py +1701 -0
- sage/rings/sum_of_squares.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/sum_of_squares.pxd +3 -0
- sage/rings/sum_of_squares.pyx +336 -0
- sage/rings/tests.py +504 -0
- sage/schemes/affine/affine_homset.py +508 -0
- sage/schemes/affine/affine_morphism.py +1574 -0
- sage/schemes/affine/affine_point.py +460 -0
- sage/schemes/affine/affine_rational_point.py +308 -0
- sage/schemes/affine/affine_space.py +1264 -0
- sage/schemes/affine/affine_subscheme.py +592 -0
- sage/schemes/affine/all.py +25 -0
- sage/schemes/all__sagemath_categories.py +5 -0
- sage/schemes/generic/algebraic_scheme.py +2092 -0
- sage/schemes/generic/all.py +5 -0
- sage/schemes/generic/ambient_space.py +400 -0
- sage/schemes/generic/divisor.py +465 -0
- sage/schemes/generic/divisor_group.py +313 -0
- sage/schemes/generic/glue.py +84 -0
- sage/schemes/generic/homset.py +820 -0
- sage/schemes/generic/hypersurface.py +234 -0
- sage/schemes/generic/morphism.py +2107 -0
- sage/schemes/generic/point.py +237 -0
- sage/schemes/generic/scheme.py +1190 -0
- sage/schemes/generic/spec.py +199 -0
- sage/schemes/product_projective/all.py +6 -0
- sage/schemes/product_projective/homset.py +236 -0
- sage/schemes/product_projective/morphism.py +517 -0
- sage/schemes/product_projective/point.py +568 -0
- sage/schemes/product_projective/rational_point.py +550 -0
- sage/schemes/product_projective/space.py +1301 -0
- sage/schemes/product_projective/subscheme.py +466 -0
- sage/schemes/projective/all.py +24 -0
- sage/schemes/projective/proj_bdd_height.py +453 -0
- sage/schemes/projective/projective_homset.py +718 -0
- sage/schemes/projective/projective_morphism.py +2792 -0
- sage/schemes/projective/projective_point.py +1484 -0
- sage/schemes/projective/projective_rational_point.py +569 -0
- sage/schemes/projective/projective_space.py +2571 -0
- sage/schemes/projective/projective_subscheme.py +1574 -0
- sage/sets/all.py +17 -0
- sage/sets/cartesian_product.py +376 -0
- sage/sets/condition_set.py +525 -0
- sage/sets/disjoint_set.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/disjoint_set.pxd +36 -0
- sage/sets/disjoint_set.pyx +998 -0
- sage/sets/disjoint_union_enumerated_sets.py +625 -0
- sage/sets/family.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/family.pxd +12 -0
- sage/sets/family.pyx +1556 -0
- sage/sets/finite_enumerated_set.py +406 -0
- sage/sets/finite_set_map_cy.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/finite_set_map_cy.pxd +34 -0
- sage/sets/finite_set_map_cy.pyx +708 -0
- sage/sets/finite_set_maps.py +591 -0
- sage/sets/image_set.py +448 -0
- sage/sets/integer_range.py +829 -0
- sage/sets/non_negative_integers.py +241 -0
- sage/sets/positive_integers.py +93 -0
- sage/sets/primes.py +188 -0
- sage/sets/real_set.py +2760 -0
- sage/sets/recursively_enumerated_set.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/recursively_enumerated_set.pxd +31 -0
- sage/sets/recursively_enumerated_set.pyx +2082 -0
- sage/sets/set.py +2083 -0
- sage/sets/set_from_iterator.py +1021 -0
- sage/sets/totally_ordered_finite_set.py +329 -0
- sage/symbolic/all__sagemath_categories.py +1 -0
- sage/symbolic/function.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/symbolic/function.pxd +29 -0
- sage/symbolic/function.pyx +1488 -0
- sage/symbolic/symbols.py +56 -0
- sage/tests/all__sagemath_categories.py +1 -0
- sage/tests/cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/tests/cython.pyx +37 -0
- sage/tests/stl_vector.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/tests/stl_vector.pyx +171 -0
- sage/typeset/all.py +6 -0
- sage/typeset/ascii_art.py +295 -0
- sage/typeset/character_art.py +789 -0
- sage/typeset/character_art_factory.py +572 -0
- sage/typeset/symbols.py +334 -0
- sage/typeset/unicode_art.py +183 -0
- sage/typeset/unicode_characters.py +101 -0
|
@@ -0,0 +1,1051 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-categories
|
|
2
|
+
r"""
|
|
3
|
+
Constructors for polynomial rings
|
|
4
|
+
|
|
5
|
+
This module provides the function :func:`PolynomialRing`, which constructs
|
|
6
|
+
rings of univariate and multivariate polynomials, and implements caching to
|
|
7
|
+
prevent the same ring being created in memory multiple times (which is
|
|
8
|
+
wasteful and breaks the general assumption in Sage that parents are unique).
|
|
9
|
+
|
|
10
|
+
There is also a function :func:`BooleanPolynomialRing_constructor`, used for
|
|
11
|
+
constructing Boolean polynomial rings, which are not technically polynomial
|
|
12
|
+
rings but rather quotients of them (see module
|
|
13
|
+
:mod:`sage.rings.polynomial.pbori` for more details).
|
|
14
|
+
"""
|
|
15
|
+
# ****************************************************************************
|
|
16
|
+
# Copyright (C) 2006 William Stein <wstein@gmail.com>
|
|
17
|
+
#
|
|
18
|
+
# This program is free software: you can redistribute it and/or modify
|
|
19
|
+
# it under the terms of the GNU General Public License as published by
|
|
20
|
+
# the Free Software Foundation, either version 2 of the License, or
|
|
21
|
+
# (at your option) any later version.
|
|
22
|
+
# https://www.gnu.org/licenses/
|
|
23
|
+
# ****************************************************************************
|
|
24
|
+
|
|
25
|
+
from sage.structure.category_object import normalize_names
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
import sage.rings.padics.padic_base_leaves as padic_base_leaves
|
|
29
|
+
except ImportError:
|
|
30
|
+
class padic_base_leaves:
|
|
31
|
+
pAdicFieldCappedRelative = ()
|
|
32
|
+
pAdicRingCappedRelative = ()
|
|
33
|
+
pAdicRingCappedAbsolute = ()
|
|
34
|
+
pAdicRingFixedMod = ()
|
|
35
|
+
|
|
36
|
+
import sage.rings.abc
|
|
37
|
+
from sage.rings.integer import Integer
|
|
38
|
+
from sage.rings.finite_rings.finite_field_base import FiniteField
|
|
39
|
+
|
|
40
|
+
from sage.misc.cachefunc import weak_cached_function
|
|
41
|
+
import sage.misc.weak_dict
|
|
42
|
+
|
|
43
|
+
from sage.categories.rings import Rings
|
|
44
|
+
from sage.categories.fields import Fields
|
|
45
|
+
from sage.categories.commutative_rings import CommutativeRings
|
|
46
|
+
from sage.categories.domains import Domains
|
|
47
|
+
from sage.categories.complete_discrete_valuation import CompleteDiscreteValuationRings, CompleteDiscreteValuationFields
|
|
48
|
+
|
|
49
|
+
_CommutativeRings = CommutativeRings()
|
|
50
|
+
_Fields = Fields()
|
|
51
|
+
_Domains = Domains()
|
|
52
|
+
_CompleteDiscreteValuationRings = CompleteDiscreteValuationRings()
|
|
53
|
+
_CompleteDiscreteValuationFields = CompleteDiscreteValuationFields()
|
|
54
|
+
|
|
55
|
+
_cache = sage.misc.weak_dict.WeakValueDictionary()
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# The signature for this function is too complicated to express sensibly
|
|
59
|
+
# in any other way besides *args and **kwds (in Python 3 or Cython, we
|
|
60
|
+
# could probably do better thanks to PEP 3102).
|
|
61
|
+
def PolynomialRing(base_ring, *args, **kwds):
|
|
62
|
+
r"""
|
|
63
|
+
Return the globally unique univariate or multivariate polynomial
|
|
64
|
+
ring with given properties and variable name or names.
|
|
65
|
+
|
|
66
|
+
There are many ways to specify the variables for the polynomial ring:
|
|
67
|
+
|
|
68
|
+
1. ``PolynomialRing(base_ring, name, ...)``
|
|
69
|
+
2. ``PolynomialRing(base_ring, names, ...)``
|
|
70
|
+
3. ``PolynomialRing(base_ring, n, names, ...)``
|
|
71
|
+
4. ``PolynomialRing(base_ring, n, ..., var_array=var_array, ...)``
|
|
72
|
+
|
|
73
|
+
The ``...`` at the end of these commands stands for additional
|
|
74
|
+
keywords, like ``sparse`` or ``order``.
|
|
75
|
+
|
|
76
|
+
INPUT:
|
|
77
|
+
|
|
78
|
+
- ``base_ring`` -- a ring
|
|
79
|
+
|
|
80
|
+
- ``n`` -- integer
|
|
81
|
+
|
|
82
|
+
- ``name`` -- string
|
|
83
|
+
|
|
84
|
+
- ``names`` -- list or tuple of names (strings), or a comma separated string
|
|
85
|
+
|
|
86
|
+
- ``var_array`` -- list or tuple of names, or a comma separated string
|
|
87
|
+
|
|
88
|
+
- ``sparse`` -- boolean; whether or not elements are sparse. The
|
|
89
|
+
default is a dense representation (``sparse=False``) for
|
|
90
|
+
univariate rings and a sparse representation (``sparse=True``)
|
|
91
|
+
for multivariate rings.
|
|
92
|
+
|
|
93
|
+
- ``order`` -- string or
|
|
94
|
+
:class:`~sage.rings.polynomial.term_order.TermOrder` object, e.g.,
|
|
95
|
+
|
|
96
|
+
- ``'degrevlex'`` -- default; degree reverse lexicographic
|
|
97
|
+
- ``'lex'`` -- lexicographic
|
|
98
|
+
- ``'deglex'`` -- degree lexicographic
|
|
99
|
+
- ``TermOrder('deglex',3) + TermOrder('deglex',3)`` -- block ordering
|
|
100
|
+
|
|
101
|
+
- ``implementation`` -- string or None; selects an implementation in cases
|
|
102
|
+
where Sage includes multiple choices (currently `\ZZ[x]` can be
|
|
103
|
+
implemented with ``'NTL'`` or ``'FLINT'``; default is ``'FLINT'``).
|
|
104
|
+
For many base rings, the ``'singular'`` implementation is available.
|
|
105
|
+
One can always specify ``implementation="generic"`` for a generic
|
|
106
|
+
Sage implementation which does not use any specialized library.
|
|
107
|
+
|
|
108
|
+
.. NOTE::
|
|
109
|
+
|
|
110
|
+
If the given implementation does not exist for rings with the given
|
|
111
|
+
number of generators and the given sparsity, then an error results.
|
|
112
|
+
|
|
113
|
+
OUTPUT:
|
|
114
|
+
|
|
115
|
+
``PolynomialRing(base_ring, name, sparse=False)`` returns a univariate
|
|
116
|
+
polynomial ring; also, PolynomialRing(base_ring, names, sparse=False)
|
|
117
|
+
yields a univariate polynomial ring, if names is a list or tuple
|
|
118
|
+
providing exactly one name. All other input formats return a
|
|
119
|
+
multivariate polynomial ring.
|
|
120
|
+
|
|
121
|
+
UNIQUENESS and IMMUTABILITY: In Sage there is exactly one
|
|
122
|
+
single-variate polynomial ring over each base ring in each choice
|
|
123
|
+
of variable, sparseness, and implementation. There is also exactly
|
|
124
|
+
one multivariate polynomial ring over each base ring for each
|
|
125
|
+
choice of names of variables and term order. The names of the
|
|
126
|
+
generators can only be temporarily changed after the ring has been
|
|
127
|
+
created. Do this using the :func:`localvars` context.
|
|
128
|
+
|
|
129
|
+
EXAMPLES:
|
|
130
|
+
|
|
131
|
+
**1. PolynomialRing(base_ring, name, ...)**
|
|
132
|
+
|
|
133
|
+
::
|
|
134
|
+
|
|
135
|
+
sage: PolynomialRing(QQ, 'w')
|
|
136
|
+
Univariate Polynomial Ring in w over Rational Field
|
|
137
|
+
sage: PolynomialRing(QQ, name='w')
|
|
138
|
+
Univariate Polynomial Ring in w over Rational Field
|
|
139
|
+
|
|
140
|
+
Use the diamond brackets notation to make the variable
|
|
141
|
+
ready for use after you define the ring::
|
|
142
|
+
|
|
143
|
+
sage: R.<w> = PolynomialRing(QQ)
|
|
144
|
+
sage: (1 + w)^3
|
|
145
|
+
w^3 + 3*w^2 + 3*w + 1
|
|
146
|
+
|
|
147
|
+
You must specify a name::
|
|
148
|
+
|
|
149
|
+
sage: PolynomialRing(QQ)
|
|
150
|
+
Traceback (most recent call last):
|
|
151
|
+
...
|
|
152
|
+
TypeError: you must specify the names of the variables
|
|
153
|
+
|
|
154
|
+
sage: R.<abc> = PolynomialRing(QQ, sparse=True); R
|
|
155
|
+
Sparse Univariate Polynomial Ring in abc over Rational Field
|
|
156
|
+
|
|
157
|
+
sage: R.<w> = PolynomialRing(PolynomialRing(GF(7),'k')); R
|
|
158
|
+
Univariate Polynomial Ring in w over
|
|
159
|
+
Univariate Polynomial Ring in k over Finite Field of size 7
|
|
160
|
+
|
|
161
|
+
The square bracket notation::
|
|
162
|
+
|
|
163
|
+
sage: R.<y> = QQ['y']; R
|
|
164
|
+
Univariate Polynomial Ring in y over Rational Field
|
|
165
|
+
sage: y^2 + y
|
|
166
|
+
y^2 + y
|
|
167
|
+
|
|
168
|
+
In fact, since the diamond brackets on the left determine the
|
|
169
|
+
variable name, you can omit the variable from the square brackets::
|
|
170
|
+
|
|
171
|
+
sage: R.<zz> = QQ[]; R
|
|
172
|
+
Univariate Polynomial Ring in zz over Rational Field
|
|
173
|
+
sage: (zz + 1)^2
|
|
174
|
+
zz^2 + 2*zz + 1
|
|
175
|
+
|
|
176
|
+
This is exactly the same ring as what PolynomialRing returns::
|
|
177
|
+
|
|
178
|
+
sage: R is PolynomialRing(QQ, 'zz')
|
|
179
|
+
True
|
|
180
|
+
|
|
181
|
+
However, rings with different variables are different::
|
|
182
|
+
|
|
183
|
+
sage: QQ['x'] == QQ['y']
|
|
184
|
+
False
|
|
185
|
+
|
|
186
|
+
Sage has two implementations of univariate polynomials over the
|
|
187
|
+
integers, one based on NTL and one based on FLINT. The default
|
|
188
|
+
is FLINT. Note that FLINT uses a "more dense" representation for
|
|
189
|
+
its polynomials than NTL, so in particular, creating a polynomial
|
|
190
|
+
like 2^1000000 * x^1000000 in FLINT may be unwise.
|
|
191
|
+
::
|
|
192
|
+
|
|
193
|
+
sage: ZxNTL = PolynomialRing(ZZ, 'x', implementation='NTL'); ZxNTL # needs sage.libs.ntl
|
|
194
|
+
Univariate Polynomial Ring in x over Integer Ring (using NTL)
|
|
195
|
+
sage: ZxFLINT = PolynomialRing(ZZ, 'x', implementation='FLINT'); ZxFLINT # needs sage.libs.flint
|
|
196
|
+
Univariate Polynomial Ring in x over Integer Ring
|
|
197
|
+
sage: ZxFLINT is ZZ['x'] # needs sage.libs.flint
|
|
198
|
+
True
|
|
199
|
+
sage: ZxFLINT is PolynomialRing(ZZ, 'x') # needs sage.libs.flint
|
|
200
|
+
True
|
|
201
|
+
sage: xNTL = ZxNTL.gen() # needs sage.libs.ntl
|
|
202
|
+
sage: xFLINT = ZxFLINT.gen() # needs sage.libs.flint
|
|
203
|
+
sage: xNTL.parent() # needs sage.libs.ntl
|
|
204
|
+
Univariate Polynomial Ring in x over Integer Ring (using NTL)
|
|
205
|
+
sage: xFLINT.parent() # needs sage.libs.flint
|
|
206
|
+
Univariate Polynomial Ring in x over Integer Ring
|
|
207
|
+
|
|
208
|
+
There is a coercion from the non-default to the default
|
|
209
|
+
implementation, so the values can be mixed in a single
|
|
210
|
+
expression::
|
|
211
|
+
|
|
212
|
+
sage: (xNTL + xFLINT^2) # needs sage.libs.flint sage.libs.ntl
|
|
213
|
+
x^2 + x
|
|
214
|
+
|
|
215
|
+
The result of such an expression will use the default, i.e.,
|
|
216
|
+
the FLINT implementation::
|
|
217
|
+
|
|
218
|
+
sage: (xNTL + xFLINT^2).parent() # needs sage.libs.flint sage.libs.ntl
|
|
219
|
+
Univariate Polynomial Ring in x over Integer Ring
|
|
220
|
+
|
|
221
|
+
The generic implementation uses neither NTL nor FLINT::
|
|
222
|
+
|
|
223
|
+
sage: Zx = PolynomialRing(ZZ, 'x', implementation='generic'); Zx
|
|
224
|
+
Univariate Polynomial Ring in x over Integer Ring
|
|
225
|
+
sage: Zx.element_class
|
|
226
|
+
<... 'sage.rings.polynomial.polynomial_element.Polynomial_generic_dense'>
|
|
227
|
+
|
|
228
|
+
**2. PolynomialRing(base_ring, names, ...)**
|
|
229
|
+
|
|
230
|
+
::
|
|
231
|
+
|
|
232
|
+
sage: R = PolynomialRing(QQ, 'a,b,c'); R
|
|
233
|
+
Multivariate Polynomial Ring in a, b, c over Rational Field
|
|
234
|
+
|
|
235
|
+
sage: S = PolynomialRing(QQ, ['a','b','c']); S
|
|
236
|
+
Multivariate Polynomial Ring in a, b, c over Rational Field
|
|
237
|
+
|
|
238
|
+
sage: T = PolynomialRing(QQ, ('a','b','c')); T
|
|
239
|
+
Multivariate Polynomial Ring in a, b, c over Rational Field
|
|
240
|
+
|
|
241
|
+
All three rings are identical::
|
|
242
|
+
|
|
243
|
+
sage: R is S
|
|
244
|
+
True
|
|
245
|
+
sage: S is T
|
|
246
|
+
True
|
|
247
|
+
|
|
248
|
+
There is a unique polynomial ring with each term order::
|
|
249
|
+
|
|
250
|
+
sage: R = PolynomialRing(QQ, 'x,y,z', order='degrevlex'); R
|
|
251
|
+
Multivariate Polynomial Ring in x, y, z over Rational Field
|
|
252
|
+
sage: S = PolynomialRing(QQ, 'x,y,z', order='invlex'); S
|
|
253
|
+
Multivariate Polynomial Ring in x, y, z over Rational Field
|
|
254
|
+
sage: S is PolynomialRing(QQ, 'x,y,z', order='invlex')
|
|
255
|
+
True
|
|
256
|
+
sage: R == S
|
|
257
|
+
False
|
|
258
|
+
|
|
259
|
+
Note that a univariate polynomial ring is returned, if the list
|
|
260
|
+
of names is of length one. If it is of length zero, a multivariate
|
|
261
|
+
polynomial ring with no variables is returned.
|
|
262
|
+
|
|
263
|
+
::
|
|
264
|
+
|
|
265
|
+
sage: PolynomialRing(QQ,["x"])
|
|
266
|
+
Univariate Polynomial Ring in x over Rational Field
|
|
267
|
+
sage: PolynomialRing(QQ,[])
|
|
268
|
+
Multivariate Polynomial Ring in no variables over Rational Field
|
|
269
|
+
|
|
270
|
+
The Singular implementation always returns a multivariate ring,
|
|
271
|
+
even for 1 variable::
|
|
272
|
+
|
|
273
|
+
sage: PolynomialRing(QQ, "x", implementation='singular') # needs sage.libs.singular
|
|
274
|
+
Multivariate Polynomial Ring in x over Rational Field
|
|
275
|
+
sage: P.<x> = PolynomialRing(QQ, implementation='singular'); P # needs sage.libs.singular
|
|
276
|
+
Multivariate Polynomial Ring in x over Rational Field
|
|
277
|
+
|
|
278
|
+
**3. PolynomialRing(base_ring, n, names, ...)** (where the arguments
|
|
279
|
+
``n`` and ``names`` may be reversed)
|
|
280
|
+
|
|
281
|
+
If you specify a single name as a string and a number of
|
|
282
|
+
variables, then variables labeled with numbers are created.
|
|
283
|
+
|
|
284
|
+
::
|
|
285
|
+
|
|
286
|
+
sage: PolynomialRing(QQ, 'x', 10)
|
|
287
|
+
Multivariate Polynomial Ring in x0, x1, x2, x3, x4, x5, x6, x7, x8, x9 over Rational Field
|
|
288
|
+
|
|
289
|
+
sage: PolynomialRing(QQ, 2, 'alpha0')
|
|
290
|
+
Multivariate Polynomial Ring in alpha00, alpha01 over Rational Field
|
|
291
|
+
|
|
292
|
+
sage: PolynomialRing(GF(7), 'y', 5)
|
|
293
|
+
Multivariate Polynomial Ring in y0, y1, y2, y3, y4 over Finite Field of size 7
|
|
294
|
+
|
|
295
|
+
sage: PolynomialRing(QQ, 'y', 3, sparse=True)
|
|
296
|
+
Multivariate Polynomial Ring in y0, y1, y2 over Rational Field
|
|
297
|
+
|
|
298
|
+
Note that a multivariate polynomial ring is returned when an
|
|
299
|
+
explicit number is given.
|
|
300
|
+
|
|
301
|
+
::
|
|
302
|
+
|
|
303
|
+
sage: PolynomialRing(QQ,"x",1)
|
|
304
|
+
Multivariate Polynomial Ring in x over Rational Field
|
|
305
|
+
sage: PolynomialRing(QQ,"x",0)
|
|
306
|
+
Multivariate Polynomial Ring in no variables over Rational Field
|
|
307
|
+
|
|
308
|
+
It is easy in Python to create fairly arbitrary variable names. For
|
|
309
|
+
example, here is a ring with generators labeled by the primes less
|
|
310
|
+
than 100::
|
|
311
|
+
|
|
312
|
+
sage: R = PolynomialRing(ZZ, ['x%s'%p for p in primes(100)]); R # needs sage.libs.pari
|
|
313
|
+
Multivariate Polynomial Ring in x2, x3, x5, x7, x11, x13, x17, x19, x23, x29,
|
|
314
|
+
x31, x37, x41, x43, x47, x53, x59, x61, x67, x71, x73, x79, x83, x89, x97
|
|
315
|
+
over Integer Ring
|
|
316
|
+
|
|
317
|
+
By calling the
|
|
318
|
+
:meth:`~sage.structure.category_object.CategoryObject.inject_variables`
|
|
319
|
+
method, all those variable names are available for interactive use::
|
|
320
|
+
|
|
321
|
+
sage: R.inject_variables() # needs sage.libs.pari
|
|
322
|
+
Defining x2, x3, x5, x7, x11, x13, x17, x19, x23, x29, x31, x37, x41, x43,
|
|
323
|
+
x47, x53, x59, x61, x67, x71, x73, x79, x83, x89, x97
|
|
324
|
+
sage: (x2 + x41 + x71)^2 # needs sage.libs.pari
|
|
325
|
+
x2^2 + 2*x2*x41 + x41^2 + 2*x2*x71 + 2*x41*x71 + x71^2
|
|
326
|
+
|
|
327
|
+
**4. PolynomialRing(base_ring, n, ..., var_array=var_array, ...)**
|
|
328
|
+
|
|
329
|
+
This creates an array of variables where each variables begins with an
|
|
330
|
+
entry in ``var_array`` and is indexed from 0 to `n-1`. ::
|
|
331
|
+
|
|
332
|
+
sage: PolynomialRing(ZZ, 3, var_array=['x','y'])
|
|
333
|
+
Multivariate Polynomial Ring in x0, y0, x1, y1, x2, y2 over Integer Ring
|
|
334
|
+
sage: PolynomialRing(ZZ, 3, var_array='a,b')
|
|
335
|
+
Multivariate Polynomial Ring in a0, b0, a1, b1, a2, b2 over Integer Ring
|
|
336
|
+
|
|
337
|
+
It is possible to create higher-dimensional arrays::
|
|
338
|
+
|
|
339
|
+
sage: PolynomialRing(ZZ, 2, 3, var_array=('p', 'q'))
|
|
340
|
+
Multivariate Polynomial Ring
|
|
341
|
+
in p00, q00, p01, q01, p02, q02, p10, q10, p11, q11, p12, q12
|
|
342
|
+
over Integer Ring
|
|
343
|
+
sage: PolynomialRing(ZZ, 2, 3, 4, var_array='m')
|
|
344
|
+
Multivariate Polynomial Ring in m000, m001, m002, m003, m010, m011,
|
|
345
|
+
m012, m013, m020, m021, m022, m023, m100, m101, m102, m103, m110,
|
|
346
|
+
m111, m112, m113, m120, m121, m122, m123 over Integer Ring
|
|
347
|
+
|
|
348
|
+
The array is always at least 2-dimensional. So, if
|
|
349
|
+
``var_array`` is a single string and only a single number `n`
|
|
350
|
+
is given, this creates an `n \times n` array of variables::
|
|
351
|
+
|
|
352
|
+
sage: PolynomialRing(ZZ, 2, var_array='m')
|
|
353
|
+
Multivariate Polynomial Ring in m00, m01, m10, m11 over Integer Ring
|
|
354
|
+
|
|
355
|
+
**Square brackets notation**
|
|
356
|
+
|
|
357
|
+
You can alternatively create a polynomial ring over a ring `R` with
|
|
358
|
+
square brackets::
|
|
359
|
+
|
|
360
|
+
sage: # needs sage.rings.real_mpfr
|
|
361
|
+
sage: RR["x"]
|
|
362
|
+
Univariate Polynomial Ring in x over Real Field with 53 bits of precision
|
|
363
|
+
sage: RR["x,y"]
|
|
364
|
+
Multivariate Polynomial Ring in x, y over Real Field with 53 bits of precision
|
|
365
|
+
sage: P.<x,y> = RR[]; P
|
|
366
|
+
Multivariate Polynomial Ring in x, y over Real Field with 53 bits of precision
|
|
367
|
+
|
|
368
|
+
This notation does not allow to set any of the optional arguments.
|
|
369
|
+
|
|
370
|
+
**Changing variable names**
|
|
371
|
+
|
|
372
|
+
Consider ::
|
|
373
|
+
|
|
374
|
+
sage: R.<x,y> = PolynomialRing(QQ, 2); R
|
|
375
|
+
Multivariate Polynomial Ring in x, y over Rational Field
|
|
376
|
+
sage: f = x^2 - 2*y^2
|
|
377
|
+
|
|
378
|
+
You can't just globally change the names of those variables.
|
|
379
|
+
This is because objects all over Sage could have pointers to
|
|
380
|
+
that polynomial ring. ::
|
|
381
|
+
|
|
382
|
+
sage: R._assign_names(['z','w'])
|
|
383
|
+
Traceback (most recent call last):
|
|
384
|
+
...
|
|
385
|
+
ValueError: variable names cannot be changed after object creation.
|
|
386
|
+
|
|
387
|
+
However, you can very easily change the names within a ``with`` block::
|
|
388
|
+
|
|
389
|
+
sage: with localvars(R, ['z','w']):
|
|
390
|
+
....: print(f)
|
|
391
|
+
z^2 - 2*w^2
|
|
392
|
+
|
|
393
|
+
After the ``with`` block the names revert to what they were before::
|
|
394
|
+
|
|
395
|
+
sage: print(f)
|
|
396
|
+
x^2 - 2*y^2
|
|
397
|
+
|
|
398
|
+
TESTS:
|
|
399
|
+
|
|
400
|
+
We test here some changes introduced in :issue:`9944`.
|
|
401
|
+
|
|
402
|
+
If there is no dense implementation for the given number of
|
|
403
|
+
variables, then requesting a dense ring is an error::
|
|
404
|
+
|
|
405
|
+
sage: S.<x,y> = PolynomialRing(QQ, sparse=False)
|
|
406
|
+
Traceback (most recent call last):
|
|
407
|
+
...
|
|
408
|
+
NotImplementedError: a dense representation of multivariate polynomials is not supported
|
|
409
|
+
|
|
410
|
+
Check uniqueness if the same implementation is used for different
|
|
411
|
+
values of the ``'implementation'`` keyword::
|
|
412
|
+
|
|
413
|
+
sage: R = PolynomialRing(QQbar, 'j', implementation='generic') # needs sage.rings.number_field
|
|
414
|
+
sage: S = PolynomialRing(QQbar, 'j', implementation=None) # needs sage.rings.number_field
|
|
415
|
+
sage: R is S # needs sage.rings.number_field
|
|
416
|
+
True
|
|
417
|
+
|
|
418
|
+
sage: R = PolynomialRing(ZZ['t'], 'j', implementation='generic')
|
|
419
|
+
sage: S = PolynomialRing(ZZ['t'], 'j', implementation=None)
|
|
420
|
+
sage: R is S
|
|
421
|
+
True
|
|
422
|
+
|
|
423
|
+
sage: # needs sage.rings.number_field
|
|
424
|
+
sage: R = PolynomialRing(QQbar, 'j,k', implementation='generic')
|
|
425
|
+
sage: S = PolynomialRing(QQbar, 'j,k', implementation=None)
|
|
426
|
+
sage: R is S
|
|
427
|
+
True
|
|
428
|
+
|
|
429
|
+
sage: # needs sage.libs.singular
|
|
430
|
+
sage: R = PolynomialRing(ZZ, 'j,k', implementation='singular')
|
|
431
|
+
sage: S = PolynomialRing(ZZ, 'j,k', implementation=None)
|
|
432
|
+
sage: R is S
|
|
433
|
+
True
|
|
434
|
+
|
|
435
|
+
sage: R = PolynomialRing(ZZ, 'p', sparse=True, implementation='generic')
|
|
436
|
+
sage: S = PolynomialRing(ZZ, 'p', sparse=True)
|
|
437
|
+
sage: R is S
|
|
438
|
+
True
|
|
439
|
+
|
|
440
|
+
The generic implementation is different in some cases::
|
|
441
|
+
|
|
442
|
+
sage: R = PolynomialRing(GF(2), 'j', implementation='generic'); TestSuite(R).run(skip=['_test_construction', '_test_pickling']); type(R)
|
|
443
|
+
<class 'sage.rings.polynomial.polynomial_ring.PolynomialRing_field_with_category'>
|
|
444
|
+
sage: S = PolynomialRing(GF(2), 'j'); TestSuite(S).run(); type(S)
|
|
445
|
+
<class 'sage.rings.polynomial.polynomial_ring.PolynomialRing_dense_mod_p_with_category'>
|
|
446
|
+
|
|
447
|
+
sage: R = PolynomialRing(ZZ, 'x,y', implementation='generic'); TestSuite(R).run(skip=['_test_elements', '_test_elements_eq_transitive']); type(R)
|
|
448
|
+
<class 'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_domain_with_category'>
|
|
449
|
+
sage: S = PolynomialRing(ZZ, 'x,y'); TestSuite(S).run(skip='_test_elements'); type(S) # needs sage.libs.singular
|
|
450
|
+
<class 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomialRing_libsingular'>
|
|
451
|
+
|
|
452
|
+
Sparse univariate polynomials only support a generic
|
|
453
|
+
implementation::
|
|
454
|
+
|
|
455
|
+
sage: R = PolynomialRing(ZZ, 'j', sparse=True); TestSuite(R).run(); type(R)
|
|
456
|
+
<class 'sage.rings.polynomial.polynomial_ring.PolynomialRing_integral_domain_with_category'>
|
|
457
|
+
sage: R = PolynomialRing(GF(49), 'j', sparse=True); TestSuite(R).run(); type(R) # needs sage.rings.finite_rings
|
|
458
|
+
<class 'sage.rings.polynomial.polynomial_ring.PolynomialRing_field_with_category'>
|
|
459
|
+
|
|
460
|
+
If the requested implementation is not known or not supported for
|
|
461
|
+
the given arguments, then an error results::
|
|
462
|
+
|
|
463
|
+
sage: R.<x0> = PolynomialRing(ZZ, implementation='Foo')
|
|
464
|
+
Traceback (most recent call last):
|
|
465
|
+
...
|
|
466
|
+
ValueError: unknown implementation 'Foo' for dense polynomial rings over Integer Ring
|
|
467
|
+
sage: R.<x0> = PolynomialRing(GF(2), implementation='GF2X', sparse=True)
|
|
468
|
+
Traceback (most recent call last):
|
|
469
|
+
...
|
|
470
|
+
ValueError: unknown implementation 'GF2X' for sparse polynomial rings over Finite Field of size 2
|
|
471
|
+
sage: R.<x,y> = PolynomialRing(ZZ, implementation='FLINT')
|
|
472
|
+
Traceback (most recent call last):
|
|
473
|
+
...
|
|
474
|
+
ValueError: unknown implementation 'FLINT' for multivariate polynomial rings
|
|
475
|
+
sage: R.<x> = PolynomialRing(QQbar, implementation='whatever') # needs sage.rings.number_field
|
|
476
|
+
Traceback (most recent call last):
|
|
477
|
+
...
|
|
478
|
+
ValueError: unknown implementation 'whatever' for dense polynomial rings over Algebraic Field
|
|
479
|
+
sage: R.<x> = PolynomialRing(ZZ['t'], implementation='whatever')
|
|
480
|
+
Traceback (most recent call last):
|
|
481
|
+
...
|
|
482
|
+
ValueError: unknown implementation 'whatever' for dense polynomial rings over Univariate Polynomial Ring in t over Integer Ring
|
|
483
|
+
sage: PolynomialRing(RR, "x,y", implementation='whatever')
|
|
484
|
+
Traceback (most recent call last):
|
|
485
|
+
...
|
|
486
|
+
ValueError: unknown implementation 'whatever' for multivariate polynomial rings
|
|
487
|
+
sage: PolynomialRing(RR, name='x', implementation='singular') # needs sage.libs.singular
|
|
488
|
+
Traceback (most recent call last):
|
|
489
|
+
...
|
|
490
|
+
NotImplementedError: polynomials over Real Field with 53 bits of precision are not supported in Singular
|
|
491
|
+
|
|
492
|
+
The following corner case used to result in a warning message from
|
|
493
|
+
``libSingular``, and the generators of the resulting polynomial
|
|
494
|
+
ring were not zero::
|
|
495
|
+
|
|
496
|
+
sage: R = Integers(1)['x','y']
|
|
497
|
+
sage: R.0 == 0
|
|
498
|
+
True
|
|
499
|
+
|
|
500
|
+
We verify that :issue:`13187` is fixed::
|
|
501
|
+
|
|
502
|
+
sage: var('t') # needs sage.symbolic
|
|
503
|
+
t
|
|
504
|
+
sage: PolynomialRing(ZZ, name=t) == PolynomialRing(ZZ, name='t') # needs sage.symbolic
|
|
505
|
+
True
|
|
506
|
+
|
|
507
|
+
We verify that polynomials with interval coefficients from
|
|
508
|
+
:issue:`7712` and :issue:`13760` are fixed::
|
|
509
|
+
|
|
510
|
+
sage: # needs sage.rings.real_interval_field
|
|
511
|
+
sage: P.<y,z> = PolynomialRing(RealIntervalField(2))
|
|
512
|
+
sage: TestSuite(P).run(skip=['_test_elements', '_test_elements_eq_transitive'])
|
|
513
|
+
sage: Q.<x> = PolynomialRing(P)
|
|
514
|
+
sage: TestSuite(Q).run(skip=['_test_additive_associativity', '_test_associativity',
|
|
515
|
+
....: '_test_distributivity', '_test_prod'])
|
|
516
|
+
sage: C = (y-x)^3
|
|
517
|
+
sage: C(y/2)
|
|
518
|
+
1.?*y^3
|
|
519
|
+
sage: R.<x,y> = PolynomialRing(RIF,2)
|
|
520
|
+
sage: TestSuite(R).run(skip=['_test_elements', '_test_elements_eq_transitive'])
|
|
521
|
+
sage: RIF(-2,1)*x
|
|
522
|
+
0.?e1*x
|
|
523
|
+
|
|
524
|
+
For historical reasons, we allow redundant variable names with the
|
|
525
|
+
angle bracket notation. The names must be consistent though! ::
|
|
526
|
+
|
|
527
|
+
sage: P.<x,y> = PolynomialRing(ZZ, "x,y"); P
|
|
528
|
+
Multivariate Polynomial Ring in x, y over Integer Ring
|
|
529
|
+
sage: P.<x,y> = ZZ["x,y"]; P
|
|
530
|
+
Multivariate Polynomial Ring in x, y over Integer Ring
|
|
531
|
+
sage: P.<x,y> = PolynomialRing(ZZ, 2, "x"); P
|
|
532
|
+
Traceback (most recent call last):
|
|
533
|
+
...
|
|
534
|
+
TypeError: variable names specified twice inconsistently: ('x0', 'x1') and ('x', 'y')
|
|
535
|
+
|
|
536
|
+
We test a lot of invalid input::
|
|
537
|
+
|
|
538
|
+
sage: PolynomialRing(4)
|
|
539
|
+
Traceback (most recent call last):
|
|
540
|
+
...
|
|
541
|
+
TypeError: base_ring 4 must be a ring or the tropical semiring
|
|
542
|
+
sage: PolynomialRing(QQ, -1)
|
|
543
|
+
Traceback (most recent call last):
|
|
544
|
+
...
|
|
545
|
+
ValueError: number of variables must be nonnegative
|
|
546
|
+
sage: PolynomialRing(QQ, 1)
|
|
547
|
+
Traceback (most recent call last):
|
|
548
|
+
...
|
|
549
|
+
TypeError: you must specify the names of the variables
|
|
550
|
+
sage: PolynomialRing(QQ, 'x', None)
|
|
551
|
+
Traceback (most recent call last):
|
|
552
|
+
...
|
|
553
|
+
TypeError: invalid arguments ('x', None) for PolynomialRing
|
|
554
|
+
sage: PolynomialRing(QQ, 'x', 'y')
|
|
555
|
+
Traceback (most recent call last):
|
|
556
|
+
...
|
|
557
|
+
TypeError: variable names specified twice: 'x' and 'y'
|
|
558
|
+
sage: PolynomialRing(QQ, 1, 'x', 2)
|
|
559
|
+
Traceback (most recent call last):
|
|
560
|
+
...
|
|
561
|
+
TypeError: number of variables specified twice: 1 and 2
|
|
562
|
+
sage: PolynomialRing(QQ, 'x', names='x')
|
|
563
|
+
Traceback (most recent call last):
|
|
564
|
+
...
|
|
565
|
+
TypeError: variable names specified twice inconsistently: ('x',) and 'x'
|
|
566
|
+
sage: PolynomialRing(QQ, name='x', names='x')
|
|
567
|
+
Traceback (most recent call last):
|
|
568
|
+
...
|
|
569
|
+
TypeError: keyword argument 'name' cannot be combined with 'names'
|
|
570
|
+
sage: PolynomialRing(QQ, var_array='x')
|
|
571
|
+
Traceback (most recent call last):
|
|
572
|
+
...
|
|
573
|
+
TypeError: you must specify the number of the variables
|
|
574
|
+
sage: PolynomialRing(QQ, 2, 'x', var_array='x')
|
|
575
|
+
Traceback (most recent call last):
|
|
576
|
+
...
|
|
577
|
+
TypeError: unable to convert 'x' to an integer
|
|
578
|
+
|
|
579
|
+
We run the testsuite for various polynomial rings, skipping tests that currently fail::
|
|
580
|
+
|
|
581
|
+
sage: R.<w> = PolynomialRing(PolynomialRing(GF(7),'k')); TestSuite(R).run(); R
|
|
582
|
+
Univariate Polynomial Ring in w over Univariate Polynomial Ring in k over Finite Field of size 7
|
|
583
|
+
sage: ZxNTL = PolynomialRing(ZZ, 'x', implementation='NTL'); TestSuite(ZxNTL).run(skip='_test_pickling'); ZxNTL # needs sage.libs.ntl
|
|
584
|
+
Univariate Polynomial Ring in x over Integer Ring (using NTL)
|
|
585
|
+
sage: ZxFLINT = PolynomialRing(ZZ, 'x', implementation='FLINT'); TestSuite(ZxFLINT).run(); ZxFLINT
|
|
586
|
+
Univariate Polynomial Ring in x over Integer Ring
|
|
587
|
+
sage: Zx = PolynomialRing(ZZ, 'x', implementation='generic'); TestSuite(Zx).run(skip=['_test_construction', '_test_pickling']); Zx
|
|
588
|
+
Univariate Polynomial Ring in x over Integer Ring
|
|
589
|
+
sage: R = PolynomialRing(QQ, 'a,b,c'); TestSuite(R).run(skip='_test_elements'); R
|
|
590
|
+
Multivariate Polynomial Ring in a, b, c over Rational Field
|
|
591
|
+
sage: R = PolynomialRing(QQ, 'x,y,z', order='degrevlex'); TestSuite(R).run(skip='_test_elements'); R
|
|
592
|
+
Multivariate Polynomial Ring in x, y, z over Rational Field
|
|
593
|
+
sage: S = PolynomialRing(QQ, 'x,y,z', order='invlex'); TestSuite(S).run(skip=['_test_construction', '_test_elements']); S
|
|
594
|
+
Multivariate Polynomial Ring in x, y, z over Rational Field
|
|
595
|
+
sage: Q0 = PolynomialRing(QQ,[]); TestSuite(Q0).run(skip=['_test_elements', '_test_elements_eq_transitive', '_test_gcd_vs_xgcd', '_test_quo_rem']); Q0
|
|
596
|
+
Multivariate Polynomial Ring in no variables over Rational Field
|
|
597
|
+
sage: P.<x> = PolynomialRing(QQ, implementation='singular'); TestSuite(P).run(skip=['_test_construction', '_test_elements', # needs sage.libs.singular
|
|
598
|
+
....: '_test_euclidean_degree', '_test_quo_rem']); P
|
|
599
|
+
Multivariate Polynomial Ring in x over Rational Field
|
|
600
|
+
sage: Q1 = PolynomialRing(QQ,"x",1); TestSuite(Q1).run(skip=['_test_construction', '_test_elements', '_test_euclidean_degree', '_test_quo_rem']); Q1
|
|
601
|
+
Multivariate Polynomial Ring in x over Rational Field
|
|
602
|
+
sage: Q0 = PolynomialRing(QQ,"x",0); TestSuite(Q0).run(skip=['_test_elements', '_test_elements_eq_transitive', '_test_gcd_vs_xgcd', '_test_quo_rem']); Q0
|
|
603
|
+
Multivariate Polynomial Ring in no variables over Rational Field
|
|
604
|
+
sage: R = PolynomialRing(GF(2), 'j', implementation='generic'); TestSuite(R).run(skip=['_test_construction', '_test_pickling']); type(R)
|
|
605
|
+
<class 'sage.rings.polynomial.polynomial_ring.PolynomialRing_field_with_category'>
|
|
606
|
+
sage: S = PolynomialRing(GF(2), 'j'); TestSuite(S).run(); type(S)
|
|
607
|
+
<class 'sage.rings.polynomial.polynomial_ring.PolynomialRing_dense_mod_p_with_category'>
|
|
608
|
+
sage: R = PolynomialRing(ZZ, 'x,y', implementation='generic'); TestSuite(R).run(skip=['_test_elements', '_test_elements_eq_transitive']); type(R)
|
|
609
|
+
<class 'sage.rings.polynomial.multi_polynomial_ring.MPolynomialRing_polydict_domain_with_category'>
|
|
610
|
+
sage: S = PolynomialRing(ZZ, 'x,y'); TestSuite(S).run(skip='_test_elements'); type(S) # needs sage.libs.singular
|
|
611
|
+
<class 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomialRing_libsingular'>
|
|
612
|
+
sage: R = PolynomialRing(ZZ, 'j', sparse=True); TestSuite(R).run(); type(R)
|
|
613
|
+
<class 'sage.rings.polynomial.polynomial_ring.PolynomialRing_integral_domain_with_category'>
|
|
614
|
+
sage: R = PolynomialRing(GF(49), 'j', sparse=True); TestSuite(R).run(); type(R) # needs sage.rings.finite_rings
|
|
615
|
+
<class 'sage.rings.polynomial.polynomial_ring.PolynomialRing_field_with_category'>
|
|
616
|
+
|
|
617
|
+
sage: # needs sage.rings.real_interval_field
|
|
618
|
+
sage: P.<y,z> = PolynomialRing(RealIntervalField(2))
|
|
619
|
+
sage: TestSuite(P).run(skip=['_test_elements', '_test_elements_eq_transitive'])
|
|
620
|
+
sage: Q.<x> = PolynomialRing(P)
|
|
621
|
+
sage: TestSuite(Q).run(skip=['_test_additive_associativity', '_test_associativity',
|
|
622
|
+
....: '_test_distributivity', '_test_prod'])
|
|
623
|
+
sage: R.<x,y> = PolynomialRing(RIF,2)
|
|
624
|
+
sage: TestSuite(R).run(skip=['_test_elements', '_test_elements_eq_transitive'])
|
|
625
|
+
|
|
626
|
+
We verify that multivariate polynomial rings over ``InfinityRing`` from
|
|
627
|
+
:issue:`34675` are fixed::
|
|
628
|
+
|
|
629
|
+
sage: PolynomialRing(InfinityRing, 2, 'x')
|
|
630
|
+
Multivariate Polynomial Ring in x0, x1 over The Infinity Ring
|
|
631
|
+
"""
|
|
632
|
+
from sage.rings.semirings.tropical_semiring import TropicalSemiring
|
|
633
|
+
if base_ring not in Rings() and not isinstance(base_ring, TropicalSemiring):
|
|
634
|
+
raise TypeError("base_ring {!r} must be a ring or the tropical semiring".format(base_ring))
|
|
635
|
+
|
|
636
|
+
n = -1 # Unknown number of variables
|
|
637
|
+
names = None # Unknown variable names
|
|
638
|
+
|
|
639
|
+
# Use a single-variate ring by default unless the "singular"
|
|
640
|
+
# implementation is asked.
|
|
641
|
+
multivariate = kwds.get("implementation") == "singular"
|
|
642
|
+
|
|
643
|
+
# Check specifically for None because it is an easy mistake to
|
|
644
|
+
# make and Integer(None) returns 0, so we wouldn't catch this
|
|
645
|
+
# otherwise.
|
|
646
|
+
if any(arg is None for arg in args):
|
|
647
|
+
raise TypeError("invalid arguments {!r} for PolynomialRing".format(args))
|
|
648
|
+
|
|
649
|
+
if "var_array" in kwds:
|
|
650
|
+
for forbidden in "name", "names":
|
|
651
|
+
if forbidden in kwds:
|
|
652
|
+
raise TypeError("keyword argument '%s' cannot be combined with 'var_array'" % forbidden)
|
|
653
|
+
|
|
654
|
+
names = kwds.pop("var_array")
|
|
655
|
+
if isinstance(names, (tuple, list)):
|
|
656
|
+
# Input is a 1-dimensional array
|
|
657
|
+
dim = 1
|
|
658
|
+
else:
|
|
659
|
+
# Input is a 0-dimensional (if a single string was given)
|
|
660
|
+
# or a 1-dimensional array
|
|
661
|
+
names = normalize_names(-1, names)
|
|
662
|
+
dim = len(names) > 1
|
|
663
|
+
multivariate = True
|
|
664
|
+
|
|
665
|
+
if not args:
|
|
666
|
+
raise TypeError("you must specify the number of the variables")
|
|
667
|
+
# The total dimension must be at least 2
|
|
668
|
+
if len(args) == 1 and not dim:
|
|
669
|
+
args = [args[0], args[0]]
|
|
670
|
+
|
|
671
|
+
# All arguments in *args should be a number of variables
|
|
672
|
+
suffixes = [""]
|
|
673
|
+
for arg in args:
|
|
674
|
+
k = Integer(arg)
|
|
675
|
+
if k < 0:
|
|
676
|
+
raise ValueError("number of variables must be nonnegative")
|
|
677
|
+
suffixes = [s + str(i) for s in suffixes for i in range(k)]
|
|
678
|
+
names = [v + s for s in suffixes for v in names]
|
|
679
|
+
else: # No "var_array" keyword
|
|
680
|
+
if "name" in kwds:
|
|
681
|
+
if "names" in kwds:
|
|
682
|
+
raise TypeError("keyword argument 'name' cannot be combined with 'names'")
|
|
683
|
+
names = [kwds.pop("name")]
|
|
684
|
+
|
|
685
|
+
# Interpret remaining arguments in *args as either a number of
|
|
686
|
+
# variables or as variable names
|
|
687
|
+
for arg in args:
|
|
688
|
+
try:
|
|
689
|
+
k = Integer(arg)
|
|
690
|
+
except TypeError:
|
|
691
|
+
# Interpret arg as names
|
|
692
|
+
if names is not None:
|
|
693
|
+
raise TypeError("variable names specified twice: %r and %r" % (names, arg))
|
|
694
|
+
names = arg
|
|
695
|
+
else:
|
|
696
|
+
# Interpret arg as number of variables
|
|
697
|
+
if n >= 0:
|
|
698
|
+
raise TypeError("number of variables specified twice: %r and %r" % (n, arg))
|
|
699
|
+
if k < 0:
|
|
700
|
+
raise ValueError("number of variables must be nonnegative")
|
|
701
|
+
n = k
|
|
702
|
+
# If number of variables was explicitly given, always
|
|
703
|
+
# return a multivariate ring
|
|
704
|
+
multivariate = True
|
|
705
|
+
|
|
706
|
+
if names is None:
|
|
707
|
+
try:
|
|
708
|
+
names = kwds.pop("names")
|
|
709
|
+
except KeyError:
|
|
710
|
+
raise TypeError("you must specify the names of the variables")
|
|
711
|
+
|
|
712
|
+
names = normalize_names(n, names)
|
|
713
|
+
|
|
714
|
+
# At this point, we have only handled the "names" keyword if it was
|
|
715
|
+
# needed. Since we know the variable names, it would logically be
|
|
716
|
+
# an error to specify an additional "names" keyword. However,
|
|
717
|
+
# people often abuse the preparser with
|
|
718
|
+
# R.<x> = PolynomialRing(QQ, 'x')
|
|
719
|
+
# and we allow this for historical reasons. However, the names
|
|
720
|
+
# must be consistent!
|
|
721
|
+
if "names" in kwds:
|
|
722
|
+
kwnames = kwds.pop("names")
|
|
723
|
+
if kwnames != names:
|
|
724
|
+
raise TypeError("variable names specified twice inconsistently: %r and %r" % (names, kwnames))
|
|
725
|
+
|
|
726
|
+
if multivariate or len(names) != 1:
|
|
727
|
+
return _multi_variate(base_ring, names, **kwds)
|
|
728
|
+
else:
|
|
729
|
+
return _single_variate(base_ring, names, **kwds)
|
|
730
|
+
|
|
731
|
+
|
|
732
|
+
def unpickle_PolynomialRing(base_ring, arg1=None, arg2=None, sparse=False):
|
|
733
|
+
"""
|
|
734
|
+
Custom unpickling function for polynomial rings.
|
|
735
|
+
|
|
736
|
+
This has the same positional arguments as the old
|
|
737
|
+
``PolynomialRing`` constructor before :issue:`23338`.
|
|
738
|
+
"""
|
|
739
|
+
args = [arg for arg in (arg1, arg2) if arg is not None]
|
|
740
|
+
return PolynomialRing(base_ring, *args, sparse=sparse)
|
|
741
|
+
|
|
742
|
+
|
|
743
|
+
from sage.misc.persist import register_unpickle_override
|
|
744
|
+
register_unpickle_override('sage.rings.polynomial.polynomial_ring_constructor', 'PolynomialRing', unpickle_PolynomialRing)
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
def _get_from_cache(key):
|
|
748
|
+
key = tuple(key)
|
|
749
|
+
return _cache.get(key)
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
def _save_in_cache(key, R):
|
|
753
|
+
key = tuple(key)
|
|
754
|
+
_cache[key] = R
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
def _single_variate(base_ring, name, sparse=None, implementation=None, order=None):
|
|
758
|
+
# The "order" argument is unused, but we allow it (and ignore it)
|
|
759
|
+
# for consistency with the multi-variate case.
|
|
760
|
+
sparse = bool(sparse)
|
|
761
|
+
|
|
762
|
+
# "implementation" must be last
|
|
763
|
+
key = [base_ring, name, sparse, implementation]
|
|
764
|
+
R = _get_from_cache(key)
|
|
765
|
+
if R is not None:
|
|
766
|
+
return R
|
|
767
|
+
|
|
768
|
+
from . import polynomial_ring
|
|
769
|
+
|
|
770
|
+
# Find the right constructor and **kwds for our polynomial ring
|
|
771
|
+
constructor = None
|
|
772
|
+
kwds = {}
|
|
773
|
+
if sparse:
|
|
774
|
+
kwds["sparse"] = True
|
|
775
|
+
|
|
776
|
+
# Specialized implementations
|
|
777
|
+
specialized = None
|
|
778
|
+
if isinstance(base_ring, sage.rings.abc.IntegerModRing):
|
|
779
|
+
n = base_ring.order()
|
|
780
|
+
if n.is_prime():
|
|
781
|
+
specialized = polynomial_ring.PolynomialRing_dense_mod_p
|
|
782
|
+
elif n > 1: # Specialized code breaks for n == 1
|
|
783
|
+
specialized = polynomial_ring.PolynomialRing_dense_mod_n
|
|
784
|
+
elif isinstance(base_ring, FiniteField):
|
|
785
|
+
specialized = polynomial_ring.PolynomialRing_dense_finite_field
|
|
786
|
+
elif isinstance(base_ring, padic_base_leaves.pAdicFieldCappedRelative):
|
|
787
|
+
specialized = polynomial_ring.PolynomialRing_dense_padic_field_capped_relative
|
|
788
|
+
elif isinstance(base_ring, padic_base_leaves.pAdicRingCappedRelative):
|
|
789
|
+
specialized = polynomial_ring.PolynomialRing_dense_padic_ring_capped_relative
|
|
790
|
+
elif isinstance(base_ring, padic_base_leaves.pAdicRingCappedAbsolute):
|
|
791
|
+
specialized = polynomial_ring.PolynomialRing_dense_padic_ring_capped_absolute
|
|
792
|
+
elif isinstance(base_ring, padic_base_leaves.pAdicRingFixedMod):
|
|
793
|
+
specialized = polynomial_ring.PolynomialRing_dense_padic_ring_fixed_mod
|
|
794
|
+
|
|
795
|
+
# If the implementation is supported, then we are done
|
|
796
|
+
if specialized is not None:
|
|
797
|
+
implementation_names = specialized._implementation_names_impl(implementation, base_ring, sparse)
|
|
798
|
+
if implementation_names is not NotImplemented:
|
|
799
|
+
constructor = specialized
|
|
800
|
+
|
|
801
|
+
# Generic implementations
|
|
802
|
+
if constructor is None:
|
|
803
|
+
from sage.rings.semirings.tropical_semiring import TropicalSemiring
|
|
804
|
+
if isinstance(base_ring, TropicalSemiring):
|
|
805
|
+
from sage.rings.semirings.tropical_polynomial import TropicalPolynomialSemiring
|
|
806
|
+
constructor = TropicalPolynomialSemiring
|
|
807
|
+
elif base_ring not in _CommutativeRings:
|
|
808
|
+
constructor = polynomial_ring.PolynomialRing_generic
|
|
809
|
+
elif base_ring in _CompleteDiscreteValuationRings:
|
|
810
|
+
constructor = polynomial_ring.PolynomialRing_cdvr
|
|
811
|
+
elif base_ring in _CompleteDiscreteValuationFields:
|
|
812
|
+
constructor = polynomial_ring.PolynomialRing_cdvf
|
|
813
|
+
elif base_ring in _Fields:
|
|
814
|
+
constructor = polynomial_ring.PolynomialRing_field
|
|
815
|
+
elif base_ring in _Domains:
|
|
816
|
+
constructor = polynomial_ring.PolynomialRing_integral_domain
|
|
817
|
+
else:
|
|
818
|
+
constructor = polynomial_ring.PolynomialRing_commutative
|
|
819
|
+
|
|
820
|
+
implementation_names = constructor._implementation_names(implementation, base_ring, sparse)
|
|
821
|
+
|
|
822
|
+
# Only use names which are not supported by the specialized class.
|
|
823
|
+
if specialized is not None:
|
|
824
|
+
implementation_names = [n for n in implementation_names
|
|
825
|
+
if specialized._implementation_names_impl(n, base_ring, sparse) is NotImplemented]
|
|
826
|
+
|
|
827
|
+
if implementation is not None:
|
|
828
|
+
kwds["implementation"] = implementation
|
|
829
|
+
R = constructor(base_ring, name, **kwds)
|
|
830
|
+
|
|
831
|
+
for impl in implementation_names:
|
|
832
|
+
key[-1] = impl
|
|
833
|
+
_save_in_cache(key, R)
|
|
834
|
+
|
|
835
|
+
return R
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
def _multi_variate(base_ring, names, sparse=None, order='degrevlex', implementation=None):
|
|
839
|
+
if sparse is None:
|
|
840
|
+
sparse = True
|
|
841
|
+
if not sparse:
|
|
842
|
+
raise NotImplementedError("a dense representation of multivariate polynomials is not supported")
|
|
843
|
+
|
|
844
|
+
from sage.rings.polynomial.term_order import TermOrder
|
|
845
|
+
n = len(names)
|
|
846
|
+
order = TermOrder(order, n)
|
|
847
|
+
|
|
848
|
+
# "implementation" must be last
|
|
849
|
+
key = [base_ring, names, n, order, implementation]
|
|
850
|
+
R = _get_from_cache(key)
|
|
851
|
+
if R is not None:
|
|
852
|
+
return R
|
|
853
|
+
|
|
854
|
+
# Multiple arguments for the "implementation" keyword which actually
|
|
855
|
+
# yield the same implementation. We need this for caching.
|
|
856
|
+
implementation_names = set([implementation])
|
|
857
|
+
|
|
858
|
+
if implementation is None or implementation == "singular":
|
|
859
|
+
try:
|
|
860
|
+
from sage.rings.polynomial.multi_polynomial_libsingular import MPolynomialRing_libsingular
|
|
861
|
+
R = MPolynomialRing_libsingular(base_ring, n, names, order)
|
|
862
|
+
except (ImportError, TypeError, NotImplementedError):
|
|
863
|
+
if implementation is not None:
|
|
864
|
+
raise
|
|
865
|
+
else:
|
|
866
|
+
implementation_names.update([None, "singular"])
|
|
867
|
+
|
|
868
|
+
if R is None and implementation is None:
|
|
869
|
+
# Interpret implementation=None as implementation="generic"
|
|
870
|
+
implementation = "generic"
|
|
871
|
+
implementation_names.add(implementation)
|
|
872
|
+
key[-1] = implementation
|
|
873
|
+
R = _get_from_cache(key)
|
|
874
|
+
|
|
875
|
+
if R is None and implementation == "generic":
|
|
876
|
+
from . import multi_polynomial_ring
|
|
877
|
+
from sage.rings.semirings.tropical_semiring import TropicalSemiring
|
|
878
|
+
if isinstance(base_ring, TropicalSemiring):
|
|
879
|
+
from sage.rings.semirings.tropical_mpolynomial import TropicalMPolynomialSemiring
|
|
880
|
+
constructor = TropicalMPolynomialSemiring
|
|
881
|
+
elif base_ring in _Domains:
|
|
882
|
+
constructor = multi_polynomial_ring.MPolynomialRing_polydict_domain
|
|
883
|
+
else:
|
|
884
|
+
constructor = multi_polynomial_ring.MPolynomialRing_polydict
|
|
885
|
+
R = constructor(base_ring, n, names, order)
|
|
886
|
+
|
|
887
|
+
if R is None:
|
|
888
|
+
raise ValueError("unknown implementation %r for multivariate polynomial rings" % (implementation,))
|
|
889
|
+
|
|
890
|
+
for impl in implementation_names:
|
|
891
|
+
key[-1] = impl
|
|
892
|
+
_save_in_cache(key, R)
|
|
893
|
+
|
|
894
|
+
return R
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
#########################################################
|
|
898
|
+
# Choice of a category
|
|
899
|
+
from sage import categories
|
|
900
|
+
from sage.categories.algebras import Algebras
|
|
901
|
+
# Some fixed categories, in order to avoid the function call overhead
|
|
902
|
+
_FiniteSets = categories.sets_cat.Sets().Finite()
|
|
903
|
+
_InfiniteSets = categories.sets_cat.Sets().Infinite()
|
|
904
|
+
_EuclideanDomains = categories.euclidean_domains.EuclideanDomains()
|
|
905
|
+
_UniqueFactorizationDomains = categories.unique_factorization_domains.UniqueFactorizationDomains()
|
|
906
|
+
_IntegralDomains = categories.integral_domains.IntegralDomains()
|
|
907
|
+
_Rings = categories.rings.Rings()
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
@weak_cached_function
|
|
911
|
+
def polynomial_default_category(base_ring_category, n_variables):
|
|
912
|
+
"""
|
|
913
|
+
Choose an appropriate category for a polynomial ring.
|
|
914
|
+
|
|
915
|
+
It is assumed that the corresponding base ring is nonzero.
|
|
916
|
+
|
|
917
|
+
INPUT:
|
|
918
|
+
|
|
919
|
+
- ``base_ring_category`` -- the category of ring over which the polynomial
|
|
920
|
+
ring shall be defined
|
|
921
|
+
- ``n_variables`` -- number of variables
|
|
922
|
+
|
|
923
|
+
EXAMPLES::
|
|
924
|
+
|
|
925
|
+
sage: from sage.rings.polynomial.polynomial_ring_constructor import polynomial_default_category
|
|
926
|
+
sage: polynomial_default_category(Rings(), 1)
|
|
927
|
+
Category of infinite algebras with basis over rings
|
|
928
|
+
sage: polynomial_default_category(Rings().Commutative(), 1)
|
|
929
|
+
Category of infinite commutative algebras with basis
|
|
930
|
+
over commutative rings
|
|
931
|
+
sage: polynomial_default_category(Fields(), 1)
|
|
932
|
+
Join of Category of euclidean domains
|
|
933
|
+
and Category of algebras with basis over fields
|
|
934
|
+
and Category of commutative algebras over fields
|
|
935
|
+
and Category of infinite sets
|
|
936
|
+
sage: polynomial_default_category(Fields(), 2)
|
|
937
|
+
Join of Category of unique factorization domains
|
|
938
|
+
and Category of algebras with basis over fields
|
|
939
|
+
and Category of commutative algebras over fields
|
|
940
|
+
and Category of infinite sets
|
|
941
|
+
|
|
942
|
+
sage: QQ['t'].category() is EuclideanDomains() & CommutativeAlgebras(QQ.category()).WithBasis().Infinite()
|
|
943
|
+
True
|
|
944
|
+
sage: QQ['s','t'].category() is UniqueFactorizationDomains() & CommutativeAlgebras(QQ.category()).WithBasis().Infinite()
|
|
945
|
+
True
|
|
946
|
+
sage: QQ['s']['t'].category() is UniqueFactorizationDomains() & CommutativeAlgebras(QQ['s'].category()).WithBasis().Infinite()
|
|
947
|
+
True
|
|
948
|
+
"""
|
|
949
|
+
category = Algebras(base_ring_category).WithBasis()
|
|
950
|
+
|
|
951
|
+
if n_variables:
|
|
952
|
+
# here we assume the base ring to be nonzero
|
|
953
|
+
category = category.Infinite()
|
|
954
|
+
else:
|
|
955
|
+
if base_ring_category.is_subcategory(_Fields):
|
|
956
|
+
category = category & _Fields
|
|
957
|
+
|
|
958
|
+
if base_ring_category.is_subcategory(_FiniteSets):
|
|
959
|
+
category = category.Finite()
|
|
960
|
+
elif base_ring_category.is_subcategory(_InfiniteSets):
|
|
961
|
+
category = category.Infinite()
|
|
962
|
+
|
|
963
|
+
if base_ring_category.is_subcategory(_Fields) and n_variables == 1:
|
|
964
|
+
return category & _EuclideanDomains
|
|
965
|
+
elif base_ring_category.is_subcategory(_UniqueFactorizationDomains):
|
|
966
|
+
return category & _UniqueFactorizationDomains
|
|
967
|
+
elif base_ring_category.is_subcategory(_IntegralDomains):
|
|
968
|
+
return category & _IntegralDomains
|
|
969
|
+
elif base_ring_category.is_subcategory(_CommutativeRings):
|
|
970
|
+
return category & _CommutativeRings
|
|
971
|
+
return category
|
|
972
|
+
|
|
973
|
+
|
|
974
|
+
def BooleanPolynomialRing_constructor(n=None, names=None, order='lex'):
|
|
975
|
+
"""
|
|
976
|
+
Construct a boolean polynomial ring with the following
|
|
977
|
+
parameters:
|
|
978
|
+
|
|
979
|
+
INPUT:
|
|
980
|
+
|
|
981
|
+
- ``n`` -- number of variables (an integer > 1)
|
|
982
|
+
- ``names`` -- names of ring variables, may be a string or list/tuple of strings
|
|
983
|
+
- ``order`` -- term order (default: ``'lex'``)
|
|
984
|
+
|
|
985
|
+
EXAMPLES::
|
|
986
|
+
|
|
987
|
+
sage: # needs sage.rings.polynomial.pbori
|
|
988
|
+
sage: R.<x, y, z> = BooleanPolynomialRing(); R # indirect doctest
|
|
989
|
+
Boolean PolynomialRing in x, y, z
|
|
990
|
+
sage: p = x*y + x*z + y*z
|
|
991
|
+
sage: x*p
|
|
992
|
+
x*y*z + x*y + x*z
|
|
993
|
+
sage: R.term_order()
|
|
994
|
+
Lexicographic term order
|
|
995
|
+
|
|
996
|
+
sage: R = BooleanPolynomialRing(5, 'x', order='deglex(3),deglex(2)') # needs sage.rings.polynomial.pbori
|
|
997
|
+
sage: R.term_order() # needs sage.rings.polynomial.pbori
|
|
998
|
+
Block term order with blocks:
|
|
999
|
+
(Degree lexicographic term order of length 3,
|
|
1000
|
+
Degree lexicographic term order of length 2)
|
|
1001
|
+
|
|
1002
|
+
sage: R = BooleanPolynomialRing(3, 'x', order='degneglex') # needs sage.rings.polynomial.pbori
|
|
1003
|
+
sage: R.term_order() # needs sage.rings.polynomial.pbori
|
|
1004
|
+
Degree negative lexicographic term order
|
|
1005
|
+
|
|
1006
|
+
sage: BooleanPolynomialRing(names=('x','y')) # needs sage.rings.polynomial.pbori
|
|
1007
|
+
Boolean PolynomialRing in x, y
|
|
1008
|
+
|
|
1009
|
+
sage: BooleanPolynomialRing(names='x,y') # needs sage.rings.polynomial.pbori
|
|
1010
|
+
Boolean PolynomialRing in x, y
|
|
1011
|
+
|
|
1012
|
+
TESTS::
|
|
1013
|
+
|
|
1014
|
+
sage: P.<x,y> = BooleanPolynomialRing(2, order='deglex') # needs sage.rings.polynomial.pbori
|
|
1015
|
+
sage: x > y # needs sage.rings.polynomial.pbori
|
|
1016
|
+
True
|
|
1017
|
+
|
|
1018
|
+
sage: # needs sage.rings.polynomial.pbori
|
|
1019
|
+
sage: P.<x0, x1, x2, x3> = BooleanPolynomialRing(4, order='deglex(2),deglex(2)')
|
|
1020
|
+
sage: x0 > x1
|
|
1021
|
+
True
|
|
1022
|
+
sage: x2 > x3
|
|
1023
|
+
True
|
|
1024
|
+
"""
|
|
1025
|
+
if isinstance(n, str):
|
|
1026
|
+
names = n
|
|
1027
|
+
n = -1
|
|
1028
|
+
elif n is None:
|
|
1029
|
+
n = -1
|
|
1030
|
+
|
|
1031
|
+
names = normalize_names(n, names)
|
|
1032
|
+
n = len(names)
|
|
1033
|
+
|
|
1034
|
+
from sage.rings.polynomial.term_order import TermOrder
|
|
1035
|
+
|
|
1036
|
+
order = TermOrder(order, n)
|
|
1037
|
+
|
|
1038
|
+
key = ("pbori", names, n, order)
|
|
1039
|
+
R = _get_from_cache(key)
|
|
1040
|
+
if R is not None:
|
|
1041
|
+
return R
|
|
1042
|
+
|
|
1043
|
+
from sage.rings.polynomial.pbori.pbori import BooleanPolynomialRing
|
|
1044
|
+
R = BooleanPolynomialRing(n, names, order)
|
|
1045
|
+
|
|
1046
|
+
_save_in_cache(key, R)
|
|
1047
|
+
return R
|
|
1048
|
+
|
|
1049
|
+
############################################################################
|
|
1050
|
+
# END (Factory function for making polynomial rings)
|
|
1051
|
+
############################################################################
|