passagemath-categories 10.6.32__cp314-cp314t-musllinux_1_2_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- passagemath_categories-10.6.32.dist-info/METADATA +156 -0
- passagemath_categories-10.6.32.dist-info/RECORD +719 -0
- passagemath_categories-10.6.32.dist-info/WHEEL +5 -0
- passagemath_categories-10.6.32.dist-info/top_level.txt +2 -0
- passagemath_categories.libs/libgcc_s-2d945d6c.so.1 +0 -0
- passagemath_categories.libs/libgmp-28992bcb.so.10.5.0 +0 -0
- passagemath_categories.libs/libstdc++-85f2cd6d.so.6.0.33 +0 -0
- sage/all__sagemath_categories.py +28 -0
- sage/arith/all.py +38 -0
- sage/arith/constants.pxd +27 -0
- sage/arith/functions.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/functions.pxd +4 -0
- sage/arith/functions.pyx +221 -0
- sage/arith/misc.py +6552 -0
- sage/arith/multi_modular.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/multi_modular.pxd +39 -0
- sage/arith/multi_modular.pyx +994 -0
- sage/arith/rational_reconstruction.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/rational_reconstruction.pxd +4 -0
- sage/arith/rational_reconstruction.pyx +115 -0
- sage/arith/srange.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/srange.pyx +571 -0
- sage/calculus/all__sagemath_categories.py +2 -0
- sage/calculus/functional.py +481 -0
- sage/calculus/functions.py +151 -0
- sage/categories/additive_groups.py +73 -0
- sage/categories/additive_magmas.py +1044 -0
- sage/categories/additive_monoids.py +114 -0
- sage/categories/additive_semigroups.py +184 -0
- sage/categories/affine_weyl_groups.py +238 -0
- sage/categories/algebra_ideals.py +95 -0
- sage/categories/algebra_modules.py +96 -0
- sage/categories/algebras.py +349 -0
- sage/categories/algebras_with_basis.py +377 -0
- sage/categories/all.py +160 -0
- sage/categories/aperiodic_semigroups.py +29 -0
- sage/categories/associative_algebras.py +47 -0
- sage/categories/bialgebras.py +101 -0
- sage/categories/bialgebras_with_basis.py +414 -0
- sage/categories/bimodules.py +206 -0
- sage/categories/chain_complexes.py +268 -0
- sage/categories/classical_crystals.py +480 -0
- sage/categories/coalgebras.py +405 -0
- sage/categories/coalgebras_with_basis.py +232 -0
- sage/categories/coercion_methods.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/categories/coercion_methods.pyx +52 -0
- sage/categories/commutative_additive_groups.py +104 -0
- sage/categories/commutative_additive_monoids.py +45 -0
- sage/categories/commutative_additive_semigroups.py +48 -0
- sage/categories/commutative_algebra_ideals.py +87 -0
- sage/categories/commutative_algebras.py +94 -0
- sage/categories/commutative_ring_ideals.py +58 -0
- sage/categories/commutative_rings.py +736 -0
- sage/categories/complete_discrete_valuation.py +293 -0
- sage/categories/complex_reflection_groups.py +145 -0
- sage/categories/complex_reflection_or_generalized_coxeter_groups.py +1249 -0
- sage/categories/coxeter_group_algebras.py +186 -0
- sage/categories/coxeter_groups.py +3402 -0
- sage/categories/crystals.py +2628 -0
- sage/categories/cw_complexes.py +216 -0
- sage/categories/dedekind_domains.py +137 -0
- sage/categories/discrete_valuation.py +325 -0
- sage/categories/distributive_magmas_and_additive_magmas.py +100 -0
- sage/categories/division_rings.py +114 -0
- sage/categories/domains.py +95 -0
- sage/categories/drinfeld_modules.py +789 -0
- sage/categories/dual.py +42 -0
- sage/categories/enumerated_sets.py +1146 -0
- sage/categories/euclidean_domains.py +271 -0
- sage/categories/examples/algebras_with_basis.py +102 -0
- sage/categories/examples/all.py +1 -0
- sage/categories/examples/commutative_additive_monoids.py +130 -0
- sage/categories/examples/commutative_additive_semigroups.py +199 -0
- sage/categories/examples/coxeter_groups.py +8 -0
- sage/categories/examples/crystals.py +236 -0
- sage/categories/examples/cw_complexes.py +163 -0
- sage/categories/examples/facade_sets.py +187 -0
- sage/categories/examples/filtered_algebras_with_basis.py +204 -0
- sage/categories/examples/filtered_modules_with_basis.py +154 -0
- sage/categories/examples/finite_coxeter_groups.py +252 -0
- sage/categories/examples/finite_dimensional_algebras_with_basis.py +148 -0
- sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py +495 -0
- sage/categories/examples/finite_enumerated_sets.py +208 -0
- sage/categories/examples/finite_monoids.py +150 -0
- sage/categories/examples/finite_semigroups.py +190 -0
- sage/categories/examples/finite_weyl_groups.py +191 -0
- sage/categories/examples/graded_connected_hopf_algebras_with_basis.py +152 -0
- sage/categories/examples/graded_modules_with_basis.py +168 -0
- sage/categories/examples/graphs.py +122 -0
- sage/categories/examples/hopf_algebras_with_basis.py +145 -0
- sage/categories/examples/infinite_enumerated_sets.py +190 -0
- sage/categories/examples/lie_algebras.py +352 -0
- sage/categories/examples/lie_algebras_with_basis.py +196 -0
- sage/categories/examples/magmas.py +162 -0
- sage/categories/examples/manifolds.py +94 -0
- sage/categories/examples/monoids.py +144 -0
- sage/categories/examples/posets.py +178 -0
- sage/categories/examples/semigroups.py +580 -0
- sage/categories/examples/semigroups_cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/categories/examples/semigroups_cython.pyx +221 -0
- sage/categories/examples/semirings.py +249 -0
- sage/categories/examples/sets_cat.py +706 -0
- sage/categories/examples/sets_with_grading.py +101 -0
- sage/categories/examples/with_realizations.py +542 -0
- sage/categories/fields.py +991 -0
- sage/categories/filtered_algebras.py +63 -0
- sage/categories/filtered_algebras_with_basis.py +548 -0
- sage/categories/filtered_hopf_algebras_with_basis.py +138 -0
- sage/categories/filtered_modules.py +210 -0
- sage/categories/filtered_modules_with_basis.py +1209 -0
- sage/categories/finite_complex_reflection_groups.py +1506 -0
- sage/categories/finite_coxeter_groups.py +1138 -0
- sage/categories/finite_crystals.py +103 -0
- sage/categories/finite_dimensional_algebras_with_basis.py +1860 -0
- sage/categories/finite_dimensional_bialgebras_with_basis.py +33 -0
- sage/categories/finite_dimensional_coalgebras_with_basis.py +33 -0
- sage/categories/finite_dimensional_graded_lie_algebras_with_basis.py +231 -0
- sage/categories/finite_dimensional_hopf_algebras_with_basis.py +38 -0
- sage/categories/finite_dimensional_lie_algebras_with_basis.py +2774 -0
- sage/categories/finite_dimensional_modules_with_basis.py +1407 -0
- sage/categories/finite_dimensional_nilpotent_lie_algebras_with_basis.py +167 -0
- sage/categories/finite_dimensional_semisimple_algebras_with_basis.py +270 -0
- sage/categories/finite_enumerated_sets.py +769 -0
- sage/categories/finite_fields.py +252 -0
- sage/categories/finite_groups.py +256 -0
- sage/categories/finite_lattice_posets.py +242 -0
- sage/categories/finite_monoids.py +316 -0
- sage/categories/finite_permutation_groups.py +339 -0
- sage/categories/finite_posets.py +1994 -0
- sage/categories/finite_semigroups.py +136 -0
- sage/categories/finite_sets.py +93 -0
- sage/categories/finite_weyl_groups.py +39 -0
- sage/categories/finitely_generated_lambda_bracket_algebras.py +112 -0
- sage/categories/finitely_generated_lie_conformal_algebras.py +114 -0
- sage/categories/finitely_generated_magmas.py +57 -0
- sage/categories/finitely_generated_semigroups.py +214 -0
- sage/categories/function_fields.py +76 -0
- sage/categories/g_sets.py +77 -0
- sage/categories/gcd_domains.py +65 -0
- sage/categories/generalized_coxeter_groups.py +94 -0
- sage/categories/graded_algebras.py +85 -0
- sage/categories/graded_algebras_with_basis.py +258 -0
- sage/categories/graded_bialgebras.py +32 -0
- sage/categories/graded_bialgebras_with_basis.py +32 -0
- sage/categories/graded_coalgebras.py +65 -0
- sage/categories/graded_coalgebras_with_basis.py +51 -0
- sage/categories/graded_hopf_algebras.py +41 -0
- sage/categories/graded_hopf_algebras_with_basis.py +169 -0
- sage/categories/graded_lie_algebras.py +91 -0
- sage/categories/graded_lie_algebras_with_basis.py +44 -0
- sage/categories/graded_lie_conformal_algebras.py +74 -0
- sage/categories/graded_modules.py +133 -0
- sage/categories/graded_modules_with_basis.py +329 -0
- sage/categories/graphs.py +138 -0
- sage/categories/group_algebras.py +430 -0
- sage/categories/groupoid.py +94 -0
- sage/categories/groups.py +667 -0
- sage/categories/h_trivial_semigroups.py +64 -0
- sage/categories/hecke_modules.py +185 -0
- sage/categories/highest_weight_crystals.py +980 -0
- sage/categories/hopf_algebras.py +219 -0
- sage/categories/hopf_algebras_with_basis.py +309 -0
- sage/categories/infinite_enumerated_sets.py +115 -0
- sage/categories/integral_domains.py +203 -0
- sage/categories/j_trivial_semigroups.py +29 -0
- sage/categories/kac_moody_algebras.py +82 -0
- sage/categories/kahler_algebras.py +203 -0
- sage/categories/l_trivial_semigroups.py +63 -0
- sage/categories/lambda_bracket_algebras.py +280 -0
- sage/categories/lambda_bracket_algebras_with_basis.py +107 -0
- sage/categories/lattice_posets.py +89 -0
- sage/categories/left_modules.py +49 -0
- sage/categories/lie_algebras.py +1070 -0
- sage/categories/lie_algebras_with_basis.py +261 -0
- sage/categories/lie_conformal_algebras.py +350 -0
- sage/categories/lie_conformal_algebras_with_basis.py +147 -0
- sage/categories/lie_groups.py +73 -0
- sage/categories/loop_crystals.py +1290 -0
- sage/categories/magmas.py +1189 -0
- sage/categories/magmas_and_additive_magmas.py +149 -0
- sage/categories/magmatic_algebras.py +365 -0
- sage/categories/manifolds.py +352 -0
- sage/categories/matrix_algebras.py +40 -0
- sage/categories/metric_spaces.py +387 -0
- sage/categories/modular_abelian_varieties.py +78 -0
- sage/categories/modules.py +989 -0
- sage/categories/modules_with_basis.py +2794 -0
- sage/categories/monoid_algebras.py +38 -0
- sage/categories/monoids.py +739 -0
- sage/categories/noetherian_rings.py +87 -0
- sage/categories/number_fields.py +242 -0
- sage/categories/ore_modules.py +189 -0
- sage/categories/partially_ordered_monoids.py +49 -0
- sage/categories/permutation_groups.py +63 -0
- sage/categories/pointed_sets.py +42 -0
- sage/categories/polyhedra.py +74 -0
- sage/categories/poor_man_map.py +270 -0
- sage/categories/posets.py +722 -0
- sage/categories/principal_ideal_domains.py +270 -0
- sage/categories/quantum_group_representations.py +543 -0
- sage/categories/quotient_fields.py +728 -0
- sage/categories/r_trivial_semigroups.py +45 -0
- sage/categories/regular_crystals.py +898 -0
- sage/categories/regular_supercrystals.py +170 -0
- sage/categories/right_modules.py +49 -0
- sage/categories/ring_ideals.py +74 -0
- sage/categories/rings.py +1904 -0
- sage/categories/rngs.py +175 -0
- sage/categories/schemes.py +393 -0
- sage/categories/semigroups.py +1060 -0
- sage/categories/semirings.py +71 -0
- sage/categories/semisimple_algebras.py +114 -0
- sage/categories/sets_with_grading.py +235 -0
- sage/categories/shephard_groups.py +43 -0
- sage/categories/signed_tensor.py +120 -0
- sage/categories/simplicial_complexes.py +134 -0
- sage/categories/simplicial_sets.py +1206 -0
- sage/categories/super_algebras.py +149 -0
- sage/categories/super_algebras_with_basis.py +144 -0
- sage/categories/super_hopf_algebras_with_basis.py +126 -0
- sage/categories/super_lie_conformal_algebras.py +193 -0
- sage/categories/super_modules.py +229 -0
- sage/categories/super_modules_with_basis.py +193 -0
- sage/categories/supercommutative_algebras.py +99 -0
- sage/categories/supercrystals.py +406 -0
- sage/categories/tensor.py +110 -0
- sage/categories/topological_spaces.py +170 -0
- sage/categories/triangular_kac_moody_algebras.py +439 -0
- sage/categories/tutorial.py +58 -0
- sage/categories/unique_factorization_domains.py +318 -0
- sage/categories/unital_algebras.py +426 -0
- sage/categories/vector_bundles.py +159 -0
- sage/categories/vector_spaces.py +357 -0
- sage/categories/weyl_groups.py +853 -0
- sage/combinat/all__sagemath_categories.py +34 -0
- sage/combinat/backtrack.py +180 -0
- sage/combinat/combinat.py +2269 -0
- sage/combinat/combinat_cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/combinat_cython.pxd +6 -0
- sage/combinat/combinat_cython.pyx +390 -0
- sage/combinat/combination.py +796 -0
- sage/combinat/combinatorial_map.py +416 -0
- sage/combinat/composition.py +2192 -0
- sage/combinat/dlx.py +510 -0
- sage/combinat/integer_lists/__init__.py +7 -0
- sage/combinat/integer_lists/base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/integer_lists/base.pxd +16 -0
- sage/combinat/integer_lists/base.pyx +713 -0
- sage/combinat/integer_lists/invlex.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/integer_lists/invlex.pxd +4 -0
- sage/combinat/integer_lists/invlex.pyx +1650 -0
- sage/combinat/integer_lists/lists.py +328 -0
- sage/combinat/integer_lists/nn.py +48 -0
- sage/combinat/integer_vector.py +1818 -0
- sage/combinat/integer_vector_weighted.py +413 -0
- sage/combinat/matrices/all__sagemath_categories.py +5 -0
- sage/combinat/matrices/dancing_links.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/matrices/dancing_links.pyx +1159 -0
- sage/combinat/matrices/dancing_links_c.h +380 -0
- sage/combinat/matrices/dlxcpp.py +136 -0
- sage/combinat/partition.py +10070 -0
- sage/combinat/partitions.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/partitions.pyx +743 -0
- sage/combinat/permutation.py +10168 -0
- sage/combinat/permutation_cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/permutation_cython.pxd +11 -0
- sage/combinat/permutation_cython.pyx +407 -0
- sage/combinat/q_analogues.py +1090 -0
- sage/combinat/ranker.py +268 -0
- sage/combinat/subset.py +1561 -0
- sage/combinat/subsets_hereditary.py +202 -0
- sage/combinat/subsets_pairwise.py +184 -0
- sage/combinat/tools.py +63 -0
- sage/combinat/tuple.py +348 -0
- sage/data_structures/all.py +2 -0
- sage/data_structures/all__sagemath_categories.py +2 -0
- sage/data_structures/binary_matrix.pxd +138 -0
- sage/data_structures/binary_search.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/binary_search.pxd +3 -0
- sage/data_structures/binary_search.pyx +66 -0
- sage/data_structures/bitset.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/bitset.pxd +40 -0
- sage/data_structures/bitset.pyx +2385 -0
- sage/data_structures/bitset_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/bitset_base.pxd +926 -0
- sage/data_structures/bitset_base.pyx +117 -0
- sage/data_structures/bitset_intrinsics.h +487 -0
- sage/data_structures/blas_dict.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/blas_dict.pxd +12 -0
- sage/data_structures/blas_dict.pyx +469 -0
- sage/data_structures/list_of_pairs.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/list_of_pairs.pxd +16 -0
- sage/data_structures/list_of_pairs.pyx +122 -0
- sage/data_structures/mutable_poset.py +3312 -0
- sage/data_structures/pairing_heap.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/pairing_heap.h +346 -0
- sage/data_structures/pairing_heap.pxd +88 -0
- sage/data_structures/pairing_heap.pyx +1464 -0
- sage/data_structures/sparse_bitset.pxd +62 -0
- sage/data_structures/stream.py +5070 -0
- sage/databases/all__sagemath_categories.py +7 -0
- sage/databases/sql_db.py +2236 -0
- sage/ext/all__sagemath_categories.py +3 -0
- sage/ext/fast_callable.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/fast_callable.pxd +4 -0
- sage/ext/fast_callable.pyx +2746 -0
- sage/ext/fast_eval.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/fast_eval.pxd +1 -0
- sage/ext/fast_eval.pyx +102 -0
- sage/ext/interpreters/__init__.py +1 -0
- sage/ext/interpreters/all__sagemath_categories.py +2 -0
- sage/ext/interpreters/wrapper_el.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/interpreters/wrapper_el.pxd +18 -0
- sage/ext/interpreters/wrapper_el.pyx +148 -0
- sage/ext/interpreters/wrapper_py.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/interpreters/wrapper_py.pxd +17 -0
- sage/ext/interpreters/wrapper_py.pyx +133 -0
- sage/functions/airy.py +937 -0
- sage/functions/all.py +97 -0
- sage/functions/bessel.py +2102 -0
- sage/functions/error.py +784 -0
- sage/functions/exp_integral.py +1529 -0
- sage/functions/gamma.py +1087 -0
- sage/functions/generalized.py +672 -0
- sage/functions/hyperbolic.py +747 -0
- sage/functions/hypergeometric.py +1156 -0
- sage/functions/jacobi.py +1705 -0
- sage/functions/log.py +1402 -0
- sage/functions/min_max.py +338 -0
- sage/functions/orthogonal_polys.py +3106 -0
- sage/functions/other.py +2303 -0
- sage/functions/piecewise.py +1505 -0
- sage/functions/prime_pi.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/functions/prime_pi.pyx +262 -0
- sage/functions/special.py +1212 -0
- sage/functions/spike_function.py +278 -0
- sage/functions/transcendental.py +690 -0
- sage/functions/trig.py +1062 -0
- sage/functions/wigner.py +726 -0
- sage/geometry/abc.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/geometry/abc.pyx +82 -0
- sage/geometry/all__sagemath_categories.py +1 -0
- sage/groups/all__sagemath_categories.py +11 -0
- sage/groups/generic.py +1733 -0
- sage/groups/groups_catalog.py +113 -0
- sage/groups/perm_gps/all__sagemath_categories.py +1 -0
- sage/groups/perm_gps/partn_ref/all.py +1 -0
- sage/groups/perm_gps/partn_ref/all__sagemath_categories.py +1 -0
- sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.pxd +52 -0
- sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.pyx +906 -0
- sage/groups/perm_gps/partn_ref/canonical_augmentation.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/canonical_augmentation.pxd +85 -0
- sage/groups/perm_gps/partn_ref/canonical_augmentation.pyx +534 -0
- sage/groups/perm_gps/partn_ref/data_structures.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/data_structures.pxd +576 -0
- sage/groups/perm_gps/partn_ref/data_structures.pyx +1792 -0
- sage/groups/perm_gps/partn_ref/double_coset.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/double_coset.pxd +45 -0
- sage/groups/perm_gps/partn_ref/double_coset.pyx +739 -0
- sage/groups/perm_gps/partn_ref/refinement_lists.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_lists.pxd +18 -0
- sage/groups/perm_gps/partn_ref/refinement_lists.pyx +82 -0
- sage/groups/perm_gps/partn_ref/refinement_python.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_python.pxd +16 -0
- sage/groups/perm_gps/partn_ref/refinement_python.pyx +564 -0
- sage/groups/perm_gps/partn_ref/refinement_sets.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_sets.pxd +60 -0
- sage/groups/perm_gps/partn_ref/refinement_sets.pyx +858 -0
- sage/interfaces/abc.py +140 -0
- sage/interfaces/all.py +58 -0
- sage/interfaces/all__sagemath_categories.py +1 -0
- sage/interfaces/expect.py +1643 -0
- sage/interfaces/interface.py +1682 -0
- sage/interfaces/process.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/interfaces/process.pxd +5 -0
- sage/interfaces/process.pyx +288 -0
- sage/interfaces/quit.py +167 -0
- sage/interfaces/sage0.py +604 -0
- sage/interfaces/sagespawn.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/interfaces/sagespawn.pyx +308 -0
- sage/interfaces/tab_completion.py +101 -0
- sage/misc/all__sagemath_categories.py +78 -0
- sage/misc/allocator.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/allocator.pxd +6 -0
- sage/misc/allocator.pyx +47 -0
- sage/misc/binary_tree.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/binary_tree.pxd +29 -0
- sage/misc/binary_tree.pyx +537 -0
- sage/misc/callable_dict.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/callable_dict.pyx +89 -0
- sage/misc/citation.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/citation.pyx +159 -0
- sage/misc/converting_dict.py +293 -0
- sage/misc/defaults.py +129 -0
- sage/misc/derivative.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/derivative.pyx +223 -0
- sage/misc/functional.py +2005 -0
- sage/misc/html.py +589 -0
- sage/misc/latex.py +2673 -0
- sage/misc/latex_macros.py +236 -0
- sage/misc/latex_standalone.py +1833 -0
- sage/misc/map_threaded.py +38 -0
- sage/misc/mathml.py +76 -0
- sage/misc/method_decorator.py +88 -0
- sage/misc/mrange.py +755 -0
- sage/misc/multireplace.py +41 -0
- sage/misc/object_multiplexer.py +92 -0
- sage/misc/parser.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/parser.pyx +1107 -0
- sage/misc/random_testing.py +264 -0
- sage/misc/rest_index_of_methods.py +377 -0
- sage/misc/search.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/search.pxd +2 -0
- sage/misc/search.pyx +68 -0
- sage/misc/stopgap.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/stopgap.pyx +95 -0
- sage/misc/table.py +853 -0
- sage/monoids/all__sagemath_categories.py +1 -0
- sage/monoids/indexed_free_monoid.py +1071 -0
- sage/monoids/monoid.py +82 -0
- sage/numerical/all__sagemath_categories.py +1 -0
- sage/numerical/backends/all__sagemath_categories.py +1 -0
- sage/numerical/backends/generic_backend.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/numerical/backends/generic_backend.pxd +61 -0
- sage/numerical/backends/generic_backend.pyx +1893 -0
- sage/numerical/backends/generic_sdp_backend.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/numerical/backends/generic_sdp_backend.pxd +38 -0
- sage/numerical/backends/generic_sdp_backend.pyx +755 -0
- sage/parallel/all.py +6 -0
- sage/parallel/decorate.py +575 -0
- sage/parallel/map_reduce.py +1997 -0
- sage/parallel/multiprocessing_sage.py +76 -0
- sage/parallel/ncpus.py +35 -0
- sage/parallel/parallelism.py +364 -0
- sage/parallel/reference.py +47 -0
- sage/parallel/use_fork.py +333 -0
- sage/rings/abc.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/abc.pxd +31 -0
- sage/rings/abc.pyx +526 -0
- sage/rings/algebraic_closure_finite_field.py +1154 -0
- sage/rings/all__sagemath_categories.py +91 -0
- sage/rings/big_oh.py +227 -0
- sage/rings/continued_fraction.py +2754 -0
- sage/rings/continued_fraction_gosper.py +220 -0
- sage/rings/factorint.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/factorint.pyx +295 -0
- sage/rings/fast_arith.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/fast_arith.pxd +21 -0
- sage/rings/fast_arith.pyx +535 -0
- sage/rings/finite_rings/all__sagemath_categories.py +9 -0
- sage/rings/finite_rings/conway_polynomials.py +542 -0
- sage/rings/finite_rings/element_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/element_base.pxd +12 -0
- sage/rings/finite_rings/element_base.pyx +1176 -0
- sage/rings/finite_rings/finite_field_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/finite_field_base.pxd +7 -0
- sage/rings/finite_rings/finite_field_base.pyx +2171 -0
- sage/rings/finite_rings/finite_field_constructor.py +827 -0
- sage/rings/finite_rings/finite_field_prime_modn.py +372 -0
- sage/rings/finite_rings/galois_group.py +154 -0
- sage/rings/finite_rings/hom_finite_field.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/hom_finite_field.pxd +23 -0
- sage/rings/finite_rings/hom_finite_field.pyx +856 -0
- sage/rings/finite_rings/hom_prime_finite_field.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/hom_prime_finite_field.pxd +15 -0
- sage/rings/finite_rings/hom_prime_finite_field.pyx +164 -0
- sage/rings/finite_rings/homset.py +357 -0
- sage/rings/finite_rings/integer_mod.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/integer_mod.pxd +56 -0
- sage/rings/finite_rings/integer_mod.pyx +4586 -0
- sage/rings/finite_rings/integer_mod_limits.h +11 -0
- sage/rings/finite_rings/integer_mod_ring.py +2044 -0
- sage/rings/finite_rings/residue_field.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/residue_field.pxd +30 -0
- sage/rings/finite_rings/residue_field.pyx +1811 -0
- sage/rings/finite_rings/stdint.pxd +19 -0
- sage/rings/fraction_field.py +1452 -0
- sage/rings/fraction_field_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/fraction_field_element.pyx +1357 -0
- sage/rings/function_field/all.py +7 -0
- sage/rings/function_field/all__sagemath_categories.py +2 -0
- sage/rings/function_field/constructor.py +218 -0
- sage/rings/function_field/element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/function_field/element.pxd +11 -0
- sage/rings/function_field/element.pyx +1008 -0
- sage/rings/function_field/element_rational.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/function_field/element_rational.pyx +513 -0
- sage/rings/function_field/extensions.py +230 -0
- sage/rings/function_field/function_field.py +1468 -0
- sage/rings/function_field/function_field_rational.py +1005 -0
- sage/rings/function_field/ideal.py +1155 -0
- sage/rings/function_field/ideal_rational.py +629 -0
- sage/rings/function_field/jacobian_base.py +826 -0
- sage/rings/function_field/jacobian_hess.py +1053 -0
- sage/rings/function_field/jacobian_khuri_makdisi.py +1027 -0
- sage/rings/function_field/maps.py +1039 -0
- sage/rings/function_field/order.py +281 -0
- sage/rings/function_field/order_basis.py +586 -0
- sage/rings/function_field/order_rational.py +576 -0
- sage/rings/function_field/place.py +426 -0
- sage/rings/function_field/place_rational.py +181 -0
- sage/rings/generic.py +320 -0
- sage/rings/homset.py +332 -0
- sage/rings/ideal.py +1885 -0
- sage/rings/ideal_monoid.py +215 -0
- sage/rings/infinity.py +1890 -0
- sage/rings/integer.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/integer.pxd +45 -0
- sage/rings/integer.pyx +7874 -0
- sage/rings/integer_ring.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/integer_ring.pxd +8 -0
- sage/rings/integer_ring.pyx +1693 -0
- sage/rings/laurent_series_ring.py +931 -0
- sage/rings/laurent_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/laurent_series_ring_element.pxd +11 -0
- sage/rings/laurent_series_ring_element.pyx +1927 -0
- sage/rings/lazy_series.py +7815 -0
- sage/rings/lazy_series_ring.py +4356 -0
- sage/rings/localization.py +1043 -0
- sage/rings/morphism.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/morphism.pxd +39 -0
- sage/rings/morphism.pyx +3299 -0
- sage/rings/multi_power_series_ring.py +1145 -0
- sage/rings/multi_power_series_ring_element.py +2184 -0
- sage/rings/noncommutative_ideals.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/noncommutative_ideals.pyx +423 -0
- sage/rings/number_field/all__sagemath_categories.py +1 -0
- sage/rings/number_field/number_field_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/number_field/number_field_base.pxd +8 -0
- sage/rings/number_field/number_field_base.pyx +507 -0
- sage/rings/number_field/number_field_element_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/number_field/number_field_element_base.pxd +6 -0
- sage/rings/number_field/number_field_element_base.pyx +36 -0
- sage/rings/number_field/number_field_ideal.py +3550 -0
- sage/rings/padics/all__sagemath_categories.py +4 -0
- sage/rings/padics/local_generic.py +1670 -0
- sage/rings/padics/local_generic_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/padics/local_generic_element.pxd +5 -0
- sage/rings/padics/local_generic_element.pyx +1017 -0
- sage/rings/padics/misc.py +256 -0
- sage/rings/padics/padic_generic.py +1911 -0
- sage/rings/padics/pow_computer.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/padics/pow_computer.pxd +38 -0
- sage/rings/padics/pow_computer.pyx +671 -0
- sage/rings/padics/precision_error.py +24 -0
- sage/rings/polynomial/all__sagemath_categories.py +25 -0
- sage/rings/polynomial/commutative_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/commutative_polynomial.pxd +6 -0
- sage/rings/polynomial/commutative_polynomial.pyx +24 -0
- sage/rings/polynomial/cyclotomic.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/cyclotomic.pyx +404 -0
- sage/rings/polynomial/flatten.py +711 -0
- sage/rings/polynomial/ideal.py +102 -0
- sage/rings/polynomial/infinite_polynomial_element.py +1768 -0
- sage/rings/polynomial/infinite_polynomial_ring.py +1653 -0
- sage/rings/polynomial/laurent_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/laurent_polynomial.pxd +18 -0
- sage/rings/polynomial/laurent_polynomial.pyx +2190 -0
- sage/rings/polynomial/laurent_polynomial_ideal.py +590 -0
- sage/rings/polynomial/laurent_polynomial_ring.py +832 -0
- sage/rings/polynomial/laurent_polynomial_ring_base.py +708 -0
- sage/rings/polynomial/multi_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/multi_polynomial.pxd +12 -0
- sage/rings/polynomial/multi_polynomial.pyx +3082 -0
- sage/rings/polynomial/multi_polynomial_element.py +2570 -0
- sage/rings/polynomial/multi_polynomial_ideal.py +5771 -0
- sage/rings/polynomial/multi_polynomial_ring.py +947 -0
- sage/rings/polynomial/multi_polynomial_ring_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/multi_polynomial_ring_base.pxd +15 -0
- sage/rings/polynomial/multi_polynomial_ring_base.pyx +1855 -0
- sage/rings/polynomial/multi_polynomial_sequence.py +2204 -0
- sage/rings/polynomial/polydict.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polydict.pxd +45 -0
- sage/rings/polynomial/polydict.pyx +2701 -0
- sage/rings/polynomial/polynomial_compiled.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_compiled.pxd +59 -0
- sage/rings/polynomial/polynomial_compiled.pyx +509 -0
- sage/rings/polynomial/polynomial_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_element.pxd +64 -0
- sage/rings/polynomial/polynomial_element.pyx +13255 -0
- sage/rings/polynomial/polynomial_element_generic.py +1637 -0
- sage/rings/polynomial/polynomial_fateman.py +97 -0
- sage/rings/polynomial/polynomial_quotient_ring.py +2465 -0
- sage/rings/polynomial/polynomial_quotient_ring_element.py +779 -0
- sage/rings/polynomial/polynomial_ring.py +3784 -0
- sage/rings/polynomial/polynomial_ring_constructor.py +1051 -0
- sage/rings/polynomial/polynomial_ring_homomorphism.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_ring_homomorphism.pxd +5 -0
- sage/rings/polynomial/polynomial_ring_homomorphism.pyx +121 -0
- sage/rings/polynomial/polynomial_singular_interface.py +549 -0
- sage/rings/polynomial/symmetric_ideal.py +989 -0
- sage/rings/polynomial/symmetric_reduction.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/symmetric_reduction.pxd +8 -0
- sage/rings/polynomial/symmetric_reduction.pyx +669 -0
- sage/rings/polynomial/term_order.py +2279 -0
- sage/rings/polynomial/toy_buchberger.py +449 -0
- sage/rings/polynomial/toy_d_basis.py +387 -0
- sage/rings/polynomial/toy_variety.py +362 -0
- sage/rings/power_series_mpoly.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/power_series_mpoly.pxd +9 -0
- sage/rings/power_series_mpoly.pyx +161 -0
- sage/rings/power_series_poly.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/power_series_poly.pxd +10 -0
- sage/rings/power_series_poly.pyx +1317 -0
- sage/rings/power_series_ring.py +1441 -0
- sage/rings/power_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/power_series_ring_element.pxd +12 -0
- sage/rings/power_series_ring_element.pyx +3028 -0
- sage/rings/puiseux_series_ring.py +487 -0
- sage/rings/puiseux_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/puiseux_series_ring_element.pxd +7 -0
- sage/rings/puiseux_series_ring_element.pyx +1055 -0
- sage/rings/qqbar_decorators.py +167 -0
- sage/rings/quotient_ring.py +1598 -0
- sage/rings/quotient_ring_element.py +979 -0
- sage/rings/rational.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/rational.pxd +20 -0
- sage/rings/rational.pyx +4284 -0
- sage/rings/rational_field.py +1730 -0
- sage/rings/real_double.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/real_double.pxd +16 -0
- sage/rings/real_double.pyx +2218 -0
- sage/rings/real_lazy.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/real_lazy.pxd +30 -0
- sage/rings/real_lazy.pyx +1773 -0
- sage/rings/ring.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/ring.pxd +30 -0
- sage/rings/ring.pyx +850 -0
- sage/rings/semirings/all.py +3 -0
- sage/rings/semirings/non_negative_integer_semiring.py +107 -0
- sage/rings/semirings/tropical_mpolynomial.py +972 -0
- sage/rings/semirings/tropical_polynomial.py +997 -0
- sage/rings/semirings/tropical_semiring.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/semirings/tropical_semiring.pyx +676 -0
- sage/rings/semirings/tropical_variety.py +1701 -0
- sage/rings/sum_of_squares.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/sum_of_squares.pxd +3 -0
- sage/rings/sum_of_squares.pyx +336 -0
- sage/rings/tests.py +504 -0
- sage/schemes/affine/affine_homset.py +508 -0
- sage/schemes/affine/affine_morphism.py +1574 -0
- sage/schemes/affine/affine_point.py +460 -0
- sage/schemes/affine/affine_rational_point.py +308 -0
- sage/schemes/affine/affine_space.py +1264 -0
- sage/schemes/affine/affine_subscheme.py +592 -0
- sage/schemes/affine/all.py +25 -0
- sage/schemes/all__sagemath_categories.py +5 -0
- sage/schemes/generic/algebraic_scheme.py +2092 -0
- sage/schemes/generic/all.py +5 -0
- sage/schemes/generic/ambient_space.py +400 -0
- sage/schemes/generic/divisor.py +465 -0
- sage/schemes/generic/divisor_group.py +313 -0
- sage/schemes/generic/glue.py +84 -0
- sage/schemes/generic/homset.py +820 -0
- sage/schemes/generic/hypersurface.py +234 -0
- sage/schemes/generic/morphism.py +2107 -0
- sage/schemes/generic/point.py +237 -0
- sage/schemes/generic/scheme.py +1190 -0
- sage/schemes/generic/spec.py +199 -0
- sage/schemes/product_projective/all.py +6 -0
- sage/schemes/product_projective/homset.py +236 -0
- sage/schemes/product_projective/morphism.py +517 -0
- sage/schemes/product_projective/point.py +568 -0
- sage/schemes/product_projective/rational_point.py +550 -0
- sage/schemes/product_projective/space.py +1301 -0
- sage/schemes/product_projective/subscheme.py +466 -0
- sage/schemes/projective/all.py +24 -0
- sage/schemes/projective/proj_bdd_height.py +453 -0
- sage/schemes/projective/projective_homset.py +718 -0
- sage/schemes/projective/projective_morphism.py +2792 -0
- sage/schemes/projective/projective_point.py +1484 -0
- sage/schemes/projective/projective_rational_point.py +569 -0
- sage/schemes/projective/projective_space.py +2571 -0
- sage/schemes/projective/projective_subscheme.py +1574 -0
- sage/sets/all.py +17 -0
- sage/sets/cartesian_product.py +376 -0
- sage/sets/condition_set.py +525 -0
- sage/sets/disjoint_set.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/disjoint_set.pxd +36 -0
- sage/sets/disjoint_set.pyx +998 -0
- sage/sets/disjoint_union_enumerated_sets.py +625 -0
- sage/sets/family.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/family.pxd +12 -0
- sage/sets/family.pyx +1556 -0
- sage/sets/finite_enumerated_set.py +406 -0
- sage/sets/finite_set_map_cy.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/finite_set_map_cy.pxd +34 -0
- sage/sets/finite_set_map_cy.pyx +708 -0
- sage/sets/finite_set_maps.py +591 -0
- sage/sets/image_set.py +448 -0
- sage/sets/integer_range.py +829 -0
- sage/sets/non_negative_integers.py +241 -0
- sage/sets/positive_integers.py +93 -0
- sage/sets/primes.py +188 -0
- sage/sets/real_set.py +2760 -0
- sage/sets/recursively_enumerated_set.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/recursively_enumerated_set.pxd +31 -0
- sage/sets/recursively_enumerated_set.pyx +2082 -0
- sage/sets/set.py +2083 -0
- sage/sets/set_from_iterator.py +1021 -0
- sage/sets/totally_ordered_finite_set.py +329 -0
- sage/symbolic/all__sagemath_categories.py +1 -0
- sage/symbolic/function.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/symbolic/function.pxd +29 -0
- sage/symbolic/function.pyx +1488 -0
- sage/symbolic/symbols.py +56 -0
- sage/tests/all__sagemath_categories.py +1 -0
- sage/tests/cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/tests/cython.pyx +37 -0
- sage/tests/stl_vector.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/tests/stl_vector.pyx +171 -0
- sage/typeset/all.py +6 -0
- sage/typeset/ascii_art.py +295 -0
- sage/typeset/character_art.py +789 -0
- sage/typeset/character_art_factory.py +572 -0
- sage/typeset/symbols.py +334 -0
- sage/typeset/unicode_art.py +183 -0
- sage/typeset/unicode_characters.py +101 -0
sage/rings/ideal.py
ADDED
|
@@ -0,0 +1,1885 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-categories
|
|
2
|
+
r"""
|
|
3
|
+
Ideals of commutative rings
|
|
4
|
+
|
|
5
|
+
Sage provides functionality for computing with ideals. One can create
|
|
6
|
+
an ideal in any commutative or non-commutative ring `R` by giving a
|
|
7
|
+
list of generators, using the notation ``R.ideal([a,b,...])``. The case
|
|
8
|
+
of non-commutative rings is implemented in
|
|
9
|
+
:mod:`~sage.rings.noncommutative_ideals`.
|
|
10
|
+
|
|
11
|
+
A more convenient notation may be ``R*[a,b,...]`` or ``[a,b,...]*R``.
|
|
12
|
+
If `R` is non-commutative, the former creates a left and the latter
|
|
13
|
+
a right ideal, and ``R*[a,b,...]*R`` creates a two-sided ideal.
|
|
14
|
+
"""
|
|
15
|
+
# ****************************************************************************
|
|
16
|
+
# Copyright (C) 2005 William Stein <wstein@gmail.com>
|
|
17
|
+
#
|
|
18
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
19
|
+
#
|
|
20
|
+
# This code is distributed in the hope that it will be useful,
|
|
21
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
22
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
23
|
+
# General Public License for more details.
|
|
24
|
+
#
|
|
25
|
+
# The full text of the GPL is available at:
|
|
26
|
+
#
|
|
27
|
+
# https://www.gnu.org/licenses/
|
|
28
|
+
# ****************************************************************************
|
|
29
|
+
|
|
30
|
+
from types import GeneratorType
|
|
31
|
+
|
|
32
|
+
from sage.categories.rings import Rings
|
|
33
|
+
from sage.categories.fields import Fields
|
|
34
|
+
from sage.structure.element import MonoidElement
|
|
35
|
+
from sage.structure.richcmp import rich_to_bool, richcmp
|
|
36
|
+
from sage.structure.sequence import Sequence
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
# for efficiency
|
|
40
|
+
_Rings = Rings()
|
|
41
|
+
_Fields = Fields()
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def Ideal(*args, **kwds):
|
|
45
|
+
r"""
|
|
46
|
+
Create the ideal in ring with given generators.
|
|
47
|
+
|
|
48
|
+
There are some shorthand notations for creating an ideal, in
|
|
49
|
+
addition to using the :func:`Ideal` function:
|
|
50
|
+
|
|
51
|
+
- ``R.ideal(gens, coerce=True)``
|
|
52
|
+
- ``gens*R``
|
|
53
|
+
- ``R*gens``
|
|
54
|
+
|
|
55
|
+
INPUT:
|
|
56
|
+
|
|
57
|
+
- ``R`` -- a ring (optional; if not given, will try to infer it from ``gens``)
|
|
58
|
+
|
|
59
|
+
- ``gens`` -- list of elements generating the ideal
|
|
60
|
+
|
|
61
|
+
- ``coerce`` -- boolean (default: ``True``); whether ``gens`` need to be
|
|
62
|
+
coerced into the ring
|
|
63
|
+
|
|
64
|
+
OUTPUT: the ideal of ring generated by ``gens``
|
|
65
|
+
|
|
66
|
+
EXAMPLES::
|
|
67
|
+
|
|
68
|
+
sage: R.<x> = ZZ[]
|
|
69
|
+
sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2])
|
|
70
|
+
sage: I
|
|
71
|
+
Ideal (x^2 + 3*x + 4, x^2 + 1) of Univariate Polynomial Ring in x over Integer Ring
|
|
72
|
+
sage: Ideal(R, [4 + 3*x + x^2, 1 + x^2])
|
|
73
|
+
Ideal (x^2 + 3*x + 4, x^2 + 1) of Univariate Polynomial Ring in x over Integer Ring
|
|
74
|
+
sage: Ideal((4 + 3*x + x^2, 1 + x^2))
|
|
75
|
+
Ideal (x^2 + 3*x + 4, x^2 + 1) of Univariate Polynomial Ring in x over Integer Ring
|
|
76
|
+
|
|
77
|
+
::
|
|
78
|
+
|
|
79
|
+
sage: ideal(x^2-2*x+1, x^2-1)
|
|
80
|
+
Ideal (x^2 - 2*x + 1, x^2 - 1) of Univariate Polynomial Ring in x over Integer Ring
|
|
81
|
+
sage: ideal([x^2-2*x+1, x^2-1])
|
|
82
|
+
Ideal (x^2 - 2*x + 1, x^2 - 1) of Univariate Polynomial Ring in x over Integer Ring
|
|
83
|
+
sage: l = [x^2-2*x+1, x^2-1]
|
|
84
|
+
sage: ideal(f^2 for f in l)
|
|
85
|
+
Ideal (x^4 - 4*x^3 + 6*x^2 - 4*x + 1, x^4 - 2*x^2 + 1) of
|
|
86
|
+
Univariate Polynomial Ring in x over Integer Ring
|
|
87
|
+
|
|
88
|
+
This example illustrates how Sage finds a common ambient ring for
|
|
89
|
+
the ideal, even though 1 is in the integers (in this case).
|
|
90
|
+
|
|
91
|
+
::
|
|
92
|
+
|
|
93
|
+
sage: R.<t> = ZZ['t']
|
|
94
|
+
sage: i = ideal(1,t,t^2)
|
|
95
|
+
sage: i
|
|
96
|
+
Ideal (1, t, t^2) of Univariate Polynomial Ring in t over Integer Ring
|
|
97
|
+
sage: ideal(1/2,t,t^2)
|
|
98
|
+
Principal ideal (1) of Univariate Polynomial Ring in t over Rational Field
|
|
99
|
+
|
|
100
|
+
This shows that the issues at :issue:`1104` are resolved::
|
|
101
|
+
|
|
102
|
+
sage: Ideal(3, 5)
|
|
103
|
+
Principal ideal (1) of Integer Ring
|
|
104
|
+
sage: Ideal(ZZ, 3, 5)
|
|
105
|
+
Principal ideal (1) of Integer Ring
|
|
106
|
+
sage: Ideal(2, 4, 6)
|
|
107
|
+
Principal ideal (2) of Integer Ring
|
|
108
|
+
|
|
109
|
+
You have to provide enough information that Sage can figure out
|
|
110
|
+
which ring to put the ideal in.
|
|
111
|
+
|
|
112
|
+
::
|
|
113
|
+
|
|
114
|
+
sage: I = Ideal([])
|
|
115
|
+
Traceback (most recent call last):
|
|
116
|
+
...
|
|
117
|
+
ValueError: unable to determine which ring to embed the ideal in
|
|
118
|
+
|
|
119
|
+
sage: I = Ideal()
|
|
120
|
+
Traceback (most recent call last):
|
|
121
|
+
...
|
|
122
|
+
ValueError: need at least one argument
|
|
123
|
+
|
|
124
|
+
Note that some rings use different ideal implementations than the standard,
|
|
125
|
+
even if they are PIDs.::
|
|
126
|
+
|
|
127
|
+
sage: R.<x> = GF(5)[]
|
|
128
|
+
sage: I = R * (x^2 + 3)
|
|
129
|
+
sage: type(I)
|
|
130
|
+
<class 'sage.rings.polynomial.ideal.Ideal_1poly_field'>
|
|
131
|
+
|
|
132
|
+
You can also pass in a specific ideal type::
|
|
133
|
+
|
|
134
|
+
sage: from sage.rings.ideal import Ideal_pid
|
|
135
|
+
sage: I = Ideal(x^2+3,ideal_class=Ideal_pid)
|
|
136
|
+
sage: type(I)
|
|
137
|
+
<class 'sage.rings.ideal.Ideal_pid'>
|
|
138
|
+
|
|
139
|
+
TESTS::
|
|
140
|
+
|
|
141
|
+
sage: R.<x> = ZZ[]
|
|
142
|
+
sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2])
|
|
143
|
+
sage: I == loads(dumps(I))
|
|
144
|
+
True
|
|
145
|
+
|
|
146
|
+
::
|
|
147
|
+
|
|
148
|
+
sage: I = Ideal(R, [4 + 3*x + x^2, 1 + x^2])
|
|
149
|
+
sage: I == loads(dumps(I))
|
|
150
|
+
True
|
|
151
|
+
|
|
152
|
+
::
|
|
153
|
+
|
|
154
|
+
sage: I = Ideal((4 + 3*x + x^2, 1 + x^2))
|
|
155
|
+
sage: I == loads(dumps(I))
|
|
156
|
+
True
|
|
157
|
+
|
|
158
|
+
This shows that the issue at :issue:`5477` is fixed::
|
|
159
|
+
|
|
160
|
+
sage: R.<x> = QQ[]
|
|
161
|
+
sage: I = R.ideal([x + x^2])
|
|
162
|
+
sage: J = R.ideal([2*x + 2*x^2])
|
|
163
|
+
sage: J
|
|
164
|
+
Principal ideal (x^2 + x) of Univariate Polynomial Ring in x over Rational Field
|
|
165
|
+
sage: S = R.quotient_ring(I) # needs sage.libs.pari
|
|
166
|
+
sage: U = R.quotient_ring(J) # needs sage.libs.pari
|
|
167
|
+
sage: I == J
|
|
168
|
+
True
|
|
169
|
+
sage: S == U # needs sage.libs.pari
|
|
170
|
+
True
|
|
171
|
+
"""
|
|
172
|
+
if len(args) == 0:
|
|
173
|
+
raise ValueError("need at least one argument")
|
|
174
|
+
if len(args) == 1 and args[0] == []:
|
|
175
|
+
raise ValueError("unable to determine which ring to embed the ideal in")
|
|
176
|
+
|
|
177
|
+
first = args[0]
|
|
178
|
+
|
|
179
|
+
inferred_field = False
|
|
180
|
+
if first not in _Rings:
|
|
181
|
+
if isinstance(first, Ideal_generic) and len(args) == 1:
|
|
182
|
+
R = first.ring()
|
|
183
|
+
gens = first.gens()
|
|
184
|
+
else:
|
|
185
|
+
if isinstance(first, (list, tuple, GeneratorType)) and len(args) == 1:
|
|
186
|
+
gens = first
|
|
187
|
+
else:
|
|
188
|
+
gens = args
|
|
189
|
+
gens = Sequence(gens)
|
|
190
|
+
R = gens.universe()
|
|
191
|
+
inferred_field = R in _Fields
|
|
192
|
+
else:
|
|
193
|
+
R = first
|
|
194
|
+
gens = args[1:]
|
|
195
|
+
|
|
196
|
+
if R not in _Rings.Commutative():
|
|
197
|
+
raise TypeError("R must be a commutative ring")
|
|
198
|
+
|
|
199
|
+
I = R.ideal(*gens, **kwds)
|
|
200
|
+
|
|
201
|
+
if inferred_field and not isinstance(I, Ideal_fractional): # trac 32320
|
|
202
|
+
import warnings
|
|
203
|
+
warnings.warn(f'Constructing an ideal in {R}, which is a field.'
|
|
204
|
+
' Did you intend to take numerators first?'
|
|
205
|
+
' This warning can be muted by passing the base ring to Ideal() explicitly.')
|
|
206
|
+
|
|
207
|
+
return I
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def is_Ideal(x):
|
|
211
|
+
r"""
|
|
212
|
+
Return ``True`` if object is an ideal of a ring.
|
|
213
|
+
|
|
214
|
+
EXAMPLES:
|
|
215
|
+
|
|
216
|
+
A simple example involving the ring of integers. Note
|
|
217
|
+
that Sage does not interpret rings objects themselves as ideals.
|
|
218
|
+
However, one can still explicitly construct these ideals::
|
|
219
|
+
|
|
220
|
+
sage: from sage.rings.ideal import is_Ideal
|
|
221
|
+
sage: R = ZZ
|
|
222
|
+
sage: is_Ideal(R)
|
|
223
|
+
doctest:warning...
|
|
224
|
+
DeprecationWarning: The function is_Ideal is deprecated; use 'isinstance(..., Ideal_generic)' instead.
|
|
225
|
+
See https://github.com/sagemath/sage/issues/38266 for details.
|
|
226
|
+
False
|
|
227
|
+
sage: 1*R; is_Ideal(1*R)
|
|
228
|
+
Principal ideal (1) of Integer Ring
|
|
229
|
+
True
|
|
230
|
+
sage: 0*R; is_Ideal(0*R)
|
|
231
|
+
Principal ideal (0) of Integer Ring
|
|
232
|
+
True
|
|
233
|
+
|
|
234
|
+
Sage recognizes ideals of polynomial rings as well::
|
|
235
|
+
|
|
236
|
+
sage: R = PolynomialRing(QQ, 'x'); x = R.gen()
|
|
237
|
+
sage: I = R.ideal(x^2 + 1); I
|
|
238
|
+
Principal ideal (x^2 + 1) of Univariate Polynomial Ring in x over Rational Field
|
|
239
|
+
sage: is_Ideal(I)
|
|
240
|
+
True
|
|
241
|
+
sage: is_Ideal((x^2 + 1)*R)
|
|
242
|
+
True
|
|
243
|
+
"""
|
|
244
|
+
from sage.misc.superseded import deprecation
|
|
245
|
+
deprecation(38266,
|
|
246
|
+
"The function is_Ideal is deprecated; "
|
|
247
|
+
"use 'isinstance(..., Ideal_generic)' instead.")
|
|
248
|
+
return isinstance(x, Ideal_generic)
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
class Ideal_generic(MonoidElement):
|
|
252
|
+
"""
|
|
253
|
+
An ideal.
|
|
254
|
+
|
|
255
|
+
See :func:`Ideal()`.
|
|
256
|
+
"""
|
|
257
|
+
def __init__(self, ring, gens, coerce=True, **kwds):
|
|
258
|
+
"""
|
|
259
|
+
Initialize this ideal.
|
|
260
|
+
|
|
261
|
+
INPUT:
|
|
262
|
+
|
|
263
|
+
- ``ring`` -- a ring
|
|
264
|
+
|
|
265
|
+
- ``gens`` -- the generators for this ideal
|
|
266
|
+
|
|
267
|
+
- ``coerce`` -- boolean (default: ``True``); if ``gens`` needs to be coerced
|
|
268
|
+
into ``ring``
|
|
269
|
+
|
|
270
|
+
EXAMPLES::
|
|
271
|
+
|
|
272
|
+
sage: R.<x> = ZZ[]
|
|
273
|
+
sage: R.ideal([4 + 3*x + x^2, 1 + x^2])
|
|
274
|
+
Ideal (x^2 + 3*x + 4, x^2 + 1) of Univariate Polynomial Ring in x over Integer Ring
|
|
275
|
+
"""
|
|
276
|
+
self.__ring = ring
|
|
277
|
+
if not isinstance(gens, (list, tuple)):
|
|
278
|
+
gens = [gens]
|
|
279
|
+
if coerce:
|
|
280
|
+
gens = [ring(x) for x in gens]
|
|
281
|
+
|
|
282
|
+
gens = tuple(gens)
|
|
283
|
+
if not gens:
|
|
284
|
+
gens = (ring.zero(),)
|
|
285
|
+
self.__gens = gens
|
|
286
|
+
MonoidElement.__init__(self, ring.ideal_monoid())
|
|
287
|
+
|
|
288
|
+
def _repr_short(self):
|
|
289
|
+
"""
|
|
290
|
+
Represent the list of generators.
|
|
291
|
+
|
|
292
|
+
EXAMPLES::
|
|
293
|
+
|
|
294
|
+
sage: P.<a,b,c> = QQ[]
|
|
295
|
+
sage: P*[a^2,a*b+c,c^3]
|
|
296
|
+
Ideal (a^2, a*b + c, c^3) of Multivariate Polynomial Ring in a, b, c over Rational Field
|
|
297
|
+
sage: (P*[a^2,a*b+c,c^3])._repr_short()
|
|
298
|
+
'(a^2, a*b + c, c^3)'
|
|
299
|
+
|
|
300
|
+
If the string representation of a generator contains a line break,
|
|
301
|
+
the generators are not represented from left to right but from
|
|
302
|
+
top to bottom. This is the case, e.g., for matrices::
|
|
303
|
+
|
|
304
|
+
sage: MS = MatrixSpace(QQ, 2, 2) # needs sage.modules
|
|
305
|
+
sage: MS * [MS.1, 2] # needs sage.modules
|
|
306
|
+
Left Ideal
|
|
307
|
+
(
|
|
308
|
+
[0 1]
|
|
309
|
+
[0 0],
|
|
310
|
+
<BLANKLINE>
|
|
311
|
+
[2 0]
|
|
312
|
+
[0 2]
|
|
313
|
+
)
|
|
314
|
+
of Full MatrixSpace of 2 by 2 dense matrices over Rational Field
|
|
315
|
+
"""
|
|
316
|
+
L = []
|
|
317
|
+
has_return = False
|
|
318
|
+
for x in self.gens():
|
|
319
|
+
s = repr(x)
|
|
320
|
+
if '\n' in s:
|
|
321
|
+
has_return = True
|
|
322
|
+
s = s.replace('\n','\n ')
|
|
323
|
+
L.append(s)
|
|
324
|
+
if has_return:
|
|
325
|
+
return '\n(\n %s\n)\n' % (',\n\n '.join(L))
|
|
326
|
+
return '(%s)' % (', '.join(L))
|
|
327
|
+
|
|
328
|
+
def _repr_(self):
|
|
329
|
+
"""
|
|
330
|
+
Return a string representation of ``self``.
|
|
331
|
+
|
|
332
|
+
EXAMPLES::
|
|
333
|
+
|
|
334
|
+
sage: P.<a,b,c> = QQ[]
|
|
335
|
+
sage: P*[a^2,a*b+c,c^3] # indirect doctest
|
|
336
|
+
Ideal (a^2, a*b + c, c^3) of Multivariate Polynomial Ring in a, b, c over Rational Field
|
|
337
|
+
"""
|
|
338
|
+
return "Ideal %s of %s" % (self._repr_short(), self.ring())
|
|
339
|
+
|
|
340
|
+
def random_element(self, *args, **kwds):
|
|
341
|
+
"""
|
|
342
|
+
Return a random element in this ideal.
|
|
343
|
+
|
|
344
|
+
EXAMPLES::
|
|
345
|
+
|
|
346
|
+
sage: P.<a,b,c> = GF(5)[[]]
|
|
347
|
+
sage: I = P.ideal([a^2, a*b + c, c^3])
|
|
348
|
+
sage: I.random_element() # random
|
|
349
|
+
2*a^5*c + a^2*b*c^4 + ... + O(a, b, c)^13
|
|
350
|
+
"""
|
|
351
|
+
return sum(self.__ring.random_element(*args, **kwds) * g for g in self.__gens)
|
|
352
|
+
|
|
353
|
+
def _richcmp_(self, other, op):
|
|
354
|
+
"""
|
|
355
|
+
Compare the generators of two ideals.
|
|
356
|
+
|
|
357
|
+
INPUT:
|
|
358
|
+
|
|
359
|
+
- ``other`` -- an ideal
|
|
360
|
+
|
|
361
|
+
OUTPUT: boolean
|
|
362
|
+
|
|
363
|
+
EXAMPLES::
|
|
364
|
+
|
|
365
|
+
sage: R = ZZ; I = ZZ*2; J = ZZ*(-2)
|
|
366
|
+
sage: I == J
|
|
367
|
+
True
|
|
368
|
+
"""
|
|
369
|
+
S = set(self.gens())
|
|
370
|
+
T = set(other.gens())
|
|
371
|
+
if S == T:
|
|
372
|
+
return rich_to_bool(op, 0)
|
|
373
|
+
return richcmp(self.gens(), other.gens(), op)
|
|
374
|
+
|
|
375
|
+
def __contains__(self, x):
|
|
376
|
+
"""
|
|
377
|
+
Check if ``x`` is in ``self``.
|
|
378
|
+
|
|
379
|
+
EXAMPLES::
|
|
380
|
+
|
|
381
|
+
sage: P.<a,b,c> = QQ[]
|
|
382
|
+
sage: I = P * [a, b]
|
|
383
|
+
sage: a + b in I # needs sage.libs.singular
|
|
384
|
+
True
|
|
385
|
+
sage: P2.<w,x,y,z> = QQ[]
|
|
386
|
+
sage: x + 2*y + w*z in I
|
|
387
|
+
False
|
|
388
|
+
"""
|
|
389
|
+
try:
|
|
390
|
+
return self._contains_(self.__ring(x))
|
|
391
|
+
except TypeError:
|
|
392
|
+
return False
|
|
393
|
+
|
|
394
|
+
def _contains_(self, x):
|
|
395
|
+
"""
|
|
396
|
+
Check if ``x``, which is assumed to be in the ambient ring, is in
|
|
397
|
+
this ideal.
|
|
398
|
+
|
|
399
|
+
.. TODO::
|
|
400
|
+
|
|
401
|
+
Implement this method.
|
|
402
|
+
|
|
403
|
+
EXAMPLES::
|
|
404
|
+
|
|
405
|
+
sage: P.<a> = ZZ[]
|
|
406
|
+
sage: I = P*[a]
|
|
407
|
+
sage: I._contains_(a)
|
|
408
|
+
Traceback (most recent call last):
|
|
409
|
+
...
|
|
410
|
+
NotImplementedError
|
|
411
|
+
|
|
412
|
+
Note that calling ``in`` does not call this method::
|
|
413
|
+
|
|
414
|
+
sage: a in I
|
|
415
|
+
True
|
|
416
|
+
"""
|
|
417
|
+
raise NotImplementedError
|
|
418
|
+
|
|
419
|
+
def __bool__(self):
|
|
420
|
+
r"""
|
|
421
|
+
Return ``True`` if this ideal is not `(0)`.
|
|
422
|
+
|
|
423
|
+
TESTS::
|
|
424
|
+
|
|
425
|
+
sage: I = ZZ.ideal(5)
|
|
426
|
+
sage: bool(I)
|
|
427
|
+
True
|
|
428
|
+
|
|
429
|
+
::
|
|
430
|
+
|
|
431
|
+
sage: I = ZZ['x'].ideal(0)
|
|
432
|
+
sage: bool(I)
|
|
433
|
+
False
|
|
434
|
+
|
|
435
|
+
::
|
|
436
|
+
|
|
437
|
+
sage: I = ZZ['x'].ideal(ZZ['x'].gen()^2)
|
|
438
|
+
sage: bool(I)
|
|
439
|
+
True
|
|
440
|
+
|
|
441
|
+
::
|
|
442
|
+
|
|
443
|
+
sage: I = QQ['x', 'y'].ideal(0)
|
|
444
|
+
sage: bool(I)
|
|
445
|
+
False
|
|
446
|
+
"""
|
|
447
|
+
for g in self.gens():
|
|
448
|
+
if not g.is_zero():
|
|
449
|
+
return True
|
|
450
|
+
return False
|
|
451
|
+
|
|
452
|
+
def base_ring(self):
|
|
453
|
+
r"""
|
|
454
|
+
Return the base ring of this ideal.
|
|
455
|
+
|
|
456
|
+
EXAMPLES::
|
|
457
|
+
|
|
458
|
+
sage: R = ZZ
|
|
459
|
+
sage: I = 3*R; I
|
|
460
|
+
Principal ideal (3) of Integer Ring
|
|
461
|
+
sage: J = 2*I; J
|
|
462
|
+
Principal ideal (6) of Integer Ring
|
|
463
|
+
sage: I.base_ring(); J.base_ring()
|
|
464
|
+
Integer Ring
|
|
465
|
+
Integer Ring
|
|
466
|
+
|
|
467
|
+
We construct an example of an ideal of a quotient ring::
|
|
468
|
+
|
|
469
|
+
sage: R = PolynomialRing(QQ, 'x'); x = R.gen()
|
|
470
|
+
sage: I = R.ideal(x^2 - 2)
|
|
471
|
+
sage: I.base_ring()
|
|
472
|
+
Rational Field
|
|
473
|
+
|
|
474
|
+
And `p`-adic numbers::
|
|
475
|
+
|
|
476
|
+
sage: R = Zp(7, prec=10); R # needs sage.rings.padics
|
|
477
|
+
7-adic Ring with capped relative precision 10
|
|
478
|
+
sage: I = 7*R; I # needs sage.rings.padics
|
|
479
|
+
Principal ideal (7 + O(7^11)) of 7-adic Ring with capped relative precision 10
|
|
480
|
+
sage: I.base_ring() # needs sage.rings.padics
|
|
481
|
+
7-adic Ring with capped relative precision 10
|
|
482
|
+
"""
|
|
483
|
+
return self.ring().base_ring()
|
|
484
|
+
|
|
485
|
+
def apply_morphism(self, phi):
|
|
486
|
+
r"""
|
|
487
|
+
Apply the morphism ``phi`` to every element of this ideal.
|
|
488
|
+
Returns an ideal in the domain of ``phi``.
|
|
489
|
+
|
|
490
|
+
EXAMPLES::
|
|
491
|
+
|
|
492
|
+
sage: # needs sage.rings.real_mpfr
|
|
493
|
+
sage: psi = CC['x'].hom([-CC['x'].0])
|
|
494
|
+
sage: J = ideal([CC['x'].0 + 1]); J
|
|
495
|
+
Principal ideal (x + 1.00000000000000) of Univariate Polynomial Ring in x
|
|
496
|
+
over Complex Field with 53 bits of precision
|
|
497
|
+
sage: psi(J)
|
|
498
|
+
Principal ideal (x - 1.00000000000000) of Univariate Polynomial Ring in x
|
|
499
|
+
over Complex Field with 53 bits of precision
|
|
500
|
+
sage: J.apply_morphism(psi)
|
|
501
|
+
Principal ideal (x - 1.00000000000000) of Univariate Polynomial Ring in x
|
|
502
|
+
over Complex Field with 53 bits of precision
|
|
503
|
+
|
|
504
|
+
::
|
|
505
|
+
|
|
506
|
+
sage: psi = ZZ['x'].hom([-ZZ['x'].0])
|
|
507
|
+
sage: J = ideal([ZZ['x'].0, 2]); J
|
|
508
|
+
Ideal (x, 2) of Univariate Polynomial Ring in x over Integer Ring
|
|
509
|
+
sage: psi(J)
|
|
510
|
+
Ideal (-x, 2) of Univariate Polynomial Ring in x over Integer Ring
|
|
511
|
+
sage: J.apply_morphism(psi)
|
|
512
|
+
Ideal (-x, 2) of Univariate Polynomial Ring in x over Integer Ring
|
|
513
|
+
|
|
514
|
+
TESTS::
|
|
515
|
+
|
|
516
|
+
sage: # needs sage.rings.number_field
|
|
517
|
+
sage: x = polygen(ZZ)
|
|
518
|
+
sage: K.<a> = NumberField(x^2 + 1)
|
|
519
|
+
sage: A = K.ideal(a)
|
|
520
|
+
sage: taus = K.embeddings(K)
|
|
521
|
+
sage: A.apply_morphism(taus[0]) # identity
|
|
522
|
+
Fractional ideal (a)
|
|
523
|
+
sage: A.apply_morphism(taus[1]) # complex conjugation
|
|
524
|
+
Fractional ideal (-a)
|
|
525
|
+
sage: A.apply_morphism(taus[0]) == A.apply_morphism(taus[1])
|
|
526
|
+
True
|
|
527
|
+
|
|
528
|
+
::
|
|
529
|
+
|
|
530
|
+
sage: # needs sage.rings.number_field
|
|
531
|
+
sage: K.<a> = NumberField(x^2 + 5)
|
|
532
|
+
sage: B = K.ideal([2, a + 1]); B
|
|
533
|
+
Fractional ideal (2, a + 1)
|
|
534
|
+
sage: taus = K.embeddings(K)
|
|
535
|
+
sage: B.apply_morphism(taus[0]) # identity
|
|
536
|
+
Fractional ideal (2, a + 1)
|
|
537
|
+
|
|
538
|
+
Since 2 is totally ramified, complex conjugation fixes it::
|
|
539
|
+
|
|
540
|
+
sage: B.apply_morphism(taus[1]) # complex conjugation # needs sage.rings.number_field
|
|
541
|
+
Fractional ideal (2, a + 1)
|
|
542
|
+
sage: taus[1](B) # needs sage.rings.number_field
|
|
543
|
+
Fractional ideal (2, a + 1)
|
|
544
|
+
"""
|
|
545
|
+
from sage.categories.morphism import Morphism
|
|
546
|
+
if not isinstance(phi, Morphism):
|
|
547
|
+
raise TypeError("phi must be a morphism")
|
|
548
|
+
# delegate: morphisms know how to apply themselves to ideals
|
|
549
|
+
return phi(self)
|
|
550
|
+
|
|
551
|
+
def _latex_(self):
|
|
552
|
+
r"""
|
|
553
|
+
Return a latex representation of ``self``.
|
|
554
|
+
|
|
555
|
+
EXAMPLES::
|
|
556
|
+
|
|
557
|
+
sage: latex(3*ZZ) # indirect doctest
|
|
558
|
+
\left(3\right)\Bold{Z}
|
|
559
|
+
"""
|
|
560
|
+
import sage.misc.latex as latex
|
|
561
|
+
return '\\left(%s\\right)%s' % (", ".join(latex.latex(g)
|
|
562
|
+
for g in self.gens()),
|
|
563
|
+
latex.latex(self.ring()))
|
|
564
|
+
|
|
565
|
+
def ring(self):
|
|
566
|
+
"""
|
|
567
|
+
Return the ring containing this ideal.
|
|
568
|
+
|
|
569
|
+
EXAMPLES::
|
|
570
|
+
|
|
571
|
+
sage: R = ZZ
|
|
572
|
+
sage: I = 3*R; I
|
|
573
|
+
Principal ideal (3) of Integer Ring
|
|
574
|
+
sage: J = 2*I; J
|
|
575
|
+
Principal ideal (6) of Integer Ring
|
|
576
|
+
sage: I.ring(); J.ring()
|
|
577
|
+
Integer Ring
|
|
578
|
+
Integer Ring
|
|
579
|
+
|
|
580
|
+
Note that ``self.ring()`` is different from
|
|
581
|
+
``self.base_ring()``
|
|
582
|
+
|
|
583
|
+
::
|
|
584
|
+
|
|
585
|
+
sage: R = PolynomialRing(QQ, 'x'); x = R.gen()
|
|
586
|
+
sage: I = R.ideal(x^2 - 2)
|
|
587
|
+
sage: I.base_ring()
|
|
588
|
+
Rational Field
|
|
589
|
+
sage: I.ring()
|
|
590
|
+
Univariate Polynomial Ring in x over Rational Field
|
|
591
|
+
|
|
592
|
+
Another example using polynomial rings::
|
|
593
|
+
|
|
594
|
+
sage: R = PolynomialRing(QQ, 'x'); x = R.gen()
|
|
595
|
+
sage: I = R.ideal(x^2 - 3)
|
|
596
|
+
sage: I.ring()
|
|
597
|
+
Univariate Polynomial Ring in x over Rational Field
|
|
598
|
+
sage: Rbar = R.quotient(I, names='a') # needs sage.libs.pari
|
|
599
|
+
sage: S = PolynomialRing(Rbar, 'y'); y = Rbar.gen(); S # needs sage.libs.pari
|
|
600
|
+
Univariate Polynomial Ring in y over
|
|
601
|
+
Univariate Quotient Polynomial Ring in a over Rational Field with modulus x^2 - 3
|
|
602
|
+
sage: J = S.ideal(y^2 + 1) # needs sage.libs.pari
|
|
603
|
+
sage: J.ring() # needs sage.libs.pari
|
|
604
|
+
Univariate Polynomial Ring in y over
|
|
605
|
+
Univariate Quotient Polynomial Ring in a over Rational Field with modulus x^2 - 3
|
|
606
|
+
"""
|
|
607
|
+
return self.__ring
|
|
608
|
+
|
|
609
|
+
def reduce(self, f):
|
|
610
|
+
r"""
|
|
611
|
+
Return the reduction of the element of `f` modulo ``self``.
|
|
612
|
+
|
|
613
|
+
This is an element of `R` that is equivalent modulo `I` to `f` where
|
|
614
|
+
`I` is ``self``.
|
|
615
|
+
|
|
616
|
+
EXAMPLES::
|
|
617
|
+
|
|
618
|
+
sage: ZZ.ideal(5).reduce(17)
|
|
619
|
+
2
|
|
620
|
+
sage: parent(ZZ.ideal(5).reduce(17))
|
|
621
|
+
Integer Ring
|
|
622
|
+
"""
|
|
623
|
+
return f # default
|
|
624
|
+
|
|
625
|
+
def gens(self): # -> tuple | PolynomialSequence
|
|
626
|
+
"""
|
|
627
|
+
Return a set of generators / a basis of ``self``.
|
|
628
|
+
|
|
629
|
+
This is the set of generators provided during creation of this ideal.
|
|
630
|
+
|
|
631
|
+
EXAMPLES::
|
|
632
|
+
|
|
633
|
+
sage: P.<x,y> = PolynomialRing(QQ,2)
|
|
634
|
+
sage: I = Ideal([x,y+1]); I
|
|
635
|
+
Ideal (x, y + 1) of Multivariate Polynomial Ring in x, y over Rational Field
|
|
636
|
+
sage: I.gens()
|
|
637
|
+
[x, y + 1]
|
|
638
|
+
|
|
639
|
+
::
|
|
640
|
+
|
|
641
|
+
sage: ZZ.ideal(5,10).gens()
|
|
642
|
+
(5,)
|
|
643
|
+
"""
|
|
644
|
+
return self.__gens
|
|
645
|
+
|
|
646
|
+
def gen(self, i):
|
|
647
|
+
"""
|
|
648
|
+
Return the ``i``-th generator in the current basis of this ideal.
|
|
649
|
+
|
|
650
|
+
EXAMPLES::
|
|
651
|
+
|
|
652
|
+
sage: P.<x,y> = PolynomialRing(QQ,2)
|
|
653
|
+
sage: I = Ideal([x,y+1]); I
|
|
654
|
+
Ideal (x, y + 1) of Multivariate Polynomial Ring in x, y over Rational Field
|
|
655
|
+
sage: I.gen(1)
|
|
656
|
+
y + 1
|
|
657
|
+
|
|
658
|
+
sage: ZZ.ideal(5,10).gen()
|
|
659
|
+
5
|
|
660
|
+
"""
|
|
661
|
+
return self.__gens[i]
|
|
662
|
+
|
|
663
|
+
def ngens(self):
|
|
664
|
+
"""
|
|
665
|
+
Return the number of generators in the basis.
|
|
666
|
+
|
|
667
|
+
EXAMPLES::
|
|
668
|
+
|
|
669
|
+
sage: P.<x,y> = PolynomialRing(QQ,2)
|
|
670
|
+
sage: I = Ideal([x,y+1]); I
|
|
671
|
+
Ideal (x, y + 1) of Multivariate Polynomial Ring in x, y over Rational Field
|
|
672
|
+
sage: I.ngens()
|
|
673
|
+
2
|
|
674
|
+
|
|
675
|
+
sage: ZZ.ideal(5,10).ngens()
|
|
676
|
+
1
|
|
677
|
+
"""
|
|
678
|
+
return len(self.__gens)
|
|
679
|
+
|
|
680
|
+
def gens_reduced(self):
|
|
681
|
+
r"""
|
|
682
|
+
Same as :meth:`gens()` for this ideal, since there is currently no
|
|
683
|
+
special ``gens_reduced`` algorithm implemented for this ring.
|
|
684
|
+
|
|
685
|
+
This method is provided so that ideals in `\ZZ` have the method
|
|
686
|
+
``gens_reduced()``, just like ideals of number fields.
|
|
687
|
+
|
|
688
|
+
EXAMPLES::
|
|
689
|
+
|
|
690
|
+
sage: ZZ.ideal(5).gens_reduced()
|
|
691
|
+
(5,)
|
|
692
|
+
"""
|
|
693
|
+
return self.gens()
|
|
694
|
+
|
|
695
|
+
def is_maximal(self):
|
|
696
|
+
r"""
|
|
697
|
+
Return ``True`` if the ideal is maximal in the ring containing the
|
|
698
|
+
ideal.
|
|
699
|
+
|
|
700
|
+
.. TODO::
|
|
701
|
+
|
|
702
|
+
This is not implemented for many rings. Implement it!
|
|
703
|
+
|
|
704
|
+
EXAMPLES::
|
|
705
|
+
|
|
706
|
+
sage: R = ZZ
|
|
707
|
+
sage: I = R.ideal(7)
|
|
708
|
+
sage: I.is_maximal()
|
|
709
|
+
True
|
|
710
|
+
sage: R.ideal(16).is_maximal()
|
|
711
|
+
False
|
|
712
|
+
sage: S = Integers(8)
|
|
713
|
+
sage: S.ideal(0).is_maximal()
|
|
714
|
+
False
|
|
715
|
+
sage: S.ideal(2).is_maximal()
|
|
716
|
+
True
|
|
717
|
+
sage: S.ideal(4).is_maximal()
|
|
718
|
+
False
|
|
719
|
+
"""
|
|
720
|
+
from sage.rings.integer_ring import ZZ
|
|
721
|
+
R = self.ring()
|
|
722
|
+
if hasattr(R, 'cover_ring') and R.cover_ring() is ZZ:
|
|
723
|
+
# The following test only works for quotients of Z/nZ: for
|
|
724
|
+
# many other rings in Sage, testing whether R/I is a field
|
|
725
|
+
# is done by testing whether I is maximal, so this would
|
|
726
|
+
# result in a loop.
|
|
727
|
+
return R.quotient(self).is_field()
|
|
728
|
+
kd = R.krull_dimension()
|
|
729
|
+
if kd == 0 or (kd == 1 and R.is_integral_domain()):
|
|
730
|
+
# For rings of Krull dimension 0, or for integral domains of
|
|
731
|
+
# Krull dimension 1, every nontrivial prime ideal is maximal.
|
|
732
|
+
return self.is_prime()
|
|
733
|
+
else:
|
|
734
|
+
raise NotImplementedError
|
|
735
|
+
|
|
736
|
+
def is_primary(self, P=None):
|
|
737
|
+
r"""
|
|
738
|
+
Return ``True`` if this ideal is primary (or `P`-primary, if
|
|
739
|
+
a prime ideal `P` is specified).
|
|
740
|
+
|
|
741
|
+
Recall that an ideal `I` is primary if and only if `I` has a
|
|
742
|
+
unique associated prime (see page 52 in [AM1969]_). If this
|
|
743
|
+
prime is `P`, then `I` is said to be `P`-primary.
|
|
744
|
+
|
|
745
|
+
INPUT:
|
|
746
|
+
|
|
747
|
+
- ``P`` -- (default: ``None``) a prime ideal in the same ring
|
|
748
|
+
|
|
749
|
+
EXAMPLES::
|
|
750
|
+
|
|
751
|
+
sage: R.<x, y> = QQ[]
|
|
752
|
+
sage: I = R.ideal([x^2, x*y])
|
|
753
|
+
sage: I.is_primary() # needs sage.libs.singular
|
|
754
|
+
False
|
|
755
|
+
sage: J = I.primary_decomposition()[1]; J # needs sage.libs.singular
|
|
756
|
+
Ideal (y, x^2) of Multivariate Polynomial Ring in x, y over Rational Field
|
|
757
|
+
sage: J.is_primary() # needs sage.libs.singular
|
|
758
|
+
True
|
|
759
|
+
sage: J.is_prime() # needs sage.libs.singular
|
|
760
|
+
False
|
|
761
|
+
|
|
762
|
+
Some examples from the Macaulay2 documentation::
|
|
763
|
+
|
|
764
|
+
sage: # needs sage.rings.finite_rings
|
|
765
|
+
sage: R.<x, y, z> = GF(101)[]
|
|
766
|
+
sage: I = R.ideal([y^6])
|
|
767
|
+
sage: I.is_primary() # needs sage.libs.singular
|
|
768
|
+
True
|
|
769
|
+
sage: I.is_primary(R.ideal([y])) # needs sage.libs.singular
|
|
770
|
+
True
|
|
771
|
+
sage: I = R.ideal([x^4, y^7])
|
|
772
|
+
sage: I.is_primary() # needs sage.libs.singular
|
|
773
|
+
True
|
|
774
|
+
sage: I = R.ideal([x*y, y^2])
|
|
775
|
+
sage: I.is_primary() # needs sage.libs.singular
|
|
776
|
+
False
|
|
777
|
+
|
|
778
|
+
.. NOTE::
|
|
779
|
+
|
|
780
|
+
This uses the list of associated primes.
|
|
781
|
+
"""
|
|
782
|
+
try:
|
|
783
|
+
ass = self.associated_primes()
|
|
784
|
+
except (NotImplementedError, ValueError):
|
|
785
|
+
raise NotImplementedError
|
|
786
|
+
if P is None:
|
|
787
|
+
return (len(ass) == 1)
|
|
788
|
+
else:
|
|
789
|
+
return (len(ass) == 1) and (ass[0] == P)
|
|
790
|
+
|
|
791
|
+
def primary_decomposition(self):
|
|
792
|
+
r"""
|
|
793
|
+
Return a decomposition of this ideal into primary ideals.
|
|
794
|
+
|
|
795
|
+
EXAMPLES::
|
|
796
|
+
|
|
797
|
+
sage: R = ZZ['x']
|
|
798
|
+
sage: I = R.ideal(7)
|
|
799
|
+
sage: I.primary_decomposition()
|
|
800
|
+
Traceback (most recent call last):
|
|
801
|
+
...
|
|
802
|
+
NotImplementedError
|
|
803
|
+
"""
|
|
804
|
+
raise NotImplementedError
|
|
805
|
+
|
|
806
|
+
def is_prime(self):
|
|
807
|
+
r"""
|
|
808
|
+
Return ``True`` if this ideal is prime.
|
|
809
|
+
|
|
810
|
+
EXAMPLES::
|
|
811
|
+
|
|
812
|
+
sage: R.<x, y> = QQ[]
|
|
813
|
+
sage: I = R.ideal([x, y])
|
|
814
|
+
sage: I.is_prime() # a maximal ideal # needs sage.libs.singular
|
|
815
|
+
True
|
|
816
|
+
sage: I = R.ideal([x^2 - y])
|
|
817
|
+
sage: I.is_prime() # a non-maximal prime ideal # needs sage.libs.singular
|
|
818
|
+
True
|
|
819
|
+
sage: I = R.ideal([x^2, y])
|
|
820
|
+
sage: I.is_prime() # a non-prime primary ideal # needs sage.libs.singular
|
|
821
|
+
False
|
|
822
|
+
sage: I = R.ideal([x^2, x*y])
|
|
823
|
+
sage: I.is_prime() # a non-prime non-primary ideal # needs sage.libs.singular
|
|
824
|
+
False
|
|
825
|
+
|
|
826
|
+
sage: S = Integers(8)
|
|
827
|
+
sage: S.ideal(0).is_prime()
|
|
828
|
+
False
|
|
829
|
+
sage: S.ideal(2).is_prime()
|
|
830
|
+
True
|
|
831
|
+
sage: S.ideal(4).is_prime()
|
|
832
|
+
False
|
|
833
|
+
|
|
834
|
+
Note that this method is not implemented for all rings where it
|
|
835
|
+
could be::
|
|
836
|
+
|
|
837
|
+
sage: R.<x> = ZZ[]
|
|
838
|
+
sage: I = R.ideal(7)
|
|
839
|
+
sage: I.is_prime() # when implemented, should be True
|
|
840
|
+
Traceback (most recent call last):
|
|
841
|
+
...
|
|
842
|
+
NotImplementedError
|
|
843
|
+
|
|
844
|
+
.. NOTE::
|
|
845
|
+
|
|
846
|
+
For general rings, uses the list of associated primes.
|
|
847
|
+
"""
|
|
848
|
+
from sage.rings.integer_ring import ZZ
|
|
849
|
+
R = self.ring()
|
|
850
|
+
if hasattr(R, 'cover_ring') and R.cover_ring() is ZZ and R.is_finite():
|
|
851
|
+
# For quotient rings of ZZ, prime is the same as maximal.
|
|
852
|
+
return self.is_maximal()
|
|
853
|
+
try:
|
|
854
|
+
ass = self.associated_primes()
|
|
855
|
+
except (NotImplementedError, ValueError):
|
|
856
|
+
raise NotImplementedError
|
|
857
|
+
if len(ass) != 1:
|
|
858
|
+
return False
|
|
859
|
+
if self == ass[0]:
|
|
860
|
+
return True
|
|
861
|
+
else:
|
|
862
|
+
return False
|
|
863
|
+
|
|
864
|
+
def associated_primes(self):
|
|
865
|
+
r"""
|
|
866
|
+
Return the list of associated prime ideals of this ideal.
|
|
867
|
+
|
|
868
|
+
EXAMPLES::
|
|
869
|
+
|
|
870
|
+
sage: R = ZZ['x']
|
|
871
|
+
sage: I = R.ideal(7)
|
|
872
|
+
sage: I.associated_primes()
|
|
873
|
+
Traceback (most recent call last):
|
|
874
|
+
...
|
|
875
|
+
NotImplementedError
|
|
876
|
+
"""
|
|
877
|
+
raise NotImplementedError
|
|
878
|
+
|
|
879
|
+
def minimal_associated_primes(self):
|
|
880
|
+
r"""
|
|
881
|
+
Return the list of minimal associated prime ideals of this ideal.
|
|
882
|
+
|
|
883
|
+
EXAMPLES::
|
|
884
|
+
|
|
885
|
+
sage: R = ZZ['x']
|
|
886
|
+
sage: I = R.ideal(7)
|
|
887
|
+
sage: I.minimal_associated_primes()
|
|
888
|
+
Traceback (most recent call last):
|
|
889
|
+
...
|
|
890
|
+
NotImplementedError
|
|
891
|
+
"""
|
|
892
|
+
raise NotImplementedError
|
|
893
|
+
|
|
894
|
+
def embedded_primes(self):
|
|
895
|
+
r"""
|
|
896
|
+
Return the list of embedded primes of this ideal.
|
|
897
|
+
|
|
898
|
+
EXAMPLES::
|
|
899
|
+
|
|
900
|
+
sage: R.<x, y> = QQ[]
|
|
901
|
+
sage: I = R.ideal(x^2, x*y)
|
|
902
|
+
sage: I.embedded_primes() # needs sage.libs.singular
|
|
903
|
+
[Ideal (y, x) of Multivariate Polynomial Ring in x, y over Rational Field]
|
|
904
|
+
"""
|
|
905
|
+
# by definition, embedded primes are associated primes that
|
|
906
|
+
# are not minimal (under inclusion)
|
|
907
|
+
ass = self.associated_primes()
|
|
908
|
+
min_ass = self.minimal_associated_primes()
|
|
909
|
+
emb = []
|
|
910
|
+
for p in ass:
|
|
911
|
+
try:
|
|
912
|
+
min_ass.index(p)
|
|
913
|
+
except ValueError:
|
|
914
|
+
emb.append(p)
|
|
915
|
+
emb.sort()
|
|
916
|
+
return emb
|
|
917
|
+
|
|
918
|
+
def is_principal(self):
|
|
919
|
+
r"""
|
|
920
|
+
Return ``True`` if the ideal is principal in the ring containing the
|
|
921
|
+
ideal.
|
|
922
|
+
|
|
923
|
+
.. TODO::
|
|
924
|
+
|
|
925
|
+
Code is naive. Only keeps track of ideal generators as set
|
|
926
|
+
during initialization of the ideal. (Can the base ring change? See
|
|
927
|
+
example below.)
|
|
928
|
+
|
|
929
|
+
EXAMPLES::
|
|
930
|
+
|
|
931
|
+
sage: R.<x> = ZZ[]
|
|
932
|
+
sage: I = R.ideal(2, x)
|
|
933
|
+
sage: I.is_principal()
|
|
934
|
+
Traceback (most recent call last):
|
|
935
|
+
...
|
|
936
|
+
NotImplementedError
|
|
937
|
+
sage: J = R.base_extend(QQ).ideal(2, x)
|
|
938
|
+
sage: J.is_principal()
|
|
939
|
+
True
|
|
940
|
+
"""
|
|
941
|
+
if len(self.gens()) <= 1:
|
|
942
|
+
return True
|
|
943
|
+
raise NotImplementedError
|
|
944
|
+
|
|
945
|
+
def is_trivial(self):
|
|
946
|
+
r"""
|
|
947
|
+
Return ``True`` if this ideal is `(0)` or `(1)`.
|
|
948
|
+
|
|
949
|
+
TESTS::
|
|
950
|
+
|
|
951
|
+
sage: I = ZZ.ideal(5)
|
|
952
|
+
sage: I.is_trivial()
|
|
953
|
+
False
|
|
954
|
+
|
|
955
|
+
::
|
|
956
|
+
|
|
957
|
+
sage: I = ZZ['x'].ideal(-1)
|
|
958
|
+
sage: I.is_trivial()
|
|
959
|
+
True
|
|
960
|
+
|
|
961
|
+
::
|
|
962
|
+
|
|
963
|
+
sage: I = ZZ['x'].ideal(ZZ['x'].gen()^2)
|
|
964
|
+
sage: I.is_trivial()
|
|
965
|
+
False
|
|
966
|
+
|
|
967
|
+
::
|
|
968
|
+
|
|
969
|
+
sage: I = QQ['x', 'y'].ideal(-5)
|
|
970
|
+
sage: I.is_trivial() # needs sage.libs.singular
|
|
971
|
+
True
|
|
972
|
+
|
|
973
|
+
::
|
|
974
|
+
|
|
975
|
+
sage: I = CC['x'].ideal(0) # needs sage.rings.real_mpfr
|
|
976
|
+
sage: I.is_trivial() # needs sage.rings.real_mpfr
|
|
977
|
+
True
|
|
978
|
+
|
|
979
|
+
This test addresses issue :issue:`20514`::
|
|
980
|
+
|
|
981
|
+
sage: R = QQ['x', 'y']
|
|
982
|
+
sage: I = R.ideal(R.gens())
|
|
983
|
+
sage: I.is_trivial() # needs sage.libs.singular
|
|
984
|
+
False
|
|
985
|
+
"""
|
|
986
|
+
return self.is_zero() or self == self.ring().unit_ideal()
|
|
987
|
+
|
|
988
|
+
def category(self):
|
|
989
|
+
"""
|
|
990
|
+
Return the category of this ideal.
|
|
991
|
+
|
|
992
|
+
.. NOTE::
|
|
993
|
+
|
|
994
|
+
category is dependent on the ring of the ideal.
|
|
995
|
+
|
|
996
|
+
EXAMPLES::
|
|
997
|
+
|
|
998
|
+
sage: P.<x> = ZZ[]
|
|
999
|
+
sage: I = ZZ.ideal(7)
|
|
1000
|
+
sage: J = P.ideal(7,x)
|
|
1001
|
+
sage: K = P.ideal(7)
|
|
1002
|
+
sage: I.category()
|
|
1003
|
+
Category of ring ideals in Integer Ring
|
|
1004
|
+
sage: J.category()
|
|
1005
|
+
Category of ring ideals in Univariate Polynomial Ring in x
|
|
1006
|
+
over Integer Ring
|
|
1007
|
+
sage: K.category()
|
|
1008
|
+
Category of ring ideals in Univariate Polynomial Ring in x
|
|
1009
|
+
over Integer Ring
|
|
1010
|
+
"""
|
|
1011
|
+
import sage.categories.all
|
|
1012
|
+
return sage.categories.all.Ideals(self.__ring)
|
|
1013
|
+
|
|
1014
|
+
def __add__(self, other):
|
|
1015
|
+
"""
|
|
1016
|
+
Add ``self`` on the left to ``other``.
|
|
1017
|
+
|
|
1018
|
+
This makes sure that ``other`` and ``self`` are in the same rings.
|
|
1019
|
+
|
|
1020
|
+
EXAMPLES::
|
|
1021
|
+
|
|
1022
|
+
sage: P.<x,y,z> = QQ[]
|
|
1023
|
+
sage: I = [x + y]*P
|
|
1024
|
+
sage: I + [y + z]
|
|
1025
|
+
Ideal (x + y, y + z) of Multivariate Polynomial Ring in x, y, z over Rational Field
|
|
1026
|
+
"""
|
|
1027
|
+
if not isinstance(other, Ideal_generic):
|
|
1028
|
+
other = self.ring().ideal(other)
|
|
1029
|
+
return self.ring().ideal(self.gens() + other.gens())
|
|
1030
|
+
|
|
1031
|
+
def __radd__(self, other):
|
|
1032
|
+
"""
|
|
1033
|
+
Add ``self`` on the right to ``other``.
|
|
1034
|
+
|
|
1035
|
+
This makes sure that ``other`` and ``self`` are in the same rings.
|
|
1036
|
+
|
|
1037
|
+
EXAMPLES::
|
|
1038
|
+
|
|
1039
|
+
sage: P.<x,y,z> = QQ[]
|
|
1040
|
+
sage: I = [x + y]*P
|
|
1041
|
+
sage: [y + z] + I
|
|
1042
|
+
Ideal (x + y, y + z) of Multivariate Polynomial Ring in x, y, z over Rational Field
|
|
1043
|
+
"""
|
|
1044
|
+
if not isinstance(other, Ideal_generic):
|
|
1045
|
+
other = self.ring().ideal(other)
|
|
1046
|
+
return self.ring().ideal(self.gens() + other.gens())
|
|
1047
|
+
|
|
1048
|
+
def __mul__(self, other):
|
|
1049
|
+
"""
|
|
1050
|
+
This method just makes sure that ``self`` and ``other`` are ideals in the
|
|
1051
|
+
same ring and then calls :meth:`_mul_`. If you want to change the
|
|
1052
|
+
behaviour of ideal multiplication in a subclass of
|
|
1053
|
+
:class:`Ideal_generic` please overwrite :meth:`_mul_` and not
|
|
1054
|
+
:meth:`__mul__`.
|
|
1055
|
+
|
|
1056
|
+
EXAMPLES::
|
|
1057
|
+
|
|
1058
|
+
sage: P.<x,y,z> = QQ[]
|
|
1059
|
+
sage: I = [x*y + y*z, x^2 + x*y - y*x - y^2] * P
|
|
1060
|
+
sage: I * 2 # indirect doctest
|
|
1061
|
+
Ideal (2*x*y + 2*y*z, 2*x^2 - 2*y^2) of Multivariate Polynomial Ring in x, y, z over Rational Field
|
|
1062
|
+
"""
|
|
1063
|
+
if not isinstance(other, Ideal_generic):
|
|
1064
|
+
try:
|
|
1065
|
+
if self.ring().has_coerce_map_from(other):
|
|
1066
|
+
return self
|
|
1067
|
+
except (TypeError,ArithmeticError,ValueError):
|
|
1068
|
+
pass
|
|
1069
|
+
other = self.ring().ideal(other)
|
|
1070
|
+
return self._mul_(other)
|
|
1071
|
+
|
|
1072
|
+
def _mul_(self, other):
|
|
1073
|
+
"""
|
|
1074
|
+
This is a very general implementation of Ideal multiplication.
|
|
1075
|
+
|
|
1076
|
+
This method assumes that ``self`` and ``other`` are Ideals of the
|
|
1077
|
+
same ring.
|
|
1078
|
+
|
|
1079
|
+
The number of generators of ``self * other`` will be
|
|
1080
|
+
``self.ngens() * other.ngens()``. So if used repeatedly this method
|
|
1081
|
+
will create an ideal with a uselessly large amount of generators.
|
|
1082
|
+
Therefore it is advisable to overwrite this method with a method that
|
|
1083
|
+
takes advantage of the structure of the ring you are working in.
|
|
1084
|
+
|
|
1085
|
+
Example::
|
|
1086
|
+
|
|
1087
|
+
sage: P.<x,y,z> = QQ[]
|
|
1088
|
+
sage: I=P.ideal([x*y, x*z, x^2])
|
|
1089
|
+
sage: J=P.ideal([x^2, x*y])
|
|
1090
|
+
sage: I._mul_(J)
|
|
1091
|
+
Ideal (x^3*y, x^2*y^2, x^3*z, x^2*y*z, x^4, x^3*y) of Multivariate Polynomial Ring in x, y, z over Rational Field
|
|
1092
|
+
"""
|
|
1093
|
+
return self.ring().ideal([z for z in [x*y for x in self.gens() for y in other.gens()] if z])
|
|
1094
|
+
|
|
1095
|
+
def __rmul__(self, other):
|
|
1096
|
+
"""
|
|
1097
|
+
Multiply ``self`` on the right with ``other``.
|
|
1098
|
+
|
|
1099
|
+
EXAMPLES::
|
|
1100
|
+
|
|
1101
|
+
sage: P.<x,y,z> = QQ[]
|
|
1102
|
+
sage: I = [x*y+y*z,x^2+x*y-y*x-y^2]*P
|
|
1103
|
+
sage: [2]*I # indirect doctest
|
|
1104
|
+
Ideal (2*x*y + 2*y*z, 2*x^2 - 2*y^2) of Multivariate Polynomial Ring in x, y, z over Rational Field
|
|
1105
|
+
"""
|
|
1106
|
+
if not isinstance(other, Ideal_generic):
|
|
1107
|
+
try:
|
|
1108
|
+
if self.ring().has_coerce_map_from(other):
|
|
1109
|
+
return self
|
|
1110
|
+
except (TypeError,ArithmeticError,ValueError):
|
|
1111
|
+
pass
|
|
1112
|
+
other = self.ring().ideal(other)
|
|
1113
|
+
return self.ring().ideal([z for z in [y*x for x in self.gens() for y in other.gens()] if z])
|
|
1114
|
+
|
|
1115
|
+
def norm(self):
|
|
1116
|
+
"""
|
|
1117
|
+
Return the norm of this ideal.
|
|
1118
|
+
|
|
1119
|
+
In the general case, this is just the ideal itself, since the ring it
|
|
1120
|
+
lies in can't be implicitly assumed to be an extension of anything.
|
|
1121
|
+
|
|
1122
|
+
We include this function for compatibility with cases such as ideals in
|
|
1123
|
+
number fields.
|
|
1124
|
+
|
|
1125
|
+
EXAMPLES::
|
|
1126
|
+
|
|
1127
|
+
sage: R.<t> = GF(8, names='a')[] # needs sage.rings.finite_rings
|
|
1128
|
+
sage: I = R.ideal(t^4 + t + 1) # needs sage.rings.finite_rings
|
|
1129
|
+
sage: I.norm() # needs sage.rings.finite_rings
|
|
1130
|
+
Principal ideal (t^4 + t + 1) of Univariate Polynomial Ring in t
|
|
1131
|
+
over Finite Field in a of size 2^3
|
|
1132
|
+
"""
|
|
1133
|
+
return self
|
|
1134
|
+
|
|
1135
|
+
def absolute_norm(self):
|
|
1136
|
+
"""
|
|
1137
|
+
Return the absolute norm of this ideal.
|
|
1138
|
+
|
|
1139
|
+
In the general case, this is just the ideal itself, since the ring it
|
|
1140
|
+
lies in can't be implicitly assumed to be an extension of anything.
|
|
1141
|
+
|
|
1142
|
+
We include this function for compatibility with cases such as ideals in
|
|
1143
|
+
number fields.
|
|
1144
|
+
|
|
1145
|
+
.. TODO::
|
|
1146
|
+
|
|
1147
|
+
Implement this method.
|
|
1148
|
+
|
|
1149
|
+
EXAMPLES::
|
|
1150
|
+
|
|
1151
|
+
sage: R.<t> = GF(9, names='a')[] # needs sage.rings.finite_rings
|
|
1152
|
+
sage: I = R.ideal(t^4 + t + 1) # needs sage.rings.finite_rings
|
|
1153
|
+
sage: I.absolute_norm() # needs sage.rings.finite_rings
|
|
1154
|
+
Traceback (most recent call last):
|
|
1155
|
+
...
|
|
1156
|
+
NotImplementedError
|
|
1157
|
+
"""
|
|
1158
|
+
raise NotImplementedError
|
|
1159
|
+
|
|
1160
|
+
def _macaulay2_init_(self, macaulay2=None):
|
|
1161
|
+
"""
|
|
1162
|
+
Return Macaulay2 ideal corresponding to this ideal.
|
|
1163
|
+
|
|
1164
|
+
EXAMPLES:
|
|
1165
|
+
|
|
1166
|
+
Ideals in multivariate polynomial rings::
|
|
1167
|
+
|
|
1168
|
+
sage: R.<x,y,z,w> = PolynomialRing(ZZ, 4)
|
|
1169
|
+
sage: I = R.ideal([x*y-z^2, y^2-w^2]); I
|
|
1170
|
+
Ideal (x*y - z^2, y^2 - w^2) of Multivariate Polynomial Ring in x, y, z, w over Integer Ring
|
|
1171
|
+
sage: macaulay2(I) # optional - macaulay2
|
|
1172
|
+
2 2 2
|
|
1173
|
+
ideal (x*y - z , y - w )
|
|
1174
|
+
|
|
1175
|
+
Ideals in univariate polynomial rings::
|
|
1176
|
+
|
|
1177
|
+
sage: R.<x> = PolynomialRing(ZZ)
|
|
1178
|
+
sage: I = R.ideal([4 + 3*x + x^2, 1 + x^2]); I
|
|
1179
|
+
Ideal (x^2 + 3*x + 4, x^2 + 1) of Univariate Polynomial Ring in x over Integer Ring
|
|
1180
|
+
sage: macaulay2(I) # optional - macaulay2
|
|
1181
|
+
2 2
|
|
1182
|
+
ideal (x + 3x + 4, x + 1)
|
|
1183
|
+
|
|
1184
|
+
Field ideals generated from the polynomial ring over
|
|
1185
|
+
two variables in the finite field of size 2::
|
|
1186
|
+
|
|
1187
|
+
sage: P.<x,y> = PolynomialRing(GF(2), 2)
|
|
1188
|
+
sage: I = sage.rings.ideal.FieldIdeal(P); I
|
|
1189
|
+
Ideal (x^2 + x, y^2 + y) of Multivariate Polynomial Ring in x, y
|
|
1190
|
+
over Finite Field of size 2
|
|
1191
|
+
sage: macaulay2(I) # optional - macaulay2 # needs sage.rings.finite_rings
|
|
1192
|
+
2 2
|
|
1193
|
+
ideal (x + x, y + y)
|
|
1194
|
+
|
|
1195
|
+
Ideals in PIDs::
|
|
1196
|
+
|
|
1197
|
+
sage: macaulay2(ideal(5)) # optional - macaulay2
|
|
1198
|
+
ideal 5
|
|
1199
|
+
sage: J = ideal(QQ(5))
|
|
1200
|
+
...
|
|
1201
|
+
sage: macaulay2(J) # optional - macaulay2
|
|
1202
|
+
ideal 1
|
|
1203
|
+
|
|
1204
|
+
TESTS:
|
|
1205
|
+
|
|
1206
|
+
Check that a cached base ring is used (:issue:`28074`)::
|
|
1207
|
+
|
|
1208
|
+
sage: R.<x,y> = QQ[]
|
|
1209
|
+
sage: R1 = macaulay2(R) # optional - macaulay2
|
|
1210
|
+
sage: _ = macaulay2('ZZ[x,y]') # optional - macaulay2
|
|
1211
|
+
sage: R2 = macaulay2(R.ideal(y^2 - x)).ring() # optional - macaulay2
|
|
1212
|
+
sage: R1._operator('===', R2) # optional - macaulay2
|
|
1213
|
+
true
|
|
1214
|
+
"""
|
|
1215
|
+
if macaulay2 is None:
|
|
1216
|
+
from sage.interfaces.macaulay2 import macaulay2 as m2_default
|
|
1217
|
+
macaulay2 = m2_default
|
|
1218
|
+
|
|
1219
|
+
R = self.ring()
|
|
1220
|
+
macaulay2.use(R._macaulay2_(macaulay2))
|
|
1221
|
+
gens = [repr(x) for x in self.gens()]
|
|
1222
|
+
if len(gens) == 0:
|
|
1223
|
+
gens = ['0']
|
|
1224
|
+
return macaulay2.ideal(gens)
|
|
1225
|
+
|
|
1226
|
+
def free_resolution(self, *args, **kwds):
|
|
1227
|
+
r"""
|
|
1228
|
+
Return a free resolution of ``self``.
|
|
1229
|
+
|
|
1230
|
+
For input options, see
|
|
1231
|
+
:class:`~sage.homology.free_resolution.FreeResolution`.
|
|
1232
|
+
|
|
1233
|
+
EXAMPLES::
|
|
1234
|
+
|
|
1235
|
+
sage: R.<x> = PolynomialRing(QQ)
|
|
1236
|
+
sage: I = R.ideal([x^4 + 3*x^2 + 2])
|
|
1237
|
+
sage: I.free_resolution() # needs sage.modules
|
|
1238
|
+
S^1 <-- S^1 <-- 0
|
|
1239
|
+
"""
|
|
1240
|
+
if not self.is_principal():
|
|
1241
|
+
raise NotImplementedError("the ideal must be a principal ideal")
|
|
1242
|
+
from sage.homology.free_resolution import FiniteFreeResolution_free_module
|
|
1243
|
+
return FiniteFreeResolution_free_module(self, *args, **kwds)
|
|
1244
|
+
|
|
1245
|
+
def graded_free_resolution(self, *args, **kwds):
|
|
1246
|
+
r"""
|
|
1247
|
+
Return a graded free resolution of ``self``.
|
|
1248
|
+
|
|
1249
|
+
For input options, see
|
|
1250
|
+
:class:`~sage.homology.graded_resolution.GradedFiniteFreeResolution`.
|
|
1251
|
+
|
|
1252
|
+
EXAMPLES::
|
|
1253
|
+
|
|
1254
|
+
sage: R.<x> = PolynomialRing(QQ)
|
|
1255
|
+
sage: I = R.ideal([x^3])
|
|
1256
|
+
sage: I.graded_free_resolution() # needs sage.modules
|
|
1257
|
+
S(0) <-- S(-3) <-- 0
|
|
1258
|
+
"""
|
|
1259
|
+
from sage.homology.graded_resolution import GradedFiniteFreeResolution_free_module
|
|
1260
|
+
return GradedFiniteFreeResolution_free_module(self, *args, **kwds)
|
|
1261
|
+
|
|
1262
|
+
|
|
1263
|
+
class Ideal_principal(Ideal_generic):
|
|
1264
|
+
"""
|
|
1265
|
+
A principal ideal.
|
|
1266
|
+
|
|
1267
|
+
See :func:`Ideal()`.
|
|
1268
|
+
"""
|
|
1269
|
+
# now Ideal_principal takes a list.
|
|
1270
|
+
#def __init__(self, ring, gen):
|
|
1271
|
+
# Ideal_generic.__init__(self, ring, [gen])
|
|
1272
|
+
|
|
1273
|
+
def _repr_(self):
|
|
1274
|
+
"""
|
|
1275
|
+
Return a string representation of ``self``.
|
|
1276
|
+
|
|
1277
|
+
EXAMPLES::
|
|
1278
|
+
|
|
1279
|
+
sage: R.<x> = ZZ[]
|
|
1280
|
+
sage: I = R.ideal(x)
|
|
1281
|
+
sage: I # indirect doctest
|
|
1282
|
+
Principal ideal (x) of Univariate Polynomial Ring in x over Integer Ring
|
|
1283
|
+
"""
|
|
1284
|
+
return "Principal ideal (%s) of %s" % (self.gen(), self.ring())
|
|
1285
|
+
|
|
1286
|
+
def is_principal(self):
|
|
1287
|
+
r"""
|
|
1288
|
+
Return ``True`` if the ideal is principal in the ring containing the
|
|
1289
|
+
ideal. When the ideal construction is explicitly principal (i.e.
|
|
1290
|
+
when we define an ideal with one element) this is always the case.
|
|
1291
|
+
|
|
1292
|
+
EXAMPLES:
|
|
1293
|
+
|
|
1294
|
+
Note that Sage automatically coerces ideals into
|
|
1295
|
+
principal ideals during initialization::
|
|
1296
|
+
|
|
1297
|
+
sage: R.<x> = ZZ[]
|
|
1298
|
+
sage: I = R.ideal(x)
|
|
1299
|
+
sage: J = R.ideal(2,x)
|
|
1300
|
+
sage: K = R.base_extend(QQ).ideal(2,x)
|
|
1301
|
+
sage: I
|
|
1302
|
+
Principal ideal (x) of Univariate Polynomial Ring in x
|
|
1303
|
+
over Integer Ring
|
|
1304
|
+
sage: J
|
|
1305
|
+
Ideal (2, x) of Univariate Polynomial Ring in x over Integer Ring
|
|
1306
|
+
sage: K
|
|
1307
|
+
Principal ideal (1) of Univariate Polynomial Ring in x
|
|
1308
|
+
over Rational Field
|
|
1309
|
+
sage: I.is_principal()
|
|
1310
|
+
True
|
|
1311
|
+
sage: K.is_principal()
|
|
1312
|
+
True
|
|
1313
|
+
"""
|
|
1314
|
+
return True
|
|
1315
|
+
|
|
1316
|
+
def gen(self, i=0):
|
|
1317
|
+
r"""
|
|
1318
|
+
Return the generator of the principal ideal.
|
|
1319
|
+
|
|
1320
|
+
The generator is an element of the ring containing the ideal.
|
|
1321
|
+
|
|
1322
|
+
EXAMPLES:
|
|
1323
|
+
|
|
1324
|
+
A simple example in the integers::
|
|
1325
|
+
|
|
1326
|
+
sage: R = ZZ
|
|
1327
|
+
sage: I = R.ideal(7)
|
|
1328
|
+
sage: J = R.ideal(7, 14)
|
|
1329
|
+
sage: I.gen(); J.gen()
|
|
1330
|
+
7
|
|
1331
|
+
7
|
|
1332
|
+
|
|
1333
|
+
Note that the generator belongs to the ring from which the ideal
|
|
1334
|
+
was initialized::
|
|
1335
|
+
|
|
1336
|
+
sage: R.<x> = ZZ[]
|
|
1337
|
+
sage: I = R.ideal(x)
|
|
1338
|
+
sage: J = R.base_extend(QQ).ideal(2,x)
|
|
1339
|
+
sage: a = I.gen(); a
|
|
1340
|
+
x
|
|
1341
|
+
sage: b = J.gen(); b
|
|
1342
|
+
1
|
|
1343
|
+
sage: a.base_ring()
|
|
1344
|
+
Integer Ring
|
|
1345
|
+
sage: b.base_ring()
|
|
1346
|
+
Rational Field
|
|
1347
|
+
"""
|
|
1348
|
+
if i:
|
|
1349
|
+
raise ValueError(f"i (={i}) must be 0")
|
|
1350
|
+
return self.gens()[0]
|
|
1351
|
+
|
|
1352
|
+
def __contains__(self, x):
|
|
1353
|
+
"""
|
|
1354
|
+
Return ``True`` if ``x`` is in ``self``.
|
|
1355
|
+
|
|
1356
|
+
EXAMPLES::
|
|
1357
|
+
|
|
1358
|
+
sage: P.<x> = PolynomialRing(ZZ)
|
|
1359
|
+
sage: I = P.ideal(x^2-2)
|
|
1360
|
+
sage: x^2 in I
|
|
1361
|
+
False
|
|
1362
|
+
sage: x^2-2 in I
|
|
1363
|
+
True
|
|
1364
|
+
sage: x^2-3 in I
|
|
1365
|
+
False
|
|
1366
|
+
"""
|
|
1367
|
+
if self.gen().is_zero():
|
|
1368
|
+
return x.is_zero()
|
|
1369
|
+
try:
|
|
1370
|
+
return self.gen().divides(x)
|
|
1371
|
+
except NotImplementedError:
|
|
1372
|
+
return self._contains_(self.ring()(x))
|
|
1373
|
+
|
|
1374
|
+
def __hash__(self):
|
|
1375
|
+
r"""
|
|
1376
|
+
Very stupid constant hash function!
|
|
1377
|
+
|
|
1378
|
+
TESTS::
|
|
1379
|
+
|
|
1380
|
+
sage: P.<x, y> = PolynomialRing(ZZ)
|
|
1381
|
+
sage: I = P.ideal(x^2)
|
|
1382
|
+
sage: J = [x, y^2 + x*y]*P
|
|
1383
|
+
sage: hash(I)
|
|
1384
|
+
0
|
|
1385
|
+
sage: hash(J)
|
|
1386
|
+
0
|
|
1387
|
+
"""
|
|
1388
|
+
return 0
|
|
1389
|
+
|
|
1390
|
+
def _richcmp_(self, other, op):
|
|
1391
|
+
"""
|
|
1392
|
+
Compare the two ideals.
|
|
1393
|
+
|
|
1394
|
+
EXAMPLES:
|
|
1395
|
+
|
|
1396
|
+
Comparison with non-principal ideal::
|
|
1397
|
+
|
|
1398
|
+
sage: R.<x> = ZZ[]
|
|
1399
|
+
sage: I = R.ideal([x^3 + 4*x - 1, x + 6])
|
|
1400
|
+
sage: J = [x^2] * R
|
|
1401
|
+
sage: I > J # indirect doctest
|
|
1402
|
+
True
|
|
1403
|
+
sage: J < I # indirect doctest
|
|
1404
|
+
True
|
|
1405
|
+
|
|
1406
|
+
Between two principal ideals::
|
|
1407
|
+
|
|
1408
|
+
sage: P.<x> = PolynomialRing(ZZ)
|
|
1409
|
+
sage: I = P.ideal(x^2-2)
|
|
1410
|
+
sage: I2 = P.ideal(0)
|
|
1411
|
+
sage: I2.is_zero()
|
|
1412
|
+
True
|
|
1413
|
+
sage: I2 < I
|
|
1414
|
+
True
|
|
1415
|
+
sage: I3 = P.ideal(x)
|
|
1416
|
+
sage: I > I3
|
|
1417
|
+
True
|
|
1418
|
+
"""
|
|
1419
|
+
if not isinstance(other, Ideal_generic):
|
|
1420
|
+
other = self.ring().ideal(other)
|
|
1421
|
+
|
|
1422
|
+
try:
|
|
1423
|
+
if not other.is_principal():
|
|
1424
|
+
return rich_to_bool(op, -1)
|
|
1425
|
+
except NotImplementedError:
|
|
1426
|
+
# If we do not know if the other is principal or not, then we
|
|
1427
|
+
# fallback to the generic implementation
|
|
1428
|
+
return Ideal_generic._richcmp_(self, other, op)
|
|
1429
|
+
|
|
1430
|
+
if self.is_zero():
|
|
1431
|
+
if not other.is_zero():
|
|
1432
|
+
return rich_to_bool(op, -1)
|
|
1433
|
+
return rich_to_bool(op, 0)
|
|
1434
|
+
|
|
1435
|
+
# is other.gen() / self.gen() a unit in the base ring?
|
|
1436
|
+
g0 = other.gen()
|
|
1437
|
+
g1 = self.gen()
|
|
1438
|
+
if g0.divides(g1) and g1.divides(g0):
|
|
1439
|
+
return rich_to_bool(op, 0)
|
|
1440
|
+
return rich_to_bool(op, 1)
|
|
1441
|
+
|
|
1442
|
+
def divides(self, other):
|
|
1443
|
+
"""
|
|
1444
|
+
Return ``True`` if ``self`` divides ``other``.
|
|
1445
|
+
|
|
1446
|
+
EXAMPLES::
|
|
1447
|
+
|
|
1448
|
+
sage: P.<x> = PolynomialRing(QQ)
|
|
1449
|
+
sage: I = P.ideal(x)
|
|
1450
|
+
sage: J = P.ideal(x^2)
|
|
1451
|
+
sage: I.divides(J)
|
|
1452
|
+
True
|
|
1453
|
+
sage: J.divides(I)
|
|
1454
|
+
False
|
|
1455
|
+
"""
|
|
1456
|
+
if isinstance(other, Ideal_principal):
|
|
1457
|
+
return self.gen().divides(other.gen())
|
|
1458
|
+
raise NotImplementedError
|
|
1459
|
+
|
|
1460
|
+
|
|
1461
|
+
class Ideal_pid(Ideal_principal):
|
|
1462
|
+
"""
|
|
1463
|
+
An ideal of a principal ideal domain.
|
|
1464
|
+
|
|
1465
|
+
See :func:`Ideal()`.
|
|
1466
|
+
|
|
1467
|
+
EXAMPLES::
|
|
1468
|
+
|
|
1469
|
+
sage: I = 8*ZZ
|
|
1470
|
+
sage: I
|
|
1471
|
+
Principal ideal (8) of Integer Ring
|
|
1472
|
+
"""
|
|
1473
|
+
def __add__(self, other):
|
|
1474
|
+
"""
|
|
1475
|
+
Add the two ideals.
|
|
1476
|
+
|
|
1477
|
+
EXAMPLES::
|
|
1478
|
+
|
|
1479
|
+
sage: I = 8*ZZ
|
|
1480
|
+
sage: I2 = 3*ZZ
|
|
1481
|
+
sage: I + I2
|
|
1482
|
+
Principal ideal (1) of Integer Ring
|
|
1483
|
+
"""
|
|
1484
|
+
if not isinstance(other, Ideal_generic):
|
|
1485
|
+
other = self.ring().ideal(other)
|
|
1486
|
+
return self.ring().ideal(self.gcd(other))
|
|
1487
|
+
|
|
1488
|
+
def reduce(self, f):
|
|
1489
|
+
"""
|
|
1490
|
+
Return the reduction of `f` modulo ``self``.
|
|
1491
|
+
|
|
1492
|
+
EXAMPLES::
|
|
1493
|
+
|
|
1494
|
+
sage: I = 8*ZZ
|
|
1495
|
+
sage: I.reduce(10)
|
|
1496
|
+
2
|
|
1497
|
+
sage: n = 10; n.mod(I)
|
|
1498
|
+
2
|
|
1499
|
+
"""
|
|
1500
|
+
f = self.ring()(f)
|
|
1501
|
+
if self.gen() == 0:
|
|
1502
|
+
return f
|
|
1503
|
+
q, r = f.quo_rem(self.gen())
|
|
1504
|
+
return r
|
|
1505
|
+
|
|
1506
|
+
def gcd(self, other):
|
|
1507
|
+
r"""
|
|
1508
|
+
Return the greatest common divisor of the principal ideal with the
|
|
1509
|
+
ideal ``other``; that is, the largest principal ideal
|
|
1510
|
+
contained in both the ideal and ``other``
|
|
1511
|
+
|
|
1512
|
+
.. TODO::
|
|
1513
|
+
|
|
1514
|
+
This is not implemented in the case when ``other`` is neither
|
|
1515
|
+
principal nor when the generator of ``self`` is contained in
|
|
1516
|
+
``other``. Also, it seems that this class is used only in PIDs--is
|
|
1517
|
+
this redundant?
|
|
1518
|
+
|
|
1519
|
+
.. NOTE::
|
|
1520
|
+
|
|
1521
|
+
The second example is broken.
|
|
1522
|
+
|
|
1523
|
+
EXAMPLES:
|
|
1524
|
+
|
|
1525
|
+
An example in the principal ideal domain `\ZZ`::
|
|
1526
|
+
|
|
1527
|
+
sage: R = ZZ
|
|
1528
|
+
sage: I = R.ideal(42)
|
|
1529
|
+
sage: J = R.ideal(70)
|
|
1530
|
+
sage: I.gcd(J)
|
|
1531
|
+
Principal ideal (14) of Integer Ring
|
|
1532
|
+
sage: J.gcd(I)
|
|
1533
|
+
Principal ideal (14) of Integer Ring
|
|
1534
|
+
|
|
1535
|
+
TESTS:
|
|
1536
|
+
|
|
1537
|
+
We cannot take the gcd of a principal ideal with a
|
|
1538
|
+
non-principal ideal as well: ( ``gcd(I,J)`` should be `(7)` )
|
|
1539
|
+
|
|
1540
|
+
::
|
|
1541
|
+
|
|
1542
|
+
sage: R.<x> = ZZ[]
|
|
1543
|
+
sage: I = ZZ.ideal(7)
|
|
1544
|
+
sage: J = R.ideal(7,x)
|
|
1545
|
+
sage: I.gcd(J)
|
|
1546
|
+
Traceback (most recent call last):
|
|
1547
|
+
...
|
|
1548
|
+
NotImplementedError
|
|
1549
|
+
sage: J.gcd(I)
|
|
1550
|
+
Traceback (most recent call last):
|
|
1551
|
+
...
|
|
1552
|
+
AttributeError: 'Ideal_generic' object has no attribute 'gcd'...
|
|
1553
|
+
|
|
1554
|
+
Note::
|
|
1555
|
+
|
|
1556
|
+
sage: type(I)
|
|
1557
|
+
<class 'sage.rings.ideal.Ideal_pid'>
|
|
1558
|
+
sage: type(J)
|
|
1559
|
+
<class 'sage.rings.ideal.Ideal_generic'>
|
|
1560
|
+
"""
|
|
1561
|
+
if isinstance(other, Ideal_principal):
|
|
1562
|
+
return self.ring().ideal(self.gen().gcd(other.gen()))
|
|
1563
|
+
elif self.gen() in other:
|
|
1564
|
+
return other
|
|
1565
|
+
else:
|
|
1566
|
+
raise NotImplementedError
|
|
1567
|
+
|
|
1568
|
+
def is_prime(self):
|
|
1569
|
+
"""
|
|
1570
|
+
Return ``True`` if the ideal is prime.
|
|
1571
|
+
|
|
1572
|
+
This relies on the ring elements having a method ``is_irreducible()``
|
|
1573
|
+
implemented, since an ideal `(a)` is prime iff `a` is irreducible
|
|
1574
|
+
(or 0).
|
|
1575
|
+
|
|
1576
|
+
EXAMPLES::
|
|
1577
|
+
|
|
1578
|
+
sage: ZZ.ideal(2).is_prime()
|
|
1579
|
+
True
|
|
1580
|
+
sage: ZZ.ideal(-2).is_prime()
|
|
1581
|
+
True
|
|
1582
|
+
sage: ZZ.ideal(4).is_prime()
|
|
1583
|
+
False
|
|
1584
|
+
sage: ZZ.ideal(0).is_prime()
|
|
1585
|
+
True
|
|
1586
|
+
sage: R.<x> = QQ[]
|
|
1587
|
+
sage: P = R.ideal(x^2 + 1); P
|
|
1588
|
+
Principal ideal (x^2 + 1) of Univariate Polynomial Ring in x over Rational Field
|
|
1589
|
+
sage: P.is_prime() # needs sage.libs.pari
|
|
1590
|
+
True
|
|
1591
|
+
|
|
1592
|
+
In fields, only the zero ideal is prime::
|
|
1593
|
+
|
|
1594
|
+
sage: RR.ideal(0).is_prime()
|
|
1595
|
+
True
|
|
1596
|
+
sage: RR.ideal(7).is_prime()
|
|
1597
|
+
False
|
|
1598
|
+
"""
|
|
1599
|
+
if self.is_zero(): # PIDs are integral domains by definition
|
|
1600
|
+
return True
|
|
1601
|
+
g = self.gen()
|
|
1602
|
+
if g.is_one(): # The ideal (1) is never prime
|
|
1603
|
+
return False
|
|
1604
|
+
if hasattr(g, 'is_irreducible'):
|
|
1605
|
+
return g.is_irreducible()
|
|
1606
|
+
|
|
1607
|
+
raise NotImplementedError
|
|
1608
|
+
|
|
1609
|
+
def is_maximal(self):
|
|
1610
|
+
"""
|
|
1611
|
+
Return whether this ideal is maximal.
|
|
1612
|
+
|
|
1613
|
+
Principal ideal domains have Krull dimension 1 (or 0), so an ideal is
|
|
1614
|
+
maximal if and only if it's prime (and nonzero if the ring is not a
|
|
1615
|
+
field).
|
|
1616
|
+
|
|
1617
|
+
EXAMPLES::
|
|
1618
|
+
|
|
1619
|
+
sage: # needs sage.rings.finite_rings
|
|
1620
|
+
sage: R.<t> = GF(5)[]
|
|
1621
|
+
sage: p = R.ideal(t^2 + 2)
|
|
1622
|
+
sage: p.is_maximal()
|
|
1623
|
+
True
|
|
1624
|
+
sage: p = R.ideal(t^2 + 1)
|
|
1625
|
+
sage: p.is_maximal()
|
|
1626
|
+
False
|
|
1627
|
+
sage: p = R.ideal(0)
|
|
1628
|
+
sage: p.is_maximal()
|
|
1629
|
+
False
|
|
1630
|
+
sage: p = R.ideal(1)
|
|
1631
|
+
sage: p.is_maximal()
|
|
1632
|
+
False
|
|
1633
|
+
"""
|
|
1634
|
+
if not self.ring().is_field() and self.is_zero():
|
|
1635
|
+
return False
|
|
1636
|
+
return self.is_prime()
|
|
1637
|
+
|
|
1638
|
+
def residue_field(self):
|
|
1639
|
+
r"""
|
|
1640
|
+
Return the residue class field of this ideal, which must be prime.
|
|
1641
|
+
|
|
1642
|
+
.. TODO::
|
|
1643
|
+
|
|
1644
|
+
Implement this for more general rings. Currently only defined
|
|
1645
|
+
for `\ZZ` and for number field orders.
|
|
1646
|
+
|
|
1647
|
+
EXAMPLES::
|
|
1648
|
+
|
|
1649
|
+
sage: # needs sage.libs.pari
|
|
1650
|
+
sage: P = ZZ.ideal(61); P
|
|
1651
|
+
Principal ideal (61) of Integer Ring
|
|
1652
|
+
sage: F = P.residue_field(); F
|
|
1653
|
+
Residue field of Integers modulo 61
|
|
1654
|
+
sage: pi = F.reduction_map(); pi
|
|
1655
|
+
Partially defined reduction map:
|
|
1656
|
+
From: Rational Field
|
|
1657
|
+
To: Residue field of Integers modulo 61
|
|
1658
|
+
sage: pi(123/234)
|
|
1659
|
+
6
|
|
1660
|
+
sage: pi(1/61)
|
|
1661
|
+
Traceback (most recent call last):
|
|
1662
|
+
...
|
|
1663
|
+
ZeroDivisionError: Cannot reduce rational 1/61 modulo 61: it has negative valuation
|
|
1664
|
+
sage: lift = F.lift_map(); lift
|
|
1665
|
+
Lifting map:
|
|
1666
|
+
From: Residue field of Integers modulo 61
|
|
1667
|
+
To: Integer Ring
|
|
1668
|
+
sage: lift(F(12345/67890))
|
|
1669
|
+
33
|
|
1670
|
+
sage: (12345/67890) % 61
|
|
1671
|
+
33
|
|
1672
|
+
|
|
1673
|
+
TESTS::
|
|
1674
|
+
|
|
1675
|
+
sage: ZZ.ideal(96).residue_field()
|
|
1676
|
+
Traceback (most recent call last):
|
|
1677
|
+
...
|
|
1678
|
+
ValueError: The ideal (Principal ideal (96) of Integer Ring) is not prime
|
|
1679
|
+
|
|
1680
|
+
::
|
|
1681
|
+
|
|
1682
|
+
sage: R.<x> = QQ[]
|
|
1683
|
+
sage: I = R.ideal(x^2 + 1)
|
|
1684
|
+
sage: I.is_prime() # needs sage.libs.pari
|
|
1685
|
+
True
|
|
1686
|
+
sage: I.residue_field()
|
|
1687
|
+
Traceback (most recent call last):
|
|
1688
|
+
...
|
|
1689
|
+
TypeError: residue fields only supported for polynomial rings over finite fields.
|
|
1690
|
+
"""
|
|
1691
|
+
if not self.is_prime():
|
|
1692
|
+
raise ValueError("The ideal (%s) is not prime" % self)
|
|
1693
|
+
from sage.rings.integer_ring import ZZ
|
|
1694
|
+
if self.ring() is ZZ:
|
|
1695
|
+
return ZZ.residue_field(self, check=False)
|
|
1696
|
+
raise NotImplementedError("residue_field() is only implemented for ZZ and rings of integers of number fields.")
|
|
1697
|
+
|
|
1698
|
+
def radical(self):
|
|
1699
|
+
r"""
|
|
1700
|
+
Return the radical of this ideal.
|
|
1701
|
+
|
|
1702
|
+
EXAMPLES::
|
|
1703
|
+
|
|
1704
|
+
sage: ZZ.ideal(12).radical()
|
|
1705
|
+
Principal ideal (6) of Integer Ring
|
|
1706
|
+
"""
|
|
1707
|
+
return self.ring().ideal(self.gen().radical())
|
|
1708
|
+
|
|
1709
|
+
|
|
1710
|
+
class Ideal_fractional(Ideal_generic):
|
|
1711
|
+
"""
|
|
1712
|
+
Fractional ideal of a ring.
|
|
1713
|
+
|
|
1714
|
+
See :func:`Ideal()`.
|
|
1715
|
+
"""
|
|
1716
|
+
def _repr_(self):
|
|
1717
|
+
"""
|
|
1718
|
+
Return a string representation of ``self``.
|
|
1719
|
+
|
|
1720
|
+
EXAMPLES::
|
|
1721
|
+
|
|
1722
|
+
sage: from sage.rings.ideal import Ideal_fractional
|
|
1723
|
+
sage: x = polygen(ZZ, 'x')
|
|
1724
|
+
sage: K.<a> = NumberField(x^2 + 1) # needs sage.rings.number_field
|
|
1725
|
+
sage: Ideal_fractional(K, [a]) # indirect doctest # needs sage.rings.number_field
|
|
1726
|
+
Fractional ideal (a) of Number Field in a with defining polynomial x^2 + 1
|
|
1727
|
+
"""
|
|
1728
|
+
return "Fractional ideal %s of %s" % (self._repr_short(), self.ring())
|
|
1729
|
+
|
|
1730
|
+
# constructors for standard (benchmark) ideals, written uppercase as
|
|
1731
|
+
# these are constructors
|
|
1732
|
+
|
|
1733
|
+
|
|
1734
|
+
def Cyclic(R, n=None, homog=False, singular=None):
|
|
1735
|
+
"""
|
|
1736
|
+
Ideal of cyclic ``n``-roots from 1-st ``n`` variables of ``R`` if ``R`` is
|
|
1737
|
+
coercible to :class:`Singular <sage.interfaces.singular.Singular>`.
|
|
1738
|
+
|
|
1739
|
+
INPUT:
|
|
1740
|
+
|
|
1741
|
+
- ``R`` -- base ring to construct ideal for
|
|
1742
|
+
|
|
1743
|
+
- ``n`` -- number of cyclic roots (default: ``None``); if ``None``, then
|
|
1744
|
+
``n`` is set to ``R.ngens()``
|
|
1745
|
+
|
|
1746
|
+
- ``homog`` -- boolean (default: ``False``); if ``True`` a homogeneous
|
|
1747
|
+
ideal is returned using the last variable in the ideal
|
|
1748
|
+
|
|
1749
|
+
- ``singular`` -- Singular instance to use
|
|
1750
|
+
|
|
1751
|
+
.. NOTE::
|
|
1752
|
+
|
|
1753
|
+
``R`` will be set as the active ring in
|
|
1754
|
+
:class:`Singular <sage.interfaces.singular.Singular>`
|
|
1755
|
+
|
|
1756
|
+
EXAMPLES:
|
|
1757
|
+
|
|
1758
|
+
An example from a multivariate polynomial ring over the
|
|
1759
|
+
rationals::
|
|
1760
|
+
|
|
1761
|
+
sage: P.<x,y,z> = PolynomialRing(QQ, 3, order='lex')
|
|
1762
|
+
sage: I = sage.rings.ideal.Cyclic(P); I # needs sage.libs.singular
|
|
1763
|
+
Ideal (x + y + z, x*y + x*z + y*z, x*y*z - 1)
|
|
1764
|
+
of Multivariate Polynomial Ring in x, y, z over Rational Field
|
|
1765
|
+
sage: I.groebner_basis() # needs sage.libs.singular
|
|
1766
|
+
[x + y + z, y^2 + y*z + z^2, z^3 - 1]
|
|
1767
|
+
|
|
1768
|
+
We compute a Groebner basis for cyclic 6, which is a standard
|
|
1769
|
+
benchmark and test ideal::
|
|
1770
|
+
|
|
1771
|
+
sage: R.<x,y,z,t,u,v> = QQ['x,y,z,t,u,v']
|
|
1772
|
+
sage: I = sage.rings.ideal.Cyclic(R, 6) # needs sage.libs.singular
|
|
1773
|
+
sage: B = I.groebner_basis() # needs sage.libs.singular
|
|
1774
|
+
sage: len(B) # needs sage.libs.singular
|
|
1775
|
+
45
|
|
1776
|
+
"""
|
|
1777
|
+
from .rational_field import RationalField
|
|
1778
|
+
|
|
1779
|
+
if n:
|
|
1780
|
+
if n > R.ngens():
|
|
1781
|
+
raise ArithmeticError("n must be <= R.ngens()")
|
|
1782
|
+
else:
|
|
1783
|
+
n = R.ngens()
|
|
1784
|
+
|
|
1785
|
+
if singular is None:
|
|
1786
|
+
from sage.interfaces.singular import singular as singular_default
|
|
1787
|
+
singular = singular_default
|
|
1788
|
+
|
|
1789
|
+
singular.lib("polylib")
|
|
1790
|
+
R2 = R.change_ring(RationalField())
|
|
1791
|
+
R2._singular_().set_ring()
|
|
1792
|
+
|
|
1793
|
+
if not homog:
|
|
1794
|
+
I = singular.cyclic(n)
|
|
1795
|
+
else:
|
|
1796
|
+
I = singular.cyclic(n).homog(R2.gen(n-1))
|
|
1797
|
+
return R2.ideal(I).change_ring(R)
|
|
1798
|
+
|
|
1799
|
+
|
|
1800
|
+
def Katsura(R, n=None, homog=False, singular=None):
|
|
1801
|
+
r"""
|
|
1802
|
+
`n`-th katsura ideal of `R` if `R` is coercible to
|
|
1803
|
+
:class:`Singular <sage.interfaces.singular.Singular>`.
|
|
1804
|
+
|
|
1805
|
+
INPUT:
|
|
1806
|
+
|
|
1807
|
+
- ``R`` -- base ring to construct ideal for
|
|
1808
|
+
|
|
1809
|
+
- ``n`` -- (default: ``None``) which katsura ideal of `R`. If ``None``,
|
|
1810
|
+
then ``n`` is set to ``R.ngens()``
|
|
1811
|
+
|
|
1812
|
+
- ``homog`` -- boolean (default: ``False``); if ``True`` a homogeneous
|
|
1813
|
+
ideal is returned using the last variable in the ideal
|
|
1814
|
+
|
|
1815
|
+
- ``singular`` -- Singular instance to use
|
|
1816
|
+
|
|
1817
|
+
EXAMPLES::
|
|
1818
|
+
|
|
1819
|
+
sage: P.<x,y,z> = PolynomialRing(QQ, 3)
|
|
1820
|
+
sage: I = sage.rings.ideal.Katsura(P, 3); I # needs sage.libs.singular
|
|
1821
|
+
Ideal (x + 2*y + 2*z - 1, x^2 + 2*y^2 + 2*z^2 - x, 2*x*y + 2*y*z - y)
|
|
1822
|
+
of Multivariate Polynomial Ring in x, y, z over Rational Field
|
|
1823
|
+
|
|
1824
|
+
::
|
|
1825
|
+
|
|
1826
|
+
sage: Q.<x> = PolynomialRing(QQ, implementation='singular') # needs sage.libs.singular
|
|
1827
|
+
sage: J = sage.rings.ideal.Katsura(Q,1); J # needs sage.libs.singular
|
|
1828
|
+
Ideal (x - 1) of Multivariate Polynomial Ring in x over Rational Field
|
|
1829
|
+
"""
|
|
1830
|
+
from .rational_field import RationalField
|
|
1831
|
+
if n:
|
|
1832
|
+
if n > R.ngens():
|
|
1833
|
+
raise ArithmeticError("n must be <= R.ngens().")
|
|
1834
|
+
else:
|
|
1835
|
+
n = R.ngens()
|
|
1836
|
+
|
|
1837
|
+
if singular is None:
|
|
1838
|
+
from sage.interfaces.singular import singular as singular_default
|
|
1839
|
+
singular = singular_default
|
|
1840
|
+
singular.lib("polylib")
|
|
1841
|
+
R2 = R.change_ring(RationalField())
|
|
1842
|
+
R2._singular_().set_ring()
|
|
1843
|
+
|
|
1844
|
+
if not homog:
|
|
1845
|
+
I = singular.katsura(n)
|
|
1846
|
+
else:
|
|
1847
|
+
I = singular.katsura(n).homog(R2.gen(n-1))
|
|
1848
|
+
return R2.ideal(I).change_ring(R)
|
|
1849
|
+
|
|
1850
|
+
|
|
1851
|
+
def FieldIdeal(R):
|
|
1852
|
+
r"""
|
|
1853
|
+
Let ``q = R.base_ring().order()`` and `(x_0,...,x_n)` ``= R.gens()`` then
|
|
1854
|
+
if `q` is finite this constructor returns
|
|
1855
|
+
|
|
1856
|
+
.. MATH::
|
|
1857
|
+
|
|
1858
|
+
\langle x_0^q - x_0, ... , x_n^q - x_n \rangle.
|
|
1859
|
+
|
|
1860
|
+
We call this ideal the field ideal and the generators the field
|
|
1861
|
+
equations.
|
|
1862
|
+
|
|
1863
|
+
EXAMPLES:
|
|
1864
|
+
|
|
1865
|
+
The field ideal generated from the polynomial ring over
|
|
1866
|
+
two variables in the finite field of size 2::
|
|
1867
|
+
|
|
1868
|
+
sage: P.<x,y> = PolynomialRing(GF(2), 2)
|
|
1869
|
+
sage: I = sage.rings.ideal.FieldIdeal(P); I
|
|
1870
|
+
Ideal (x^2 + x, y^2 + y) of
|
|
1871
|
+
Multivariate Polynomial Ring in x, y over Finite Field of size 2
|
|
1872
|
+
|
|
1873
|
+
Another, similar example::
|
|
1874
|
+
|
|
1875
|
+
sage: Q.<x1,x2,x3,x4> = PolynomialRing(GF(2^4, name='alpha'), 4) # needs sage.rings.finite_rings
|
|
1876
|
+
sage: J = sage.rings.ideal.FieldIdeal(Q); J # needs sage.rings.finite_rings
|
|
1877
|
+
Ideal (x1^16 + x1, x2^16 + x2, x3^16 + x3, x4^16 + x4) of
|
|
1878
|
+
Multivariate Polynomial Ring in x1, x2, x3, x4
|
|
1879
|
+
over Finite Field in alpha of size 2^4
|
|
1880
|
+
"""
|
|
1881
|
+
q = R.base_ring().order()
|
|
1882
|
+
import sage.rings.infinity
|
|
1883
|
+
if q is sage.rings.infinity.infinity:
|
|
1884
|
+
raise TypeError("Cannot construct field ideal for R.base_ring().order()==infinity")
|
|
1885
|
+
return R.ideal([x**q - x for x in R.gens()])
|