passagemath-categories 10.6.32__cp314-cp314t-musllinux_1_2_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- passagemath_categories-10.6.32.dist-info/METADATA +156 -0
- passagemath_categories-10.6.32.dist-info/RECORD +719 -0
- passagemath_categories-10.6.32.dist-info/WHEEL +5 -0
- passagemath_categories-10.6.32.dist-info/top_level.txt +2 -0
- passagemath_categories.libs/libgcc_s-2d945d6c.so.1 +0 -0
- passagemath_categories.libs/libgmp-28992bcb.so.10.5.0 +0 -0
- passagemath_categories.libs/libstdc++-85f2cd6d.so.6.0.33 +0 -0
- sage/all__sagemath_categories.py +28 -0
- sage/arith/all.py +38 -0
- sage/arith/constants.pxd +27 -0
- sage/arith/functions.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/functions.pxd +4 -0
- sage/arith/functions.pyx +221 -0
- sage/arith/misc.py +6552 -0
- sage/arith/multi_modular.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/multi_modular.pxd +39 -0
- sage/arith/multi_modular.pyx +994 -0
- sage/arith/rational_reconstruction.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/rational_reconstruction.pxd +4 -0
- sage/arith/rational_reconstruction.pyx +115 -0
- sage/arith/srange.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/arith/srange.pyx +571 -0
- sage/calculus/all__sagemath_categories.py +2 -0
- sage/calculus/functional.py +481 -0
- sage/calculus/functions.py +151 -0
- sage/categories/additive_groups.py +73 -0
- sage/categories/additive_magmas.py +1044 -0
- sage/categories/additive_monoids.py +114 -0
- sage/categories/additive_semigroups.py +184 -0
- sage/categories/affine_weyl_groups.py +238 -0
- sage/categories/algebra_ideals.py +95 -0
- sage/categories/algebra_modules.py +96 -0
- sage/categories/algebras.py +349 -0
- sage/categories/algebras_with_basis.py +377 -0
- sage/categories/all.py +160 -0
- sage/categories/aperiodic_semigroups.py +29 -0
- sage/categories/associative_algebras.py +47 -0
- sage/categories/bialgebras.py +101 -0
- sage/categories/bialgebras_with_basis.py +414 -0
- sage/categories/bimodules.py +206 -0
- sage/categories/chain_complexes.py +268 -0
- sage/categories/classical_crystals.py +480 -0
- sage/categories/coalgebras.py +405 -0
- sage/categories/coalgebras_with_basis.py +232 -0
- sage/categories/coercion_methods.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/categories/coercion_methods.pyx +52 -0
- sage/categories/commutative_additive_groups.py +104 -0
- sage/categories/commutative_additive_monoids.py +45 -0
- sage/categories/commutative_additive_semigroups.py +48 -0
- sage/categories/commutative_algebra_ideals.py +87 -0
- sage/categories/commutative_algebras.py +94 -0
- sage/categories/commutative_ring_ideals.py +58 -0
- sage/categories/commutative_rings.py +736 -0
- sage/categories/complete_discrete_valuation.py +293 -0
- sage/categories/complex_reflection_groups.py +145 -0
- sage/categories/complex_reflection_or_generalized_coxeter_groups.py +1249 -0
- sage/categories/coxeter_group_algebras.py +186 -0
- sage/categories/coxeter_groups.py +3402 -0
- sage/categories/crystals.py +2628 -0
- sage/categories/cw_complexes.py +216 -0
- sage/categories/dedekind_domains.py +137 -0
- sage/categories/discrete_valuation.py +325 -0
- sage/categories/distributive_magmas_and_additive_magmas.py +100 -0
- sage/categories/division_rings.py +114 -0
- sage/categories/domains.py +95 -0
- sage/categories/drinfeld_modules.py +789 -0
- sage/categories/dual.py +42 -0
- sage/categories/enumerated_sets.py +1146 -0
- sage/categories/euclidean_domains.py +271 -0
- sage/categories/examples/algebras_with_basis.py +102 -0
- sage/categories/examples/all.py +1 -0
- sage/categories/examples/commutative_additive_monoids.py +130 -0
- sage/categories/examples/commutative_additive_semigroups.py +199 -0
- sage/categories/examples/coxeter_groups.py +8 -0
- sage/categories/examples/crystals.py +236 -0
- sage/categories/examples/cw_complexes.py +163 -0
- sage/categories/examples/facade_sets.py +187 -0
- sage/categories/examples/filtered_algebras_with_basis.py +204 -0
- sage/categories/examples/filtered_modules_with_basis.py +154 -0
- sage/categories/examples/finite_coxeter_groups.py +252 -0
- sage/categories/examples/finite_dimensional_algebras_with_basis.py +148 -0
- sage/categories/examples/finite_dimensional_lie_algebras_with_basis.py +495 -0
- sage/categories/examples/finite_enumerated_sets.py +208 -0
- sage/categories/examples/finite_monoids.py +150 -0
- sage/categories/examples/finite_semigroups.py +190 -0
- sage/categories/examples/finite_weyl_groups.py +191 -0
- sage/categories/examples/graded_connected_hopf_algebras_with_basis.py +152 -0
- sage/categories/examples/graded_modules_with_basis.py +168 -0
- sage/categories/examples/graphs.py +122 -0
- sage/categories/examples/hopf_algebras_with_basis.py +145 -0
- sage/categories/examples/infinite_enumerated_sets.py +190 -0
- sage/categories/examples/lie_algebras.py +352 -0
- sage/categories/examples/lie_algebras_with_basis.py +196 -0
- sage/categories/examples/magmas.py +162 -0
- sage/categories/examples/manifolds.py +94 -0
- sage/categories/examples/monoids.py +144 -0
- sage/categories/examples/posets.py +178 -0
- sage/categories/examples/semigroups.py +580 -0
- sage/categories/examples/semigroups_cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/categories/examples/semigroups_cython.pyx +221 -0
- sage/categories/examples/semirings.py +249 -0
- sage/categories/examples/sets_cat.py +706 -0
- sage/categories/examples/sets_with_grading.py +101 -0
- sage/categories/examples/with_realizations.py +542 -0
- sage/categories/fields.py +991 -0
- sage/categories/filtered_algebras.py +63 -0
- sage/categories/filtered_algebras_with_basis.py +548 -0
- sage/categories/filtered_hopf_algebras_with_basis.py +138 -0
- sage/categories/filtered_modules.py +210 -0
- sage/categories/filtered_modules_with_basis.py +1209 -0
- sage/categories/finite_complex_reflection_groups.py +1506 -0
- sage/categories/finite_coxeter_groups.py +1138 -0
- sage/categories/finite_crystals.py +103 -0
- sage/categories/finite_dimensional_algebras_with_basis.py +1860 -0
- sage/categories/finite_dimensional_bialgebras_with_basis.py +33 -0
- sage/categories/finite_dimensional_coalgebras_with_basis.py +33 -0
- sage/categories/finite_dimensional_graded_lie_algebras_with_basis.py +231 -0
- sage/categories/finite_dimensional_hopf_algebras_with_basis.py +38 -0
- sage/categories/finite_dimensional_lie_algebras_with_basis.py +2774 -0
- sage/categories/finite_dimensional_modules_with_basis.py +1407 -0
- sage/categories/finite_dimensional_nilpotent_lie_algebras_with_basis.py +167 -0
- sage/categories/finite_dimensional_semisimple_algebras_with_basis.py +270 -0
- sage/categories/finite_enumerated_sets.py +769 -0
- sage/categories/finite_fields.py +252 -0
- sage/categories/finite_groups.py +256 -0
- sage/categories/finite_lattice_posets.py +242 -0
- sage/categories/finite_monoids.py +316 -0
- sage/categories/finite_permutation_groups.py +339 -0
- sage/categories/finite_posets.py +1994 -0
- sage/categories/finite_semigroups.py +136 -0
- sage/categories/finite_sets.py +93 -0
- sage/categories/finite_weyl_groups.py +39 -0
- sage/categories/finitely_generated_lambda_bracket_algebras.py +112 -0
- sage/categories/finitely_generated_lie_conformal_algebras.py +114 -0
- sage/categories/finitely_generated_magmas.py +57 -0
- sage/categories/finitely_generated_semigroups.py +214 -0
- sage/categories/function_fields.py +76 -0
- sage/categories/g_sets.py +77 -0
- sage/categories/gcd_domains.py +65 -0
- sage/categories/generalized_coxeter_groups.py +94 -0
- sage/categories/graded_algebras.py +85 -0
- sage/categories/graded_algebras_with_basis.py +258 -0
- sage/categories/graded_bialgebras.py +32 -0
- sage/categories/graded_bialgebras_with_basis.py +32 -0
- sage/categories/graded_coalgebras.py +65 -0
- sage/categories/graded_coalgebras_with_basis.py +51 -0
- sage/categories/graded_hopf_algebras.py +41 -0
- sage/categories/graded_hopf_algebras_with_basis.py +169 -0
- sage/categories/graded_lie_algebras.py +91 -0
- sage/categories/graded_lie_algebras_with_basis.py +44 -0
- sage/categories/graded_lie_conformal_algebras.py +74 -0
- sage/categories/graded_modules.py +133 -0
- sage/categories/graded_modules_with_basis.py +329 -0
- sage/categories/graphs.py +138 -0
- sage/categories/group_algebras.py +430 -0
- sage/categories/groupoid.py +94 -0
- sage/categories/groups.py +667 -0
- sage/categories/h_trivial_semigroups.py +64 -0
- sage/categories/hecke_modules.py +185 -0
- sage/categories/highest_weight_crystals.py +980 -0
- sage/categories/hopf_algebras.py +219 -0
- sage/categories/hopf_algebras_with_basis.py +309 -0
- sage/categories/infinite_enumerated_sets.py +115 -0
- sage/categories/integral_domains.py +203 -0
- sage/categories/j_trivial_semigroups.py +29 -0
- sage/categories/kac_moody_algebras.py +82 -0
- sage/categories/kahler_algebras.py +203 -0
- sage/categories/l_trivial_semigroups.py +63 -0
- sage/categories/lambda_bracket_algebras.py +280 -0
- sage/categories/lambda_bracket_algebras_with_basis.py +107 -0
- sage/categories/lattice_posets.py +89 -0
- sage/categories/left_modules.py +49 -0
- sage/categories/lie_algebras.py +1070 -0
- sage/categories/lie_algebras_with_basis.py +261 -0
- sage/categories/lie_conformal_algebras.py +350 -0
- sage/categories/lie_conformal_algebras_with_basis.py +147 -0
- sage/categories/lie_groups.py +73 -0
- sage/categories/loop_crystals.py +1290 -0
- sage/categories/magmas.py +1189 -0
- sage/categories/magmas_and_additive_magmas.py +149 -0
- sage/categories/magmatic_algebras.py +365 -0
- sage/categories/manifolds.py +352 -0
- sage/categories/matrix_algebras.py +40 -0
- sage/categories/metric_spaces.py +387 -0
- sage/categories/modular_abelian_varieties.py +78 -0
- sage/categories/modules.py +989 -0
- sage/categories/modules_with_basis.py +2794 -0
- sage/categories/monoid_algebras.py +38 -0
- sage/categories/monoids.py +739 -0
- sage/categories/noetherian_rings.py +87 -0
- sage/categories/number_fields.py +242 -0
- sage/categories/ore_modules.py +189 -0
- sage/categories/partially_ordered_monoids.py +49 -0
- sage/categories/permutation_groups.py +63 -0
- sage/categories/pointed_sets.py +42 -0
- sage/categories/polyhedra.py +74 -0
- sage/categories/poor_man_map.py +270 -0
- sage/categories/posets.py +722 -0
- sage/categories/principal_ideal_domains.py +270 -0
- sage/categories/quantum_group_representations.py +543 -0
- sage/categories/quotient_fields.py +728 -0
- sage/categories/r_trivial_semigroups.py +45 -0
- sage/categories/regular_crystals.py +898 -0
- sage/categories/regular_supercrystals.py +170 -0
- sage/categories/right_modules.py +49 -0
- sage/categories/ring_ideals.py +74 -0
- sage/categories/rings.py +1904 -0
- sage/categories/rngs.py +175 -0
- sage/categories/schemes.py +393 -0
- sage/categories/semigroups.py +1060 -0
- sage/categories/semirings.py +71 -0
- sage/categories/semisimple_algebras.py +114 -0
- sage/categories/sets_with_grading.py +235 -0
- sage/categories/shephard_groups.py +43 -0
- sage/categories/signed_tensor.py +120 -0
- sage/categories/simplicial_complexes.py +134 -0
- sage/categories/simplicial_sets.py +1206 -0
- sage/categories/super_algebras.py +149 -0
- sage/categories/super_algebras_with_basis.py +144 -0
- sage/categories/super_hopf_algebras_with_basis.py +126 -0
- sage/categories/super_lie_conformal_algebras.py +193 -0
- sage/categories/super_modules.py +229 -0
- sage/categories/super_modules_with_basis.py +193 -0
- sage/categories/supercommutative_algebras.py +99 -0
- sage/categories/supercrystals.py +406 -0
- sage/categories/tensor.py +110 -0
- sage/categories/topological_spaces.py +170 -0
- sage/categories/triangular_kac_moody_algebras.py +439 -0
- sage/categories/tutorial.py +58 -0
- sage/categories/unique_factorization_domains.py +318 -0
- sage/categories/unital_algebras.py +426 -0
- sage/categories/vector_bundles.py +159 -0
- sage/categories/vector_spaces.py +357 -0
- sage/categories/weyl_groups.py +853 -0
- sage/combinat/all__sagemath_categories.py +34 -0
- sage/combinat/backtrack.py +180 -0
- sage/combinat/combinat.py +2269 -0
- sage/combinat/combinat_cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/combinat_cython.pxd +6 -0
- sage/combinat/combinat_cython.pyx +390 -0
- sage/combinat/combination.py +796 -0
- sage/combinat/combinatorial_map.py +416 -0
- sage/combinat/composition.py +2192 -0
- sage/combinat/dlx.py +510 -0
- sage/combinat/integer_lists/__init__.py +7 -0
- sage/combinat/integer_lists/base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/integer_lists/base.pxd +16 -0
- sage/combinat/integer_lists/base.pyx +713 -0
- sage/combinat/integer_lists/invlex.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/integer_lists/invlex.pxd +4 -0
- sage/combinat/integer_lists/invlex.pyx +1650 -0
- sage/combinat/integer_lists/lists.py +328 -0
- sage/combinat/integer_lists/nn.py +48 -0
- sage/combinat/integer_vector.py +1818 -0
- sage/combinat/integer_vector_weighted.py +413 -0
- sage/combinat/matrices/all__sagemath_categories.py +5 -0
- sage/combinat/matrices/dancing_links.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/matrices/dancing_links.pyx +1159 -0
- sage/combinat/matrices/dancing_links_c.h +380 -0
- sage/combinat/matrices/dlxcpp.py +136 -0
- sage/combinat/partition.py +10070 -0
- sage/combinat/partitions.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/partitions.pyx +743 -0
- sage/combinat/permutation.py +10168 -0
- sage/combinat/permutation_cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/combinat/permutation_cython.pxd +11 -0
- sage/combinat/permutation_cython.pyx +407 -0
- sage/combinat/q_analogues.py +1090 -0
- sage/combinat/ranker.py +268 -0
- sage/combinat/subset.py +1561 -0
- sage/combinat/subsets_hereditary.py +202 -0
- sage/combinat/subsets_pairwise.py +184 -0
- sage/combinat/tools.py +63 -0
- sage/combinat/tuple.py +348 -0
- sage/data_structures/all.py +2 -0
- sage/data_structures/all__sagemath_categories.py +2 -0
- sage/data_structures/binary_matrix.pxd +138 -0
- sage/data_structures/binary_search.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/binary_search.pxd +3 -0
- sage/data_structures/binary_search.pyx +66 -0
- sage/data_structures/bitset.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/bitset.pxd +40 -0
- sage/data_structures/bitset.pyx +2385 -0
- sage/data_structures/bitset_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/bitset_base.pxd +926 -0
- sage/data_structures/bitset_base.pyx +117 -0
- sage/data_structures/bitset_intrinsics.h +487 -0
- sage/data_structures/blas_dict.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/blas_dict.pxd +12 -0
- sage/data_structures/blas_dict.pyx +469 -0
- sage/data_structures/list_of_pairs.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/list_of_pairs.pxd +16 -0
- sage/data_structures/list_of_pairs.pyx +122 -0
- sage/data_structures/mutable_poset.py +3312 -0
- sage/data_structures/pairing_heap.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/data_structures/pairing_heap.h +346 -0
- sage/data_structures/pairing_heap.pxd +88 -0
- sage/data_structures/pairing_heap.pyx +1464 -0
- sage/data_structures/sparse_bitset.pxd +62 -0
- sage/data_structures/stream.py +5070 -0
- sage/databases/all__sagemath_categories.py +7 -0
- sage/databases/sql_db.py +2236 -0
- sage/ext/all__sagemath_categories.py +3 -0
- sage/ext/fast_callable.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/fast_callable.pxd +4 -0
- sage/ext/fast_callable.pyx +2746 -0
- sage/ext/fast_eval.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/fast_eval.pxd +1 -0
- sage/ext/fast_eval.pyx +102 -0
- sage/ext/interpreters/__init__.py +1 -0
- sage/ext/interpreters/all__sagemath_categories.py +2 -0
- sage/ext/interpreters/wrapper_el.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/interpreters/wrapper_el.pxd +18 -0
- sage/ext/interpreters/wrapper_el.pyx +148 -0
- sage/ext/interpreters/wrapper_py.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/ext/interpreters/wrapper_py.pxd +17 -0
- sage/ext/interpreters/wrapper_py.pyx +133 -0
- sage/functions/airy.py +937 -0
- sage/functions/all.py +97 -0
- sage/functions/bessel.py +2102 -0
- sage/functions/error.py +784 -0
- sage/functions/exp_integral.py +1529 -0
- sage/functions/gamma.py +1087 -0
- sage/functions/generalized.py +672 -0
- sage/functions/hyperbolic.py +747 -0
- sage/functions/hypergeometric.py +1156 -0
- sage/functions/jacobi.py +1705 -0
- sage/functions/log.py +1402 -0
- sage/functions/min_max.py +338 -0
- sage/functions/orthogonal_polys.py +3106 -0
- sage/functions/other.py +2303 -0
- sage/functions/piecewise.py +1505 -0
- sage/functions/prime_pi.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/functions/prime_pi.pyx +262 -0
- sage/functions/special.py +1212 -0
- sage/functions/spike_function.py +278 -0
- sage/functions/transcendental.py +690 -0
- sage/functions/trig.py +1062 -0
- sage/functions/wigner.py +726 -0
- sage/geometry/abc.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/geometry/abc.pyx +82 -0
- sage/geometry/all__sagemath_categories.py +1 -0
- sage/groups/all__sagemath_categories.py +11 -0
- sage/groups/generic.py +1733 -0
- sage/groups/groups_catalog.py +113 -0
- sage/groups/perm_gps/all__sagemath_categories.py +1 -0
- sage/groups/perm_gps/partn_ref/all.py +1 -0
- sage/groups/perm_gps/partn_ref/all__sagemath_categories.py +1 -0
- sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.pxd +52 -0
- sage/groups/perm_gps/partn_ref/automorphism_group_canonical_label.pyx +906 -0
- sage/groups/perm_gps/partn_ref/canonical_augmentation.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/canonical_augmentation.pxd +85 -0
- sage/groups/perm_gps/partn_ref/canonical_augmentation.pyx +534 -0
- sage/groups/perm_gps/partn_ref/data_structures.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/data_structures.pxd +576 -0
- sage/groups/perm_gps/partn_ref/data_structures.pyx +1792 -0
- sage/groups/perm_gps/partn_ref/double_coset.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/double_coset.pxd +45 -0
- sage/groups/perm_gps/partn_ref/double_coset.pyx +739 -0
- sage/groups/perm_gps/partn_ref/refinement_lists.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_lists.pxd +18 -0
- sage/groups/perm_gps/partn_ref/refinement_lists.pyx +82 -0
- sage/groups/perm_gps/partn_ref/refinement_python.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_python.pxd +16 -0
- sage/groups/perm_gps/partn_ref/refinement_python.pyx +564 -0
- sage/groups/perm_gps/partn_ref/refinement_sets.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/groups/perm_gps/partn_ref/refinement_sets.pxd +60 -0
- sage/groups/perm_gps/partn_ref/refinement_sets.pyx +858 -0
- sage/interfaces/abc.py +140 -0
- sage/interfaces/all.py +58 -0
- sage/interfaces/all__sagemath_categories.py +1 -0
- sage/interfaces/expect.py +1643 -0
- sage/interfaces/interface.py +1682 -0
- sage/interfaces/process.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/interfaces/process.pxd +5 -0
- sage/interfaces/process.pyx +288 -0
- sage/interfaces/quit.py +167 -0
- sage/interfaces/sage0.py +604 -0
- sage/interfaces/sagespawn.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/interfaces/sagespawn.pyx +308 -0
- sage/interfaces/tab_completion.py +101 -0
- sage/misc/all__sagemath_categories.py +78 -0
- sage/misc/allocator.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/allocator.pxd +6 -0
- sage/misc/allocator.pyx +47 -0
- sage/misc/binary_tree.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/binary_tree.pxd +29 -0
- sage/misc/binary_tree.pyx +537 -0
- sage/misc/callable_dict.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/callable_dict.pyx +89 -0
- sage/misc/citation.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/citation.pyx +159 -0
- sage/misc/converting_dict.py +293 -0
- sage/misc/defaults.py +129 -0
- sage/misc/derivative.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/derivative.pyx +223 -0
- sage/misc/functional.py +2005 -0
- sage/misc/html.py +589 -0
- sage/misc/latex.py +2673 -0
- sage/misc/latex_macros.py +236 -0
- sage/misc/latex_standalone.py +1833 -0
- sage/misc/map_threaded.py +38 -0
- sage/misc/mathml.py +76 -0
- sage/misc/method_decorator.py +88 -0
- sage/misc/mrange.py +755 -0
- sage/misc/multireplace.py +41 -0
- sage/misc/object_multiplexer.py +92 -0
- sage/misc/parser.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/parser.pyx +1107 -0
- sage/misc/random_testing.py +264 -0
- sage/misc/rest_index_of_methods.py +377 -0
- sage/misc/search.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/search.pxd +2 -0
- sage/misc/search.pyx +68 -0
- sage/misc/stopgap.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/misc/stopgap.pyx +95 -0
- sage/misc/table.py +853 -0
- sage/monoids/all__sagemath_categories.py +1 -0
- sage/monoids/indexed_free_monoid.py +1071 -0
- sage/monoids/monoid.py +82 -0
- sage/numerical/all__sagemath_categories.py +1 -0
- sage/numerical/backends/all__sagemath_categories.py +1 -0
- sage/numerical/backends/generic_backend.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/numerical/backends/generic_backend.pxd +61 -0
- sage/numerical/backends/generic_backend.pyx +1893 -0
- sage/numerical/backends/generic_sdp_backend.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/numerical/backends/generic_sdp_backend.pxd +38 -0
- sage/numerical/backends/generic_sdp_backend.pyx +755 -0
- sage/parallel/all.py +6 -0
- sage/parallel/decorate.py +575 -0
- sage/parallel/map_reduce.py +1997 -0
- sage/parallel/multiprocessing_sage.py +76 -0
- sage/parallel/ncpus.py +35 -0
- sage/parallel/parallelism.py +364 -0
- sage/parallel/reference.py +47 -0
- sage/parallel/use_fork.py +333 -0
- sage/rings/abc.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/abc.pxd +31 -0
- sage/rings/abc.pyx +526 -0
- sage/rings/algebraic_closure_finite_field.py +1154 -0
- sage/rings/all__sagemath_categories.py +91 -0
- sage/rings/big_oh.py +227 -0
- sage/rings/continued_fraction.py +2754 -0
- sage/rings/continued_fraction_gosper.py +220 -0
- sage/rings/factorint.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/factorint.pyx +295 -0
- sage/rings/fast_arith.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/fast_arith.pxd +21 -0
- sage/rings/fast_arith.pyx +535 -0
- sage/rings/finite_rings/all__sagemath_categories.py +9 -0
- sage/rings/finite_rings/conway_polynomials.py +542 -0
- sage/rings/finite_rings/element_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/element_base.pxd +12 -0
- sage/rings/finite_rings/element_base.pyx +1176 -0
- sage/rings/finite_rings/finite_field_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/finite_field_base.pxd +7 -0
- sage/rings/finite_rings/finite_field_base.pyx +2171 -0
- sage/rings/finite_rings/finite_field_constructor.py +827 -0
- sage/rings/finite_rings/finite_field_prime_modn.py +372 -0
- sage/rings/finite_rings/galois_group.py +154 -0
- sage/rings/finite_rings/hom_finite_field.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/hom_finite_field.pxd +23 -0
- sage/rings/finite_rings/hom_finite_field.pyx +856 -0
- sage/rings/finite_rings/hom_prime_finite_field.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/hom_prime_finite_field.pxd +15 -0
- sage/rings/finite_rings/hom_prime_finite_field.pyx +164 -0
- sage/rings/finite_rings/homset.py +357 -0
- sage/rings/finite_rings/integer_mod.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/integer_mod.pxd +56 -0
- sage/rings/finite_rings/integer_mod.pyx +4586 -0
- sage/rings/finite_rings/integer_mod_limits.h +11 -0
- sage/rings/finite_rings/integer_mod_ring.py +2044 -0
- sage/rings/finite_rings/residue_field.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/finite_rings/residue_field.pxd +30 -0
- sage/rings/finite_rings/residue_field.pyx +1811 -0
- sage/rings/finite_rings/stdint.pxd +19 -0
- sage/rings/fraction_field.py +1452 -0
- sage/rings/fraction_field_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/fraction_field_element.pyx +1357 -0
- sage/rings/function_field/all.py +7 -0
- sage/rings/function_field/all__sagemath_categories.py +2 -0
- sage/rings/function_field/constructor.py +218 -0
- sage/rings/function_field/element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/function_field/element.pxd +11 -0
- sage/rings/function_field/element.pyx +1008 -0
- sage/rings/function_field/element_rational.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/function_field/element_rational.pyx +513 -0
- sage/rings/function_field/extensions.py +230 -0
- sage/rings/function_field/function_field.py +1468 -0
- sage/rings/function_field/function_field_rational.py +1005 -0
- sage/rings/function_field/ideal.py +1155 -0
- sage/rings/function_field/ideal_rational.py +629 -0
- sage/rings/function_field/jacobian_base.py +826 -0
- sage/rings/function_field/jacobian_hess.py +1053 -0
- sage/rings/function_field/jacobian_khuri_makdisi.py +1027 -0
- sage/rings/function_field/maps.py +1039 -0
- sage/rings/function_field/order.py +281 -0
- sage/rings/function_field/order_basis.py +586 -0
- sage/rings/function_field/order_rational.py +576 -0
- sage/rings/function_field/place.py +426 -0
- sage/rings/function_field/place_rational.py +181 -0
- sage/rings/generic.py +320 -0
- sage/rings/homset.py +332 -0
- sage/rings/ideal.py +1885 -0
- sage/rings/ideal_monoid.py +215 -0
- sage/rings/infinity.py +1890 -0
- sage/rings/integer.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/integer.pxd +45 -0
- sage/rings/integer.pyx +7874 -0
- sage/rings/integer_ring.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/integer_ring.pxd +8 -0
- sage/rings/integer_ring.pyx +1693 -0
- sage/rings/laurent_series_ring.py +931 -0
- sage/rings/laurent_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/laurent_series_ring_element.pxd +11 -0
- sage/rings/laurent_series_ring_element.pyx +1927 -0
- sage/rings/lazy_series.py +7815 -0
- sage/rings/lazy_series_ring.py +4356 -0
- sage/rings/localization.py +1043 -0
- sage/rings/morphism.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/morphism.pxd +39 -0
- sage/rings/morphism.pyx +3299 -0
- sage/rings/multi_power_series_ring.py +1145 -0
- sage/rings/multi_power_series_ring_element.py +2184 -0
- sage/rings/noncommutative_ideals.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/noncommutative_ideals.pyx +423 -0
- sage/rings/number_field/all__sagemath_categories.py +1 -0
- sage/rings/number_field/number_field_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/number_field/number_field_base.pxd +8 -0
- sage/rings/number_field/number_field_base.pyx +507 -0
- sage/rings/number_field/number_field_element_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/number_field/number_field_element_base.pxd +6 -0
- sage/rings/number_field/number_field_element_base.pyx +36 -0
- sage/rings/number_field/number_field_ideal.py +3550 -0
- sage/rings/padics/all__sagemath_categories.py +4 -0
- sage/rings/padics/local_generic.py +1670 -0
- sage/rings/padics/local_generic_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/padics/local_generic_element.pxd +5 -0
- sage/rings/padics/local_generic_element.pyx +1017 -0
- sage/rings/padics/misc.py +256 -0
- sage/rings/padics/padic_generic.py +1911 -0
- sage/rings/padics/pow_computer.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/padics/pow_computer.pxd +38 -0
- sage/rings/padics/pow_computer.pyx +671 -0
- sage/rings/padics/precision_error.py +24 -0
- sage/rings/polynomial/all__sagemath_categories.py +25 -0
- sage/rings/polynomial/commutative_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/commutative_polynomial.pxd +6 -0
- sage/rings/polynomial/commutative_polynomial.pyx +24 -0
- sage/rings/polynomial/cyclotomic.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/cyclotomic.pyx +404 -0
- sage/rings/polynomial/flatten.py +711 -0
- sage/rings/polynomial/ideal.py +102 -0
- sage/rings/polynomial/infinite_polynomial_element.py +1768 -0
- sage/rings/polynomial/infinite_polynomial_ring.py +1653 -0
- sage/rings/polynomial/laurent_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/laurent_polynomial.pxd +18 -0
- sage/rings/polynomial/laurent_polynomial.pyx +2190 -0
- sage/rings/polynomial/laurent_polynomial_ideal.py +590 -0
- sage/rings/polynomial/laurent_polynomial_ring.py +832 -0
- sage/rings/polynomial/laurent_polynomial_ring_base.py +708 -0
- sage/rings/polynomial/multi_polynomial.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/multi_polynomial.pxd +12 -0
- sage/rings/polynomial/multi_polynomial.pyx +3082 -0
- sage/rings/polynomial/multi_polynomial_element.py +2570 -0
- sage/rings/polynomial/multi_polynomial_ideal.py +5771 -0
- sage/rings/polynomial/multi_polynomial_ring.py +947 -0
- sage/rings/polynomial/multi_polynomial_ring_base.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/multi_polynomial_ring_base.pxd +15 -0
- sage/rings/polynomial/multi_polynomial_ring_base.pyx +1855 -0
- sage/rings/polynomial/multi_polynomial_sequence.py +2204 -0
- sage/rings/polynomial/polydict.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polydict.pxd +45 -0
- sage/rings/polynomial/polydict.pyx +2701 -0
- sage/rings/polynomial/polynomial_compiled.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_compiled.pxd +59 -0
- sage/rings/polynomial/polynomial_compiled.pyx +509 -0
- sage/rings/polynomial/polynomial_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_element.pxd +64 -0
- sage/rings/polynomial/polynomial_element.pyx +13255 -0
- sage/rings/polynomial/polynomial_element_generic.py +1637 -0
- sage/rings/polynomial/polynomial_fateman.py +97 -0
- sage/rings/polynomial/polynomial_quotient_ring.py +2465 -0
- sage/rings/polynomial/polynomial_quotient_ring_element.py +779 -0
- sage/rings/polynomial/polynomial_ring.py +3784 -0
- sage/rings/polynomial/polynomial_ring_constructor.py +1051 -0
- sage/rings/polynomial/polynomial_ring_homomorphism.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/polynomial_ring_homomorphism.pxd +5 -0
- sage/rings/polynomial/polynomial_ring_homomorphism.pyx +121 -0
- sage/rings/polynomial/polynomial_singular_interface.py +549 -0
- sage/rings/polynomial/symmetric_ideal.py +989 -0
- sage/rings/polynomial/symmetric_reduction.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/polynomial/symmetric_reduction.pxd +8 -0
- sage/rings/polynomial/symmetric_reduction.pyx +669 -0
- sage/rings/polynomial/term_order.py +2279 -0
- sage/rings/polynomial/toy_buchberger.py +449 -0
- sage/rings/polynomial/toy_d_basis.py +387 -0
- sage/rings/polynomial/toy_variety.py +362 -0
- sage/rings/power_series_mpoly.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/power_series_mpoly.pxd +9 -0
- sage/rings/power_series_mpoly.pyx +161 -0
- sage/rings/power_series_poly.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/power_series_poly.pxd +10 -0
- sage/rings/power_series_poly.pyx +1317 -0
- sage/rings/power_series_ring.py +1441 -0
- sage/rings/power_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/power_series_ring_element.pxd +12 -0
- sage/rings/power_series_ring_element.pyx +3028 -0
- sage/rings/puiseux_series_ring.py +487 -0
- sage/rings/puiseux_series_ring_element.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/puiseux_series_ring_element.pxd +7 -0
- sage/rings/puiseux_series_ring_element.pyx +1055 -0
- sage/rings/qqbar_decorators.py +167 -0
- sage/rings/quotient_ring.py +1598 -0
- sage/rings/quotient_ring_element.py +979 -0
- sage/rings/rational.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/rational.pxd +20 -0
- sage/rings/rational.pyx +4284 -0
- sage/rings/rational_field.py +1730 -0
- sage/rings/real_double.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/real_double.pxd +16 -0
- sage/rings/real_double.pyx +2218 -0
- sage/rings/real_lazy.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/real_lazy.pxd +30 -0
- sage/rings/real_lazy.pyx +1773 -0
- sage/rings/ring.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/ring.pxd +30 -0
- sage/rings/ring.pyx +850 -0
- sage/rings/semirings/all.py +3 -0
- sage/rings/semirings/non_negative_integer_semiring.py +107 -0
- sage/rings/semirings/tropical_mpolynomial.py +972 -0
- sage/rings/semirings/tropical_polynomial.py +997 -0
- sage/rings/semirings/tropical_semiring.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/semirings/tropical_semiring.pyx +676 -0
- sage/rings/semirings/tropical_variety.py +1701 -0
- sage/rings/sum_of_squares.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/rings/sum_of_squares.pxd +3 -0
- sage/rings/sum_of_squares.pyx +336 -0
- sage/rings/tests.py +504 -0
- sage/schemes/affine/affine_homset.py +508 -0
- sage/schemes/affine/affine_morphism.py +1574 -0
- sage/schemes/affine/affine_point.py +460 -0
- sage/schemes/affine/affine_rational_point.py +308 -0
- sage/schemes/affine/affine_space.py +1264 -0
- sage/schemes/affine/affine_subscheme.py +592 -0
- sage/schemes/affine/all.py +25 -0
- sage/schemes/all__sagemath_categories.py +5 -0
- sage/schemes/generic/algebraic_scheme.py +2092 -0
- sage/schemes/generic/all.py +5 -0
- sage/schemes/generic/ambient_space.py +400 -0
- sage/schemes/generic/divisor.py +465 -0
- sage/schemes/generic/divisor_group.py +313 -0
- sage/schemes/generic/glue.py +84 -0
- sage/schemes/generic/homset.py +820 -0
- sage/schemes/generic/hypersurface.py +234 -0
- sage/schemes/generic/morphism.py +2107 -0
- sage/schemes/generic/point.py +237 -0
- sage/schemes/generic/scheme.py +1190 -0
- sage/schemes/generic/spec.py +199 -0
- sage/schemes/product_projective/all.py +6 -0
- sage/schemes/product_projective/homset.py +236 -0
- sage/schemes/product_projective/morphism.py +517 -0
- sage/schemes/product_projective/point.py +568 -0
- sage/schemes/product_projective/rational_point.py +550 -0
- sage/schemes/product_projective/space.py +1301 -0
- sage/schemes/product_projective/subscheme.py +466 -0
- sage/schemes/projective/all.py +24 -0
- sage/schemes/projective/proj_bdd_height.py +453 -0
- sage/schemes/projective/projective_homset.py +718 -0
- sage/schemes/projective/projective_morphism.py +2792 -0
- sage/schemes/projective/projective_point.py +1484 -0
- sage/schemes/projective/projective_rational_point.py +569 -0
- sage/schemes/projective/projective_space.py +2571 -0
- sage/schemes/projective/projective_subscheme.py +1574 -0
- sage/sets/all.py +17 -0
- sage/sets/cartesian_product.py +376 -0
- sage/sets/condition_set.py +525 -0
- sage/sets/disjoint_set.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/disjoint_set.pxd +36 -0
- sage/sets/disjoint_set.pyx +998 -0
- sage/sets/disjoint_union_enumerated_sets.py +625 -0
- sage/sets/family.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/family.pxd +12 -0
- sage/sets/family.pyx +1556 -0
- sage/sets/finite_enumerated_set.py +406 -0
- sage/sets/finite_set_map_cy.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/finite_set_map_cy.pxd +34 -0
- sage/sets/finite_set_map_cy.pyx +708 -0
- sage/sets/finite_set_maps.py +591 -0
- sage/sets/image_set.py +448 -0
- sage/sets/integer_range.py +829 -0
- sage/sets/non_negative_integers.py +241 -0
- sage/sets/positive_integers.py +93 -0
- sage/sets/primes.py +188 -0
- sage/sets/real_set.py +2760 -0
- sage/sets/recursively_enumerated_set.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/sets/recursively_enumerated_set.pxd +31 -0
- sage/sets/recursively_enumerated_set.pyx +2082 -0
- sage/sets/set.py +2083 -0
- sage/sets/set_from_iterator.py +1021 -0
- sage/sets/totally_ordered_finite_set.py +329 -0
- sage/symbolic/all__sagemath_categories.py +1 -0
- sage/symbolic/function.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/symbolic/function.pxd +29 -0
- sage/symbolic/function.pyx +1488 -0
- sage/symbolic/symbols.py +56 -0
- sage/tests/all__sagemath_categories.py +1 -0
- sage/tests/cython.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/tests/cython.pyx +37 -0
- sage/tests/stl_vector.cpython-314t-aarch64-linux-musl.so +0 -0
- sage/tests/stl_vector.pyx +171 -0
- sage/typeset/all.py +6 -0
- sage/typeset/ascii_art.py +295 -0
- sage/typeset/character_art.py +789 -0
- sage/typeset/character_art_factory.py +572 -0
- sage/typeset/symbols.py +334 -0
- sage/typeset/unicode_art.py +183 -0
- sage/typeset/unicode_characters.py +101 -0
|
@@ -0,0 +1,2184 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-categories
|
|
2
|
+
r"""
|
|
3
|
+
Multivariate Power Series
|
|
4
|
+
|
|
5
|
+
Construct and manipulate multivariate power series (in finitely many
|
|
6
|
+
variables) over a given commutative ring. Multivariate power series
|
|
7
|
+
are implemented with total-degree precision.
|
|
8
|
+
|
|
9
|
+
EXAMPLES:
|
|
10
|
+
|
|
11
|
+
Power series arithmetic, tracking precision::
|
|
12
|
+
|
|
13
|
+
sage: R.<s,t> = PowerSeriesRing(ZZ); R
|
|
14
|
+
Multivariate Power Series Ring in s, t over Integer Ring
|
|
15
|
+
|
|
16
|
+
sage: f = 1 + s + 3*s^2; f
|
|
17
|
+
1 + s + 3*s^2
|
|
18
|
+
sage: g = t^2*s + 3*t^2*s^2 + R.O(5); g
|
|
19
|
+
s*t^2 + 3*s^2*t^2 + O(s, t)^5
|
|
20
|
+
sage: g = t^2*s + 3*t^2*s^2 + O(s, t)^5; g
|
|
21
|
+
s*t^2 + 3*s^2*t^2 + O(s, t)^5
|
|
22
|
+
sage: f = f.O(7); f
|
|
23
|
+
1 + s + 3*s^2 + O(s, t)^7
|
|
24
|
+
sage: f += s; f
|
|
25
|
+
1 + 2*s + 3*s^2 + O(s, t)^7
|
|
26
|
+
sage: f*g
|
|
27
|
+
s*t^2 + 5*s^2*t^2 + O(s, t)^5
|
|
28
|
+
sage: (f-1)*g
|
|
29
|
+
2*s^2*t^2 + 9*s^3*t^2 + O(s, t)^6
|
|
30
|
+
sage: f*g - g
|
|
31
|
+
2*s^2*t^2 + O(s, t)^5
|
|
32
|
+
|
|
33
|
+
sage: f *= s; f
|
|
34
|
+
s + 2*s^2 + 3*s^3 + O(s, t)^8
|
|
35
|
+
sage: f%2
|
|
36
|
+
s + s^3 + O(s, t)^8
|
|
37
|
+
sage: (f%2).parent()
|
|
38
|
+
Multivariate Power Series Ring in s, t over Ring of integers modulo 2
|
|
39
|
+
|
|
40
|
+
As with univariate power series, comparison of `f` and `g` is
|
|
41
|
+
done up to the minimum precision of `f` and `g`::
|
|
42
|
+
|
|
43
|
+
sage: f = 1 + t + s + s*t + R.O(3); f
|
|
44
|
+
1 + s + t + s*t + O(s, t)^3
|
|
45
|
+
sage: g = s^2 + 2*s^4 - s^5 + s^2*t^3 + R.O(6); g
|
|
46
|
+
s^2 + 2*s^4 - s^5 + s^2*t^3 + O(s, t)^6
|
|
47
|
+
sage: f == g
|
|
48
|
+
False
|
|
49
|
+
sage: g == g.add_bigoh(3)
|
|
50
|
+
True
|
|
51
|
+
sage: f < g
|
|
52
|
+
False
|
|
53
|
+
sage: f > g
|
|
54
|
+
True
|
|
55
|
+
|
|
56
|
+
Calling::
|
|
57
|
+
|
|
58
|
+
sage: f = s^2 + s*t + s^3 + s^2*t + 3*s^4 + 3*s^3*t + R.O(5); f
|
|
59
|
+
s^2 + s*t + s^3 + s^2*t + 3*s^4 + 3*s^3*t + O(s, t)^5
|
|
60
|
+
sage: f(t, s)
|
|
61
|
+
s*t + t^2 + s*t^2 + t^3 + 3*s*t^3 + 3*t^4 + O(s, t)^5
|
|
62
|
+
sage: f(t^2, s^2)
|
|
63
|
+
s^2*t^2 + t^4 + s^2*t^4 + t^6 + 3*s^2*t^6 + 3*t^8 + O(s, t)^10
|
|
64
|
+
|
|
65
|
+
Substitution is defined only for elements of positive valuation, unless `f`
|
|
66
|
+
has infinite precision::
|
|
67
|
+
|
|
68
|
+
sage: f(t^2, s^2 + 1)
|
|
69
|
+
Traceback (most recent call last):
|
|
70
|
+
...
|
|
71
|
+
TypeError: Substitution defined only for elements of positive valuation,
|
|
72
|
+
unless self has infinite precision.
|
|
73
|
+
|
|
74
|
+
sage: g = f.truncate()
|
|
75
|
+
sage: g(t^2, s^2 + 1)
|
|
76
|
+
t^2 + s^2*t^2 + 2*t^4 + s^2*t^4 + 4*t^6 + 3*s^2*t^6 + 3*t^8
|
|
77
|
+
sage: g(t^2, (s^2+1).O(3))
|
|
78
|
+
t^2 + s^2*t^2 + 2*t^4 + O(s, t)^5
|
|
79
|
+
|
|
80
|
+
0 has valuation ``+Infinity``::
|
|
81
|
+
|
|
82
|
+
sage: f(t^2, 0)
|
|
83
|
+
t^4 + t^6 + 3*t^8 + O(s, t)^10
|
|
84
|
+
sage: f(t^2, s^2 + s)
|
|
85
|
+
s*t^2 + s^2*t^2 + t^4 + O(s, t)^5
|
|
86
|
+
|
|
87
|
+
Substitution of power series with finite precision works too::
|
|
88
|
+
|
|
89
|
+
sage: f(s.O(2), t)
|
|
90
|
+
s^2 + s*t + O(s, t)^3
|
|
91
|
+
sage: f(f, f)
|
|
92
|
+
2*s^4 + 4*s^3*t + 2*s^2*t^2 + 4*s^5 + 8*s^4*t + 4*s^3*t^2 + 16*s^6 +
|
|
93
|
+
34*s^5*t + 20*s^4*t^2 + 2*s^3*t^3 + O(s, t)^7
|
|
94
|
+
sage: t(f, f)
|
|
95
|
+
s^2 + s*t + s^3 + s^2*t + 3*s^4 + 3*s^3*t + O(s, t)^5
|
|
96
|
+
sage: t(0, f) == s(f, 0)
|
|
97
|
+
True
|
|
98
|
+
|
|
99
|
+
The ``subs`` syntax works as expected::
|
|
100
|
+
|
|
101
|
+
sage: r0 = -t^2 - s*t^3 - 2*t^6 + s^7 + s^5*t^2 + R.O(10)
|
|
102
|
+
sage: r1 = s^4 - s*t^4 + s^6*t - 4*s^2*t^5 - 6*s^3*t^5 + R.O(10)
|
|
103
|
+
sage: r2 = 2*s^3*t^2 - 2*s*t^4 - 2*s^3*t^4 + s*t^7 + R.O(10)
|
|
104
|
+
sage: r0.subs({t: r2, s: r1})
|
|
105
|
+
-4*s^6*t^4 + 8*s^4*t^6 - 4*s^2*t^8 + 8*s^6*t^6 - 8*s^4*t^8 - 4*s^4*t^9
|
|
106
|
+
+ 4*s^2*t^11 - 4*s^6*t^8 + O(s, t)^15
|
|
107
|
+
sage: r0.subs({t: r2, s: r1}) == r0(r1, r2)
|
|
108
|
+
True
|
|
109
|
+
|
|
110
|
+
Construct ring homomorphisms from one power series ring to another::
|
|
111
|
+
|
|
112
|
+
sage: A.<a,b> = PowerSeriesRing(QQ)
|
|
113
|
+
sage: X.<x,y> = PowerSeriesRing(QQ)
|
|
114
|
+
|
|
115
|
+
sage: phi = Hom(A,X)([x,2*y]); phi
|
|
116
|
+
Ring morphism:
|
|
117
|
+
From: Multivariate Power Series Ring in a, b over Rational Field
|
|
118
|
+
To: Multivariate Power Series Ring in x, y over Rational Field
|
|
119
|
+
Defn: a |--> x
|
|
120
|
+
b |--> 2*y
|
|
121
|
+
|
|
122
|
+
sage: phi(a+b+3*a*b^2 + A.O(5))
|
|
123
|
+
x + 2*y + 12*x*y^2 + O(x, y)^5
|
|
124
|
+
|
|
125
|
+
Multiplicative inversion of power series::
|
|
126
|
+
|
|
127
|
+
sage: h = 1 + s + t + s*t + s^2*t^2 + 3*s^4 + 3*s^3*t + R.O(5)
|
|
128
|
+
sage: k = h^-1; k
|
|
129
|
+
1 - s - t + s^2 + s*t + t^2 - s^3 - s^2*t - s*t^2 - t^3 - 2*s^4 -
|
|
130
|
+
2*s^3*t + s*t^3 + t^4 + O(s, t)^5
|
|
131
|
+
sage: h*k
|
|
132
|
+
1 + O(s, t)^5
|
|
133
|
+
|
|
134
|
+
sage: f = 1 - 5*s^29 - 5*s^28*t + 4*s^18*t^35 + \
|
|
135
|
+
....: 4*s^17*t^36 - s^45*t^25 - s^44*t^26 + s^7*t^83 + \
|
|
136
|
+
....: s^6*t^84 + R.O(101)
|
|
137
|
+
sage: h = ~f; h
|
|
138
|
+
1 + 5*s^29 + 5*s^28*t - 4*s^18*t^35 - 4*s^17*t^36 + 25*s^58 + 50*s^57*t
|
|
139
|
+
+ 25*s^56*t^2 + s^45*t^25 + s^44*t^26 - 40*s^47*t^35 - 80*s^46*t^36
|
|
140
|
+
- 40*s^45*t^37 + 125*s^87 + 375*s^86*t + 375*s^85*t^2 + 125*s^84*t^3
|
|
141
|
+
- s^7*t^83 - s^6*t^84 + 10*s^74*t^25 + 20*s^73*t^26 + 10*s^72*t^27
|
|
142
|
+
+ O(s, t)^101
|
|
143
|
+
sage: h*f
|
|
144
|
+
1 + O(s, t)^101
|
|
145
|
+
|
|
146
|
+
AUTHORS:
|
|
147
|
+
|
|
148
|
+
- Niles Johnson (07/2010): initial code
|
|
149
|
+
- Simon King (08/2012): Use category and coercion framework, :issue:`13412`
|
|
150
|
+
"""
|
|
151
|
+
# ****************************************************************************
|
|
152
|
+
# Copyright (C) 2010 Niles Johnson <nilesj@gmail.com>
|
|
153
|
+
#
|
|
154
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
155
|
+
# https://www.gnu.org/licenses/
|
|
156
|
+
# ****************************************************************************
|
|
157
|
+
|
|
158
|
+
from sage.misc.lazy_import import lazy_import
|
|
159
|
+
from sage.rings.finite_rings.integer_mod_ring import Zmod
|
|
160
|
+
from sage.rings.infinity import infinity, InfinityElement
|
|
161
|
+
from sage.rings.integer import Integer
|
|
162
|
+
from sage.rings.polynomial.polynomial_ring import PolynomialRing_generic
|
|
163
|
+
from sage.rings.power_series_ring_element import PowerSeries
|
|
164
|
+
from sage.structure.richcmp import richcmp
|
|
165
|
+
|
|
166
|
+
lazy_import('sage.rings.lazy_series_ring', 'LazyPowerSeriesRing')
|
|
167
|
+
lazy_import('sage.rings.multi_power_series_ring', 'MPowerSeriesRing_generic')
|
|
168
|
+
lazy_import('sage.rings.power_series_ring', 'PowerSeriesRing_generic')
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
def is_MPowerSeries(f):
|
|
172
|
+
"""
|
|
173
|
+
Return ``True`` if ``f`` is a multivariate power series.
|
|
174
|
+
|
|
175
|
+
TESTS::
|
|
176
|
+
|
|
177
|
+
sage: from sage.rings.power_series_ring_element import is_PowerSeries
|
|
178
|
+
sage: from sage.rings.multi_power_series_ring_element import is_MPowerSeries
|
|
179
|
+
sage: M = PowerSeriesRing(ZZ,4,'v')
|
|
180
|
+
sage: is_PowerSeries(M.random_element(10))
|
|
181
|
+
doctest:warning...
|
|
182
|
+
DeprecationWarning: The function is_PowerSeries is deprecated; use 'isinstance(..., PowerSeries)' instead.
|
|
183
|
+
See https://github.com/sagemath/sage/issues/38266 for details.
|
|
184
|
+
True
|
|
185
|
+
sage: is_MPowerSeries(M.random_element(10))
|
|
186
|
+
doctest:warning...
|
|
187
|
+
DeprecationWarning: The function is_MPowerSeries is deprecated; use 'isinstance(..., MPowerSeries)' instead.
|
|
188
|
+
See https://github.com/sagemath/sage/issues/38266 for details.
|
|
189
|
+
True
|
|
190
|
+
sage: T.<v> = PowerSeriesRing(RR)
|
|
191
|
+
sage: is_MPowerSeries(1 - v + v^2 +O(v^3))
|
|
192
|
+
False
|
|
193
|
+
sage: is_PowerSeries(1 - v + v^2 +O(v^3))
|
|
194
|
+
True
|
|
195
|
+
"""
|
|
196
|
+
from sage.misc.superseded import deprecation
|
|
197
|
+
deprecation(38266,
|
|
198
|
+
"The function is_MPowerSeries is deprecated; "
|
|
199
|
+
"use 'isinstance(..., MPowerSeries)' instead.")
|
|
200
|
+
return isinstance(f, MPowerSeries)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
class MPowerSeries(PowerSeries):
|
|
204
|
+
### methods from PowerSeries that we *don't* override:
|
|
205
|
+
#
|
|
206
|
+
# __hash__ : works just fine
|
|
207
|
+
#
|
|
208
|
+
# __reduce__ : don't really understand this
|
|
209
|
+
#
|
|
210
|
+
# is_sparse : works just fine
|
|
211
|
+
#
|
|
212
|
+
# is_dense : works just fine
|
|
213
|
+
#
|
|
214
|
+
# is_gen : works just fine
|
|
215
|
+
#
|
|
216
|
+
# base_extend : works just fine
|
|
217
|
+
#
|
|
218
|
+
# change_ring : works just fine
|
|
219
|
+
#
|
|
220
|
+
# _cmp_ : don't understand this
|
|
221
|
+
#
|
|
222
|
+
# __copy__ : works just fine
|
|
223
|
+
#
|
|
224
|
+
# base_ring : works just fine
|
|
225
|
+
#
|
|
226
|
+
# common_prec : works just fine
|
|
227
|
+
#
|
|
228
|
+
# common_prec_c : seems fine
|
|
229
|
+
#
|
|
230
|
+
# _mul_prec : works just fine
|
|
231
|
+
#
|
|
232
|
+
# __bool__ : works just fine
|
|
233
|
+
#
|
|
234
|
+
"""
|
|
235
|
+
Multivariate power series; these are the elements of Multivariate Power
|
|
236
|
+
Series Rings.
|
|
237
|
+
|
|
238
|
+
INPUT:
|
|
239
|
+
|
|
240
|
+
- ``parent`` -- a multivariate power series
|
|
241
|
+
|
|
242
|
+
- ``x`` -- the element (default: 0). This can be another
|
|
243
|
+
:class:`MPowerSeries` object, or an element of one of the following:
|
|
244
|
+
|
|
245
|
+
- the background univariate power series ring
|
|
246
|
+
- the foreground polynomial ring
|
|
247
|
+
- a ring that coerces to one of the above two
|
|
248
|
+
|
|
249
|
+
- ``prec`` -- (default: ``infinity``) the precision
|
|
250
|
+
|
|
251
|
+
- ``is_gen`` -- boolean (default: ``False``); whether this element is one
|
|
252
|
+
of the generators
|
|
253
|
+
|
|
254
|
+
- ``check`` -- boolean (default: ``False``); needed by univariate power
|
|
255
|
+
series class
|
|
256
|
+
|
|
257
|
+
EXAMPLES:
|
|
258
|
+
|
|
259
|
+
Construct multivariate power series from generators::
|
|
260
|
+
|
|
261
|
+
sage: S.<s,t> = PowerSeriesRing(ZZ)
|
|
262
|
+
sage: f = s + 4*t + 3*s*t
|
|
263
|
+
sage: f in S
|
|
264
|
+
True
|
|
265
|
+
sage: f = f.add_bigoh(4); f
|
|
266
|
+
s + 4*t + 3*s*t + O(s, t)^4
|
|
267
|
+
sage: g = 1 + s + t - s*t + S.O(5); g
|
|
268
|
+
1 + s + t - s*t + O(s, t)^5
|
|
269
|
+
|
|
270
|
+
sage: T = PowerSeriesRing(GF(3),5,'t'); T
|
|
271
|
+
Multivariate Power Series Ring in t0, t1, t2, t3, t4
|
|
272
|
+
over Finite Field of size 3
|
|
273
|
+
sage: t = T.gens()
|
|
274
|
+
sage: w = t[0] - 2*t[1]*t[3] + 5*t[4]^3 - t[0]^3*t[2]^2; w
|
|
275
|
+
t0 + t1*t3 - t4^3 - t0^3*t2^2
|
|
276
|
+
sage: w = w.add_bigoh(5); w
|
|
277
|
+
t0 + t1*t3 - t4^3 + O(t0, t1, t2, t3, t4)^5
|
|
278
|
+
sage: w in T
|
|
279
|
+
True
|
|
280
|
+
|
|
281
|
+
sage: w = t[0] - 2*t[0]*t[2] + 5*t[4]^3 - t[0]^3*t[2]^2 + T.O(6)
|
|
282
|
+
sage: w
|
|
283
|
+
t0 + t0*t2 - t4^3 - t0^3*t2^2 + O(t0, t1, t2, t3, t4)^6
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
Get random elements::
|
|
287
|
+
|
|
288
|
+
sage: S.random_element(4) # random
|
|
289
|
+
-2*t + t^2 - 12*s^3 + O(s, t)^4
|
|
290
|
+
|
|
291
|
+
sage: T.random_element(10) # random
|
|
292
|
+
-t1^2*t3^2*t4^2 + t1^5*t3^3*t4 + O(t0, t1, t2, t3, t4)^10
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
Convert elements from polynomial rings::
|
|
296
|
+
|
|
297
|
+
sage: # needs sage.rings.finite_rings
|
|
298
|
+
sage: R = PolynomialRing(ZZ, 5, T.variable_names())
|
|
299
|
+
sage: t = R.gens()
|
|
300
|
+
sage: r = -t[2]*t[3] + t[3]^2 + t[4]^2
|
|
301
|
+
sage: T(r)
|
|
302
|
+
-t2*t3 + t3^2 + t4^2
|
|
303
|
+
sage: r.parent()
|
|
304
|
+
Multivariate Polynomial Ring in t0, t1, t2, t3, t4 over Integer Ring
|
|
305
|
+
sage: r in T
|
|
306
|
+
True
|
|
307
|
+
"""
|
|
308
|
+
|
|
309
|
+
def __init__(self, parent, x=0, prec=infinity, is_gen=False, check=False):
|
|
310
|
+
"""
|
|
311
|
+
Input ``x`` can be an :class:`MPowerSeries`, or an element of
|
|
312
|
+
|
|
313
|
+
- the background univariate power series ring
|
|
314
|
+
- the foreground polynomial ring
|
|
315
|
+
- a ring that coerces to one of the above two
|
|
316
|
+
|
|
317
|
+
EXAMPLES::
|
|
318
|
+
|
|
319
|
+
sage: R.<s,t> = PowerSeriesRing(ZZ); R
|
|
320
|
+
Multivariate Power Series Ring in s, t over Integer Ring
|
|
321
|
+
sage: f = 1 + t + s + s*t + R.O(3)
|
|
322
|
+
sage: g = (1/2) * f; g
|
|
323
|
+
1/2 + 1/2*s + 1/2*t + 1/2*s*t + O(s, t)^3
|
|
324
|
+
sage: g.parent()
|
|
325
|
+
Multivariate Power Series Ring in s, t over Rational Field
|
|
326
|
+
sage: g = (1/2)*f; g
|
|
327
|
+
1/2 + 1/2*s + 1/2*t + 1/2*s*t + O(s, t)^3
|
|
328
|
+
sage: g.parent()
|
|
329
|
+
Multivariate Power Series Ring in s, t over Rational Field
|
|
330
|
+
|
|
331
|
+
sage: x = polygen(ZZ, 'x')
|
|
332
|
+
sage: K = NumberField(x - 3,'a') # needs sage.rings.number_field
|
|
333
|
+
sage: g = K.random_element()*f # needs sage.rings.number_field
|
|
334
|
+
sage: g.parent() # needs sage.rings.number_field
|
|
335
|
+
Multivariate Power Series Ring in s, t over
|
|
336
|
+
Number Field in a with defining polynomial x - 3
|
|
337
|
+
|
|
338
|
+
TESTS::
|
|
339
|
+
|
|
340
|
+
sage: S.<s,t> = PowerSeriesRing(ZZ)
|
|
341
|
+
sage: f = s + 4*t + 3*s*t
|
|
342
|
+
sage: f in S
|
|
343
|
+
True
|
|
344
|
+
sage: f = f.add_bigoh(4); f
|
|
345
|
+
s + 4*t + 3*s*t + O(s, t)^4
|
|
346
|
+
sage: g = 1 + s + t - s*t + S.O(5); g
|
|
347
|
+
1 + s + t - s*t + O(s, t)^5
|
|
348
|
+
|
|
349
|
+
sage: B.<s, t> = PowerSeriesRing(QQ)
|
|
350
|
+
sage: C.<z> = PowerSeriesRing(QQ)
|
|
351
|
+
sage: B(z)
|
|
352
|
+
Traceback (most recent call last):
|
|
353
|
+
...
|
|
354
|
+
TypeError: Cannot coerce input to polynomial ring.
|
|
355
|
+
|
|
356
|
+
sage: D.<s> = PowerSeriesRing(QQ)
|
|
357
|
+
sage: s.parent() is D
|
|
358
|
+
True
|
|
359
|
+
sage: B(s) in B
|
|
360
|
+
True
|
|
361
|
+
sage: d = D.random_element(20)
|
|
362
|
+
sage: b = B(d) # test coercion from univariate power series ring
|
|
363
|
+
sage: b in B
|
|
364
|
+
True
|
|
365
|
+
"""
|
|
366
|
+
PowerSeries.__init__(self, parent, prec, is_gen=is_gen)
|
|
367
|
+
self._PowerSeries__is_gen = is_gen
|
|
368
|
+
|
|
369
|
+
try:
|
|
370
|
+
prec = min(prec, x.prec()) # use precision of input, if defined
|
|
371
|
+
except AttributeError:
|
|
372
|
+
pass
|
|
373
|
+
|
|
374
|
+
# set the correct background value, depending on what type of input x is
|
|
375
|
+
try:
|
|
376
|
+
xparent = x.parent() # 'int' types have no parent
|
|
377
|
+
except AttributeError:
|
|
378
|
+
xparent = None
|
|
379
|
+
|
|
380
|
+
# test whether x coerces to background univariate
|
|
381
|
+
# power series ring of parent
|
|
382
|
+
if isinstance(xparent, (PowerSeriesRing_generic, MPowerSeriesRing_generic, LazyPowerSeriesRing)):
|
|
383
|
+
# x is either a multivariate or univariate power series
|
|
384
|
+
#
|
|
385
|
+
# test whether x coerces directly to designated parent
|
|
386
|
+
if isinstance(x, MPowerSeries):
|
|
387
|
+
try:
|
|
388
|
+
self._bg_value = parent._bg_ps_ring(x._bg_value)
|
|
389
|
+
except TypeError:
|
|
390
|
+
raise TypeError("Unable to coerce into background ring.")
|
|
391
|
+
|
|
392
|
+
# test whether x coerces to background univariate
|
|
393
|
+
# power series ring of parent
|
|
394
|
+
elif xparent == parent._bg_ps_ring():
|
|
395
|
+
self._bg_value = x
|
|
396
|
+
elif parent._bg_ps_ring().has_coerce_map_from(xparent):
|
|
397
|
+
# previous test may fail if precision or term orderings of
|
|
398
|
+
# base rings do not match
|
|
399
|
+
self._bg_value = parent._bg_ps_ring(x)
|
|
400
|
+
else:
|
|
401
|
+
# x is a univariate power series, but not from the
|
|
402
|
+
# background power series ring
|
|
403
|
+
#
|
|
404
|
+
# convert x to a polynomial and send to background
|
|
405
|
+
# ring of parent
|
|
406
|
+
x = x.polynomial()
|
|
407
|
+
self._bg_value = parent._send_to_bg(x).add_bigoh(prec)
|
|
408
|
+
|
|
409
|
+
# test whether x coerces to underlying polynomial ring of parent
|
|
410
|
+
elif isinstance(xparent, PolynomialRing_generic):
|
|
411
|
+
self._bg_value = parent._send_to_bg(x).add_bigoh(prec)
|
|
412
|
+
|
|
413
|
+
else:
|
|
414
|
+
try:
|
|
415
|
+
x = parent._poly_ring(x)
|
|
416
|
+
#self._value = x
|
|
417
|
+
self._bg_value = parent._send_to_bg(x).add_bigoh(prec)
|
|
418
|
+
except (TypeError, AttributeError):
|
|
419
|
+
raise TypeError("Input does not coerce to any of the "
|
|
420
|
+
"expected rings.")
|
|
421
|
+
|
|
422
|
+
self._go_to_fg = parent._send_to_fg
|
|
423
|
+
self._prec = self._bg_value.prec()
|
|
424
|
+
|
|
425
|
+
# self._parent is used a lot by the class PowerSeries
|
|
426
|
+
self._parent = self.parent()
|
|
427
|
+
|
|
428
|
+
def __reduce__(self):
|
|
429
|
+
"""
|
|
430
|
+
For pickling.
|
|
431
|
+
|
|
432
|
+
EXAMPLES::
|
|
433
|
+
|
|
434
|
+
sage: K.<s,t> = PowerSeriesRing(QQ)
|
|
435
|
+
sage: f = 1 + t - s + s*t - s*t^3 + K.O(12)
|
|
436
|
+
sage: loads(dumps(f)) == f
|
|
437
|
+
True
|
|
438
|
+
"""
|
|
439
|
+
return self.__class__, (self._parent,self._bg_value,self._prec)
|
|
440
|
+
|
|
441
|
+
def __call__(self, *x, **kwds):
|
|
442
|
+
"""
|
|
443
|
+
Evaluate ``self``.
|
|
444
|
+
|
|
445
|
+
EXAMPLES::
|
|
446
|
+
|
|
447
|
+
sage: R.<s,t> = PowerSeriesRing(ZZ); R
|
|
448
|
+
Multivariate Power Series Ring in s, t over Integer Ring
|
|
449
|
+
sage: f = s^2 + s*t + s^3 + s^2*t + 3*s^4 + 3*s^3*t + R.O(5); f
|
|
450
|
+
s^2 + s*t + s^3 + s^2*t + 3*s^4 + 3*s^3*t + O(s, t)^5
|
|
451
|
+
sage: f(t,s)
|
|
452
|
+
s*t + t^2 + s*t^2 + t^3 + 3*s*t^3 + 3*t^4 + O(s, t)^5
|
|
453
|
+
|
|
454
|
+
sage: f(t,0)
|
|
455
|
+
t^2 + t^3 + 3*t^4 + O(s, t)^5
|
|
456
|
+
sage: f(t,2)
|
|
457
|
+
Traceback (most recent call last):
|
|
458
|
+
...
|
|
459
|
+
TypeError: Substitution defined only for elements of positive
|
|
460
|
+
valuation, unless self has infinite precision.
|
|
461
|
+
|
|
462
|
+
sage: f.truncate()(t,2)
|
|
463
|
+
2*t + 3*t^2 + 7*t^3 + 3*t^4
|
|
464
|
+
|
|
465
|
+
Checking that :issue:`15059` is fixed::
|
|
466
|
+
|
|
467
|
+
sage: M.<u,v> = PowerSeriesRing(GF(5))
|
|
468
|
+
sage: s = M.hom([u, u+v])
|
|
469
|
+
sage: s(M.one())
|
|
470
|
+
1
|
|
471
|
+
|
|
472
|
+
Since :issue:`26105` you can specify a map on the base ring::
|
|
473
|
+
|
|
474
|
+
sage: # needs sage.rings.number_field
|
|
475
|
+
sage: Zx.<x> = ZZ[]
|
|
476
|
+
sage: K.<i> = NumberField(x^2 + 1)
|
|
477
|
+
sage: cc = K.hom([-i])
|
|
478
|
+
sage: R.<s,t> = PowerSeriesRing(K)
|
|
479
|
+
sage: f = s^2 + i*s*t + (3+4*i)*s^3 + R.O(4); f
|
|
480
|
+
s^2 + i*s*t + (4*i + 3)*s^3 + O(s, t)^4
|
|
481
|
+
sage: f(t, s, base_map=cc)
|
|
482
|
+
(-i)*s*t + t^2 + (-4*i + 3)*t^3 + O(s, t)^4
|
|
483
|
+
"""
|
|
484
|
+
if len(x) != self.parent().ngens():
|
|
485
|
+
raise ValueError("Number of arguments does not match number of variables in parent.")
|
|
486
|
+
if kwds:
|
|
487
|
+
return self._subs_formal(*x, **kwds)
|
|
488
|
+
|
|
489
|
+
sub_dict = {}
|
|
490
|
+
valn_list = []
|
|
491
|
+
for i in range(len(x)):
|
|
492
|
+
try:
|
|
493
|
+
xi = self.parent(x[i])
|
|
494
|
+
except (AttributeError, TypeError):
|
|
495
|
+
# Input does not coerce to parent ring of self
|
|
496
|
+
# attempt formal substitution
|
|
497
|
+
return self._subs_formal(*x, **kwds)
|
|
498
|
+
if xi.valuation() == 0 and self.prec() is not infinity:
|
|
499
|
+
raise TypeError("Substitution defined only for elements of positive valuation, unless self has infinite precision.")
|
|
500
|
+
elif xi.valuation() > 0:
|
|
501
|
+
sub_dict[self.parent()._poly_ring().gens()[i]] = xi.add_bigoh(xi.valuation() * self.prec())
|
|
502
|
+
valn_list.append(xi.valuation())
|
|
503
|
+
else:
|
|
504
|
+
sub_dict[self.parent()._poly_ring().gens()[i]] = xi
|
|
505
|
+
if self.prec() is infinity:
|
|
506
|
+
newprec = infinity
|
|
507
|
+
else:
|
|
508
|
+
newprec = self.prec()*min(valn_list)
|
|
509
|
+
return self.parent()(self._value().subs(sub_dict)).add_bigoh(newprec)
|
|
510
|
+
|
|
511
|
+
def _subs_formal(self, *x, **kwds):
|
|
512
|
+
"""
|
|
513
|
+
Substitution of inputs as variables of ``self``. This is formal
|
|
514
|
+
in the sense that the inputs do not need to be elements of
|
|
515
|
+
same multivariate power series ring as ``self``. They can be any
|
|
516
|
+
objects which support addition and multiplication with
|
|
517
|
+
each other and with the coefficients of ``self``. If ``self`` has
|
|
518
|
+
finite precision, the inputs must also support an ``add_bigoh``
|
|
519
|
+
method.
|
|
520
|
+
|
|
521
|
+
TESTS::
|
|
522
|
+
|
|
523
|
+
sage: B.<s, t> = PowerSeriesRing(QQ)
|
|
524
|
+
sage: C.<z> = PowerSeriesRing(QQ)
|
|
525
|
+
sage: s(z,z)
|
|
526
|
+
z
|
|
527
|
+
|
|
528
|
+
sage: f = -2/33*s*t^2 - 1/5*t^5 - s^5*t + s^2*t^4
|
|
529
|
+
sage: f(z,z) # indirect doctest
|
|
530
|
+
-2/33*z^3 - 1/5*z^5
|
|
531
|
+
sage: f(z,1) # indirect doctest
|
|
532
|
+
-1/5 - 2/33*z + z^2 - z^5
|
|
533
|
+
sage: RF = RealField(10) # needs sage.rings.real_mpfr
|
|
534
|
+
sage: f(z, RF(1)) # indirect doctest # needs sage.rings.real_mpfr
|
|
535
|
+
-0.20 - 0.061*z + 1.0*z^2 - 0.00*z^3 - 0.00*z^4 - 1.0*z^5
|
|
536
|
+
|
|
537
|
+
sage: m = matrix(QQ,[[1,0,1],[0,2,1],[-1,0,0]]); m # needs sage.modules
|
|
538
|
+
[ 1 0 1]
|
|
539
|
+
[ 0 2 1]
|
|
540
|
+
[-1 0 0]
|
|
541
|
+
sage: f(m,m) # indirect doctest # needs sage.modules
|
|
542
|
+
[ 2/33 0 1/5]
|
|
543
|
+
[ 131/55 -1136/165 -24/11]
|
|
544
|
+
[ -1/5 0 -23/165]
|
|
545
|
+
sage: f(m,m) == -2/33*m^3 - 1/5*m^5 # indirect doctest # needs sage.modules
|
|
546
|
+
True
|
|
547
|
+
|
|
548
|
+
sage: f = f.add_bigoh(10)
|
|
549
|
+
sage: f(z,z)
|
|
550
|
+
-2/33*z^3 - 1/5*z^5 + O(z^10)
|
|
551
|
+
sage: f(m,m) # needs sage.modules
|
|
552
|
+
Traceback (most recent call last):
|
|
553
|
+
...
|
|
554
|
+
AttributeError: 'sage.matrix.matrix_rational_dense.Matrix_rational_dense'
|
|
555
|
+
object has no attribute 'add_bigoh'
|
|
556
|
+
"""
|
|
557
|
+
from sage.misc.misc_c import prod
|
|
558
|
+
|
|
559
|
+
if len(x) == 1 and isinstance(x[0], (list, tuple)):
|
|
560
|
+
x = x[0]
|
|
561
|
+
n = self.parent().ngens()
|
|
562
|
+
if len(x) != n:
|
|
563
|
+
raise ValueError("Input must be of correct length.")
|
|
564
|
+
if n == 0:
|
|
565
|
+
return self
|
|
566
|
+
|
|
567
|
+
y = 0
|
|
568
|
+
base_map = kwds.get('base_map')
|
|
569
|
+
if base_map is None:
|
|
570
|
+
base_map = lambda t: t
|
|
571
|
+
for m, c in self.monomial_coefficients().items():
|
|
572
|
+
y += base_map(c)*prod([x[i]**m[i] for i in range(n) if m[i] != 0])
|
|
573
|
+
if self.prec() == infinity:
|
|
574
|
+
return y
|
|
575
|
+
else:
|
|
576
|
+
return y.add_bigoh(self.prec())
|
|
577
|
+
|
|
578
|
+
def _value(self):
|
|
579
|
+
"""
|
|
580
|
+
Return the value of ``self`` in the foreground polynomial ring.
|
|
581
|
+
|
|
582
|
+
EXAMPLES::
|
|
583
|
+
|
|
584
|
+
sage: R.<a,b,c> = PowerSeriesRing(GF(5)); R
|
|
585
|
+
Multivariate Power Series Ring in a, b, c over Finite Field of
|
|
586
|
+
size 5
|
|
587
|
+
sage: f = 1 + a + b - a*b + R.O(3); f
|
|
588
|
+
1 + a + b - a*b + O(a, b, c)^3
|
|
589
|
+
sage: f._value()
|
|
590
|
+
1 + a + b - a*b
|
|
591
|
+
sage: f._value().parent()
|
|
592
|
+
Multivariate Polynomial Ring in a, b, c over Finite Field of size 5
|
|
593
|
+
"""
|
|
594
|
+
return self._go_to_fg(self._bg_value)
|
|
595
|
+
|
|
596
|
+
def _repr_(self):
|
|
597
|
+
"""
|
|
598
|
+
Return string representation of ``self``.
|
|
599
|
+
|
|
600
|
+
EXAMPLES::
|
|
601
|
+
|
|
602
|
+
sage: B.<s,t,v> = PowerSeriesRing(QQ)
|
|
603
|
+
sage: e = 1 + s - s*t + t*v/2 - 2*s*t*v/8 + B.O(4)
|
|
604
|
+
sage: e._repr_()
|
|
605
|
+
'1 + s - s*t + 1/2*t*v - 1/4*s*t*v + O(s, t, v)^4'
|
|
606
|
+
"""
|
|
607
|
+
if self._prec == infinity:
|
|
608
|
+
return "%s" % self._value()
|
|
609
|
+
return "%(val)s + O(%(gens)s)^%(prec)s" \
|
|
610
|
+
% {'val':self._value(),
|
|
611
|
+
'gens':', '.join(str(g) for g in self.parent().gens()),
|
|
612
|
+
'prec':self._prec}
|
|
613
|
+
|
|
614
|
+
def _latex_(self):
|
|
615
|
+
"""
|
|
616
|
+
Return latex representation of this multivariate power series.
|
|
617
|
+
|
|
618
|
+
EXAMPLES::
|
|
619
|
+
|
|
620
|
+
sage: M = PowerSeriesRing(GF(5),3,'t'); M
|
|
621
|
+
Multivariate Power Series Ring in t0, t1, t2 over Finite Field of size 5
|
|
622
|
+
sage: t = M.gens()
|
|
623
|
+
sage: f = (-t[0]^4*t[1]^3*t[2]^4 - 2*t[0]*t[1]^4*t[2]^7
|
|
624
|
+
....: + 2*t[1]*t[2]^12 + 2*t[0]^7*t[1]^5*t[2]^2 + M.O(15))
|
|
625
|
+
sage: f
|
|
626
|
+
-t0^4*t1^3*t2^4 - 2*t0*t1^4*t2^7 + 2*t1*t2^12 + 2*t0^7*t1^5*t2^2
|
|
627
|
+
+ O(t0, t1, t2)^15
|
|
628
|
+
sage: f._latex_()
|
|
629
|
+
'-t_{0}^{4} t_{1}^{3} t_{2}^{4} + 3 t_{0} t_{1}^{4} t_{2}^{7} +
|
|
630
|
+
2 t_{1} t_{2}^{12} + 2 t_{0}^{7} t_{1}^{5} t_{2}^{2}
|
|
631
|
+
+ O(t_{0}, t_{1}, t_{2})^{15}'
|
|
632
|
+
|
|
633
|
+
TESTS:
|
|
634
|
+
|
|
635
|
+
Check that :issue:`25156` is fixed::
|
|
636
|
+
|
|
637
|
+
sage: R.<x1,y1> = PowerSeriesRing(QQ, ('x', 'y'))
|
|
638
|
+
sage: element = 1 + y1^10 + x1^5
|
|
639
|
+
sage: element._latex_()
|
|
640
|
+
'1 + x_{1}^{5} + y_{1}^{10}'
|
|
641
|
+
"""
|
|
642
|
+
if self._prec == infinity:
|
|
643
|
+
return "%s" % self._value()._latex_()
|
|
644
|
+
return "%(val)s + O(%(gens)s)^{%(prec)s}" \
|
|
645
|
+
% {'val':self._value()._latex_(),
|
|
646
|
+
'gens':', '.join(g._latex_() for g in self.parent().gens()),
|
|
647
|
+
'prec':self._prec}
|
|
648
|
+
|
|
649
|
+
def _im_gens_(self, codomain, im_gens, base_map=None):
|
|
650
|
+
"""
|
|
651
|
+
Return the image of this series under the map that sends the
|
|
652
|
+
generators to ``im_gens``. This is used internally for computing
|
|
653
|
+
homomorphisms.
|
|
654
|
+
|
|
655
|
+
EXAMPLES::
|
|
656
|
+
|
|
657
|
+
sage: A.<a,b> = PowerSeriesRing(QQ)
|
|
658
|
+
sage: X.<x,y> = PowerSeriesRing(QQ)
|
|
659
|
+
sage: phi = Hom(A,X)([x,2*y])
|
|
660
|
+
sage: phi = Hom(A,X)([x,2*y]); phi
|
|
661
|
+
Ring morphism:
|
|
662
|
+
From: Multivariate Power Series Ring in a, b over Rational Field
|
|
663
|
+
To: Multivariate Power Series Ring in x, y over Rational Field
|
|
664
|
+
Defn: a |--> x
|
|
665
|
+
b |--> 2*y
|
|
666
|
+
sage: phi(a+b+3*a*b^2 + A.O(5)) # indirect doctest
|
|
667
|
+
x + 2*y + 12*x*y^2 + O(x, y)^5
|
|
668
|
+
"""
|
|
669
|
+
if base_map is None:
|
|
670
|
+
# __call__ might be faster if codomain coerces into the base ring
|
|
671
|
+
return codomain(self(*im_gens))
|
|
672
|
+
else:
|
|
673
|
+
return codomain(self._subs_formal(*im_gens, base_map=base_map))
|
|
674
|
+
|
|
675
|
+
def __getitem__(self, n):
|
|
676
|
+
"""
|
|
677
|
+
Return the coefficient of the monomial ``x1^e1 * x2^e2 * ... * xk^ek``
|
|
678
|
+
if ``n = (e_1, e2, ..., ek)`` is a tuple whose length is the number of
|
|
679
|
+
variables ``x1,x2,...,xk`` in the power series ring.
|
|
680
|
+
|
|
681
|
+
Return the sum of the monomials of degree ``n`` if ``n`` is an integer.
|
|
682
|
+
|
|
683
|
+
TESTS::
|
|
684
|
+
|
|
685
|
+
sage: R.<a,b> = PowerSeriesRing(ZZ)
|
|
686
|
+
sage: f = 1 + a + b - a*b + R.O(4)
|
|
687
|
+
sage: f[0]
|
|
688
|
+
1
|
|
689
|
+
sage: f[2]
|
|
690
|
+
-a*b
|
|
691
|
+
sage: f[3]
|
|
692
|
+
0
|
|
693
|
+
sage: f[4]
|
|
694
|
+
Traceback (most recent call last):
|
|
695
|
+
...
|
|
696
|
+
IndexError: Cannot return terms of total degree greater than or
|
|
697
|
+
equal to precision of self.
|
|
698
|
+
|
|
699
|
+
Ensure that the enhancement detailed in :issue:`39314` works as intended::
|
|
700
|
+
|
|
701
|
+
sage: R.<x,y> = QQ[[]]
|
|
702
|
+
sage: ((x+y)^3)[2,1]
|
|
703
|
+
3
|
|
704
|
+
sage: f = 1/(1 + x + y)
|
|
705
|
+
sage: f[2,5]
|
|
706
|
+
-21
|
|
707
|
+
sage: f[0,30]
|
|
708
|
+
Traceback (most recent call last):
|
|
709
|
+
...
|
|
710
|
+
IndexError: Cannot return the coefficients of terms of total degree
|
|
711
|
+
greater than or equal to precision of self.
|
|
712
|
+
"""
|
|
713
|
+
if type(n) is tuple:
|
|
714
|
+
if sum(n) >= self.prec():
|
|
715
|
+
raise IndexError("Cannot return the coefficients of terms of " +
|
|
716
|
+
"total degree greater than or equal to " +
|
|
717
|
+
"precision of self.")
|
|
718
|
+
return self._bg_value[sum(n)][n]
|
|
719
|
+
if n >= self.prec():
|
|
720
|
+
raise IndexError("Cannot return terms of total degree greater " +
|
|
721
|
+
"than or equal to precision of self.")
|
|
722
|
+
return self.parent(self._bg_value[n])
|
|
723
|
+
|
|
724
|
+
def __invert__(self):
|
|
725
|
+
"""
|
|
726
|
+
Return multiplicative inverse of this multivariate power series.
|
|
727
|
+
|
|
728
|
+
Currently implemented only if constant coefficient is a unit in the
|
|
729
|
+
base ring.
|
|
730
|
+
|
|
731
|
+
EXAMPLES::
|
|
732
|
+
|
|
733
|
+
sage: R.<a,b,c> = PowerSeriesRing(ZZ)
|
|
734
|
+
sage: f = 1 + a + b - a*b - b*c - a*c + R.O(4)
|
|
735
|
+
sage: ~f
|
|
736
|
+
1 - a - b + a^2 + 3*a*b + a*c + b^2 + b*c - a^3 - 5*a^2*b
|
|
737
|
+
- 2*a^2*c - 5*a*b^2 - 4*a*b*c - b^3 - 2*b^2*c + O(a, b, c)^4
|
|
738
|
+
"""
|
|
739
|
+
if self.valuation() == 0:
|
|
740
|
+
return self.parent(~self._bg_value)
|
|
741
|
+
else:
|
|
742
|
+
raise NotImplementedError("Multiplicative inverse of multivariate power series currently implemented only if constant coefficient is a unit.")
|
|
743
|
+
|
|
744
|
+
## comparisons
|
|
745
|
+
def _richcmp_(self, other, op):
|
|
746
|
+
"""
|
|
747
|
+
Compare ``self`` to ``other``.
|
|
748
|
+
|
|
749
|
+
EXAMPLES::
|
|
750
|
+
|
|
751
|
+
sage: R.<a,b,c> = PowerSeriesRing(GF(5)); R
|
|
752
|
+
Multivariate Power Series Ring in a, b, c over Finite Field of size 5
|
|
753
|
+
sage: f = a + b + c + a^2*c
|
|
754
|
+
sage: f == f^2
|
|
755
|
+
False
|
|
756
|
+
sage: f = f.truncate()
|
|
757
|
+
sage: f == f.O(4)
|
|
758
|
+
True
|
|
759
|
+
|
|
760
|
+
Ordering is determined by underlying polynomial ring::
|
|
761
|
+
|
|
762
|
+
sage: a > b
|
|
763
|
+
True
|
|
764
|
+
sage: a > a^2
|
|
765
|
+
True
|
|
766
|
+
sage: b > a^2
|
|
767
|
+
True
|
|
768
|
+
sage: (f^2).O(3)
|
|
769
|
+
a^2 + 2*a*b + 2*a*c + b^2 + 2*b*c + c^2 + O(a, b, c)^3
|
|
770
|
+
sage: f < f^2
|
|
771
|
+
False
|
|
772
|
+
sage: f > f^2
|
|
773
|
+
True
|
|
774
|
+
sage: f < 2*f
|
|
775
|
+
True
|
|
776
|
+
"""
|
|
777
|
+
return richcmp(self._bg_value, other._bg_value, op)
|
|
778
|
+
|
|
779
|
+
## arithmetic
|
|
780
|
+
def _add_(left, right):
|
|
781
|
+
"""
|
|
782
|
+
Add ``left`` to ``right``.
|
|
783
|
+
|
|
784
|
+
TESTS::
|
|
785
|
+
|
|
786
|
+
sage: R.<a,b,c> = PowerSeriesRing(ZZ)
|
|
787
|
+
sage: f0 = -a^3*b*c^2 + a^2*b^2*c^4 - 12*a^3*b^3*c^3 + R.O(10)
|
|
788
|
+
sage: f1 = -6*b*c^3 - 4*a^2*b*c^2 + a^6*b^2*c - 2*a^3*b^3*c^3 + R.O(10)
|
|
789
|
+
sage: g = f0 + f1; g #indirect doctest
|
|
790
|
+
-6*b*c^3 - 4*a^2*b*c^2 - a^3*b*c^2 + a^2*b^2*c^4 + a^6*b^2*c
|
|
791
|
+
- 14*a^3*b^3*c^3 + O(a, b, c)^10
|
|
792
|
+
sage: g in R
|
|
793
|
+
True
|
|
794
|
+
sage: g.polynomial() == f0.polynomial() + f1.polynomial()
|
|
795
|
+
True
|
|
796
|
+
"""
|
|
797
|
+
f = left._bg_value + right._bg_value
|
|
798
|
+
return MPowerSeries(left.parent(), f, prec=f.prec())
|
|
799
|
+
|
|
800
|
+
def _sub_(left, right):
|
|
801
|
+
"""
|
|
802
|
+
Subtract ``right`` from ``left``.
|
|
803
|
+
|
|
804
|
+
TESTS::
|
|
805
|
+
|
|
806
|
+
sage: R.<a,b,c> = PowerSeriesRing(ZZ)
|
|
807
|
+
sage: f0 = -a^3*b*c^2 + a^2*b^2*c^4 - 12*a^3*b^3*c^3 + R.O(10)
|
|
808
|
+
sage: f1 = -6*b*c^3 - 4*a^2*b*c^2 + a^6*b^2*c - 2*a^3*b^3*c^3 + R.O(10)
|
|
809
|
+
sage: g = f0 - f1; g #indirect doctest
|
|
810
|
+
6*b*c^3 + 4*a^2*b*c^2 - a^3*b*c^2 + a^2*b^2*c^4 - a^6*b^2*c
|
|
811
|
+
- 10*a^3*b^3*c^3 + O(a, b, c)^10
|
|
812
|
+
sage: g in R
|
|
813
|
+
True
|
|
814
|
+
sage: g.polynomial() == f0.polynomial() - f1.polynomial()
|
|
815
|
+
True
|
|
816
|
+
"""
|
|
817
|
+
f = left._bg_value - right._bg_value
|
|
818
|
+
return MPowerSeries(left.parent(), f, prec=f.prec())
|
|
819
|
+
|
|
820
|
+
def _mul_(left, right):
|
|
821
|
+
"""
|
|
822
|
+
Multiply ``left`` and ``right``.
|
|
823
|
+
|
|
824
|
+
TESTS::
|
|
825
|
+
|
|
826
|
+
sage: R.<a,b,c> = PowerSeriesRing(ZZ)
|
|
827
|
+
sage: f0 = -a^3*b*c^2 + a^2*b^2*c^4 - 12*a^3*b^3*c^3 + R.O(10)
|
|
828
|
+
sage: f1 = -6*b*c^3 - 4*a^2*b*c^2 + a^6*b^2*c - 2*a^3*b^3*c^3 + R.O(10)
|
|
829
|
+
sage: g = f0*f1; g #indirect doctest
|
|
830
|
+
6*a^3*b^2*c^5 + 4*a^5*b^2*c^4 - 6*a^2*b^3*c^7 - 4*a^4*b^3*c^6
|
|
831
|
+
+ 72*a^3*b^4*c^6 + O(a, b, c)^14
|
|
832
|
+
sage: g in R
|
|
833
|
+
True
|
|
834
|
+
|
|
835
|
+
The power series product and polynomial product agree up to
|
|
836
|
+
total degree < precision of `g`::
|
|
837
|
+
|
|
838
|
+
sage: diff = g.polynomial() - f0.polynomial() * f1.polynomial()
|
|
839
|
+
sage: all(S >= g.prec() for S in [sum(e) for e in diff.exponents()])
|
|
840
|
+
True
|
|
841
|
+
"""
|
|
842
|
+
f = left._bg_value * right._bg_value
|
|
843
|
+
return MPowerSeries(left.parent(), f, prec=f.prec())
|
|
844
|
+
|
|
845
|
+
def _lmul_(self, c):
|
|
846
|
+
"""
|
|
847
|
+
Multiply ``self`` with ``c`` on the left.
|
|
848
|
+
|
|
849
|
+
TESTS::
|
|
850
|
+
|
|
851
|
+
sage: R.<a,b,c> = PowerSeriesRing(ZZ)
|
|
852
|
+
sage: f = -a^3*b*c^2 + a^2*b^2*c^4 - 12*a^3*b^3*c^3 + R.O(10)
|
|
853
|
+
sage: g = 3*f; g #indirect doctest
|
|
854
|
+
-3*a^3*b*c^2 + 3*a^2*b^2*c^4 - 36*a^3*b^3*c^3 + O(a, b, c)^10
|
|
855
|
+
sage: g in R
|
|
856
|
+
True
|
|
857
|
+
sage: g.polynomial() == 3 * (f.polynomial())
|
|
858
|
+
True
|
|
859
|
+
sage: g = f*5; g #indirect doctest
|
|
860
|
+
-5*a^3*b*c^2 + 5*a^2*b^2*c^4 - 60*a^3*b^3*c^3 + O(a, b, c)^10
|
|
861
|
+
sage: g in R
|
|
862
|
+
True
|
|
863
|
+
sage: g.polynomial() == (f.polynomial()) * 5
|
|
864
|
+
True
|
|
865
|
+
"""
|
|
866
|
+
f = c * self._bg_value
|
|
867
|
+
return MPowerSeries(self.parent(), f, prec=f.prec())
|
|
868
|
+
|
|
869
|
+
def trailing_monomial(self):
|
|
870
|
+
"""
|
|
871
|
+
Return the trailing monomial of ``self``.
|
|
872
|
+
|
|
873
|
+
This is defined here as the lowest term of the underlying polynomial.
|
|
874
|
+
|
|
875
|
+
EXAMPLES::
|
|
876
|
+
|
|
877
|
+
sage: R.<a,b,c> = PowerSeriesRing(ZZ)
|
|
878
|
+
sage: f = 1 + a + b - a*b + R.O(3)
|
|
879
|
+
sage: f.trailing_monomial()
|
|
880
|
+
1
|
|
881
|
+
sage: f = a^2*b^3*f; f
|
|
882
|
+
a^2*b^3 + a^3*b^3 + a^2*b^4 - a^3*b^4 + O(a, b, c)^8
|
|
883
|
+
sage: f.trailing_monomial()
|
|
884
|
+
a^2*b^3
|
|
885
|
+
|
|
886
|
+
TESTS::
|
|
887
|
+
|
|
888
|
+
sage: (f-f).trailing_monomial()
|
|
889
|
+
0
|
|
890
|
+
"""
|
|
891
|
+
return self.polynomial().lt()
|
|
892
|
+
|
|
893
|
+
def quo_rem(self, other, precision=None):
|
|
894
|
+
r"""
|
|
895
|
+
Return the pair of quotient and remainder for the increasing power
|
|
896
|
+
division of ``self`` by ``other``.
|
|
897
|
+
|
|
898
|
+
If `a` and `b` are two elements of a power series ring
|
|
899
|
+
`R[[x_1, x_2, \cdots, x_n]]` such that the trailing term of
|
|
900
|
+
`b` is invertible in `R`, then the pair of quotient and
|
|
901
|
+
remainder for the increasing power division of `a` by `b` is
|
|
902
|
+
the unique pair `(u, v) \in R[[x_1, x_2, \cdots, x_n]] \times
|
|
903
|
+
R[x_1, x_2, \cdots, x_n]` such that `a = bu + v` and such that
|
|
904
|
+
no monomial appearing in `v` divides the trailing monomial
|
|
905
|
+
(:meth:`trailing_monomial`) of `b`. Note that this depends on
|
|
906
|
+
the order of the variables.
|
|
907
|
+
|
|
908
|
+
This method returns both quotient and remainder as power series,
|
|
909
|
+
even though in mathematics, the remainder for the increasing
|
|
910
|
+
power division of two power series is a polynomial. This is
|
|
911
|
+
because Sage's power series come with a precision, and that
|
|
912
|
+
precision is not always sufficient to determine the remainder
|
|
913
|
+
completely. Disregarding this issue, the :meth:`polynomial`
|
|
914
|
+
method can be used to recast the remainder as an actual
|
|
915
|
+
polynomial.
|
|
916
|
+
|
|
917
|
+
INPUT:
|
|
918
|
+
|
|
919
|
+
- ``other`` -- an element of the same power series ring as
|
|
920
|
+
``self`` such that the trailing term of ``other`` is
|
|
921
|
+
invertible in ``self`` (this is automatically satisfied
|
|
922
|
+
if the base ring is a field, unless ``other`` is zero)
|
|
923
|
+
|
|
924
|
+
- ``precision`` -- (default: the default precision of the
|
|
925
|
+
parent of ``self``) nonnegative integer, determining the
|
|
926
|
+
precision to be cast on the resulting quotient and
|
|
927
|
+
remainder if both ``self`` and ``other`` have infinite
|
|
928
|
+
precision (ignored otherwise); note that the resulting
|
|
929
|
+
precision might be lower than this integer
|
|
930
|
+
|
|
931
|
+
EXAMPLES::
|
|
932
|
+
|
|
933
|
+
sage: # needs sage.libs.singular
|
|
934
|
+
sage: R.<a,b,c> = PowerSeriesRing(ZZ)
|
|
935
|
+
sage: f = 1 + a + b - a*b + R.O(3)
|
|
936
|
+
sage: g = 1 + 2*a - 3*a*b + R.O(3)
|
|
937
|
+
sage: q, r = f.quo_rem(g); q, r
|
|
938
|
+
(1 - a + b + 2*a^2 + O(a, b, c)^3, 0 + O(a, b, c)^3)
|
|
939
|
+
sage: f == q*g + r
|
|
940
|
+
True
|
|
941
|
+
sage: q, r = (a*f).quo_rem(g); q, r
|
|
942
|
+
(a - a^2 + a*b + 2*a^3 + O(a, b, c)^4, 0 + O(a, b, c)^4)
|
|
943
|
+
sage: a*f == q*g + r
|
|
944
|
+
True
|
|
945
|
+
sage: q, r = (a*f).quo_rem(a*g); q, r
|
|
946
|
+
(1 - a + b + 2*a^2 + O(a, b, c)^3, 0 + O(a, b, c)^4)
|
|
947
|
+
sage: a*f == q*(a*g) + r
|
|
948
|
+
True
|
|
949
|
+
sage: q, r = (a*f).quo_rem(b*g); q, r
|
|
950
|
+
(a - 3*a^2 + O(a, b, c)^3, a + a^2 + O(a, b, c)^4)
|
|
951
|
+
sage: a*f == q*(b*g) + r
|
|
952
|
+
True
|
|
953
|
+
|
|
954
|
+
Trying to divide two polynomials, we run into the issue that
|
|
955
|
+
there is no natural setting for the precision of the quotient
|
|
956
|
+
and remainder (and if we wouldn't set a precision, the
|
|
957
|
+
algorithm would never terminate). Here, default precision
|
|
958
|
+
comes to our help::
|
|
959
|
+
|
|
960
|
+
sage: # needs sage.libs.singular
|
|
961
|
+
sage: (1 + a^3).quo_rem(a + a^2)
|
|
962
|
+
(a^2 - a^3 + a^4 - a^5 + a^6 - a^7 + a^8 - a^9 + a^10 + O(a, b, c)^11,
|
|
963
|
+
1 + O(a, b, c)^12)
|
|
964
|
+
sage: (1 + a^3 + a*b).quo_rem(b + c)
|
|
965
|
+
(a + O(a, b, c)^11, 1 - a*c + a^3 + O(a, b, c)^12)
|
|
966
|
+
sage: (1 + a^3 + a*b).quo_rem(b + c, precision=17)
|
|
967
|
+
(a + O(a, b, c)^16, 1 - a*c + a^3 + O(a, b, c)^17)
|
|
968
|
+
sage: (a^2 + b^2 + c^2).quo_rem(a + b + c)
|
|
969
|
+
(a - b - c + O(a, b, c)^11, 2*b^2 + 2*b*c + 2*c^2 + O(a, b, c)^12)
|
|
970
|
+
sage: (a^2 + b^2 + c^2).quo_rem(1/(1+a+b+c))
|
|
971
|
+
(a^2 + b^2 + c^2 + a^3 + a^2*b + a^2*c + a*b^2 + a*c^2
|
|
972
|
+
+ b^3 + b^2*c + b*c^2 + c^3 + O(a, b, c)^14,
|
|
973
|
+
0)
|
|
974
|
+
sage: (a^2 + b^2 + c^2).quo_rem(a/(1+a+b+c))
|
|
975
|
+
(a + a^2 + a*b + a*c + O(a, b, c)^13, b^2 + c^2)
|
|
976
|
+
sage: (1 + a + a^15).quo_rem(a^2)
|
|
977
|
+
(0 + O(a, b, c)^10, 1 + a + O(a, b, c)^12)
|
|
978
|
+
sage: (1 + a + a^15).quo_rem(a^2, precision=15)
|
|
979
|
+
(0 + O(a, b, c)^13, 1 + a + O(a, b, c)^15)
|
|
980
|
+
sage: (1 + a + a^15).quo_rem(a^2, precision=16)
|
|
981
|
+
(a^13 + O(a, b, c)^14, 1 + a + O(a, b, c)^16)
|
|
982
|
+
|
|
983
|
+
Illustrating the dependency on the ordering of variables::
|
|
984
|
+
|
|
985
|
+
sage: # needs sage.libs.singular
|
|
986
|
+
sage: (1 + a + b).quo_rem(b + c)
|
|
987
|
+
(1 + O(a, b, c)^11, 1 + a - c + O(a, b, c)^12)
|
|
988
|
+
sage: (1 + b + c).quo_rem(c + a)
|
|
989
|
+
(0 + O(a, b, c)^11, 1 + b + c + O(a, b, c)^12)
|
|
990
|
+
sage: (1 + c + a).quo_rem(a + b)
|
|
991
|
+
(1 + O(a, b, c)^11, 1 - b + c + O(a, b, c)^12)
|
|
992
|
+
|
|
993
|
+
TESTS::
|
|
994
|
+
|
|
995
|
+
sage: (f).quo_rem(R.zero()) # needs sage.libs.singular
|
|
996
|
+
Traceback (most recent call last):
|
|
997
|
+
...
|
|
998
|
+
ZeroDivisionError
|
|
999
|
+
|
|
1000
|
+
sage: (f).quo_rem(R.zero().add_bigoh(2)) # needs sage.libs.singular
|
|
1001
|
+
Traceback (most recent call last):
|
|
1002
|
+
...
|
|
1003
|
+
ZeroDivisionError
|
|
1004
|
+
|
|
1005
|
+
Coercion is applied on ``other``::
|
|
1006
|
+
|
|
1007
|
+
sage: (a + b).quo_rem(1) # needs sage.libs.singular
|
|
1008
|
+
(a + b + O(a, b, c)^12, 0 + O(a, b, c)^12)
|
|
1009
|
+
|
|
1010
|
+
sage: R.<a,b,c> = PowerSeriesRing(QQ)
|
|
1011
|
+
sage: R(3).quo_rem(2)
|
|
1012
|
+
(3/2 + O(a, b, c)^12, 0 + O(a, b, c)^12)
|
|
1013
|
+
"""
|
|
1014
|
+
parent = self.parent()
|
|
1015
|
+
if other.parent() is not parent:
|
|
1016
|
+
other = self.parent(other)
|
|
1017
|
+
other_tt = other.trailing_monomial()
|
|
1018
|
+
if not other_tt:
|
|
1019
|
+
raise ZeroDivisionError()
|
|
1020
|
+
self_prec = self.prec()
|
|
1021
|
+
if self_prec == infinity and other.prec() == infinity:
|
|
1022
|
+
if precision is None:
|
|
1023
|
+
precision = parent.default_prec()
|
|
1024
|
+
self = self.add_bigoh(precision)
|
|
1025
|
+
self_prec = self.prec()
|
|
1026
|
+
rem = parent.zero().add_bigoh(self_prec)
|
|
1027
|
+
quo = parent.zero().add_bigoh(self_prec-other.valuation())
|
|
1028
|
+
while self:
|
|
1029
|
+
# Loop invariants:
|
|
1030
|
+
# ``(the original value of self) - self == quo * other + rem``
|
|
1031
|
+
# and
|
|
1032
|
+
# ``(quo * other).prec() <= self.prec().
|
|
1033
|
+
# (``other`` doesn't change throughout the loop.)
|
|
1034
|
+
# The loop terminates because:
|
|
1035
|
+
# (1) every step increases ``self_tt``;
|
|
1036
|
+
# (2) either ``self`` has finite precision, or ``self`` is a
|
|
1037
|
+
# polynomial and ``other`` has infinite precision (in
|
|
1038
|
+
# which case either ``self`` will run out of nonzero
|
|
1039
|
+
# coefficients after sufficiently many iterations of the
|
|
1040
|
+
# if-case, or ``self``'s precision gets reduced to finite
|
|
1041
|
+
# in one iteration of the else-case).
|
|
1042
|
+
# These show that at the end we have
|
|
1043
|
+
# ``(the original value of self) == quo * other + rem``
|
|
1044
|
+
# up to the minimum of the precision of either side of this
|
|
1045
|
+
# equality and the precision of self.
|
|
1046
|
+
self_tt = self.trailing_monomial()
|
|
1047
|
+
#assert self_tt
|
|
1048
|
+
if not other_tt.divides(self_tt):
|
|
1049
|
+
self -= self_tt
|
|
1050
|
+
rem += self_tt
|
|
1051
|
+
else:
|
|
1052
|
+
d = self_tt//other_tt
|
|
1053
|
+
self -= d * other
|
|
1054
|
+
quo += d
|
|
1055
|
+
quo = quo.add_bigoh(self.prec()-other_tt.degree())
|
|
1056
|
+
return quo, rem
|
|
1057
|
+
|
|
1058
|
+
def _div_(self, denom_r):
|
|
1059
|
+
r"""
|
|
1060
|
+
Division in the ring of power series.
|
|
1061
|
+
|
|
1062
|
+
EXAMPLES::
|
|
1063
|
+
|
|
1064
|
+
sage: R.<a,b,c> = PowerSeriesRing(ZZ)
|
|
1065
|
+
sage: f = 1 + a + b - a*b + R.O(3)
|
|
1066
|
+
sage: g = 1/f; g #indirect doctest
|
|
1067
|
+
1 - a - b + a^2 + 3*a*b + b^2 + O(a, b, c)^3
|
|
1068
|
+
sage: g in R
|
|
1069
|
+
True
|
|
1070
|
+
sage: g == ~f
|
|
1071
|
+
True
|
|
1072
|
+
|
|
1073
|
+
When possible, division by non-units also works::
|
|
1074
|
+
|
|
1075
|
+
sage: a/(a*f) # needs sage.libs.singular
|
|
1076
|
+
1 - a - b + a^2 + 3*a*b + b^2 + O(a, b, c)^3
|
|
1077
|
+
|
|
1078
|
+
sage: a/(R.zero())
|
|
1079
|
+
Traceback (most recent call last):
|
|
1080
|
+
ZeroDivisionError
|
|
1081
|
+
|
|
1082
|
+
sage: (a*f)/f
|
|
1083
|
+
a + O(a, b, c)^4
|
|
1084
|
+
sage: f/(a*f) # needs sage.libs.singular
|
|
1085
|
+
Traceback (most recent call last):
|
|
1086
|
+
...
|
|
1087
|
+
ValueError: not divisible
|
|
1088
|
+
|
|
1089
|
+
An example where one loses precision::
|
|
1090
|
+
|
|
1091
|
+
sage: ((1+a)*f - f) / a*f # needs sage.libs.singular
|
|
1092
|
+
1 + 2*a + 2*b + O(a, b, c)^2
|
|
1093
|
+
|
|
1094
|
+
TESTS::
|
|
1095
|
+
|
|
1096
|
+
sage: ((a+b)*f) / f == (a+b)
|
|
1097
|
+
True
|
|
1098
|
+
sage: ((a+b)*f) / (a+b) == f # needs sage.libs.singular
|
|
1099
|
+
True
|
|
1100
|
+
"""
|
|
1101
|
+
if denom_r.is_unit(): # faster if denom_r is a unit
|
|
1102
|
+
return self.parent(self._bg_value * ~denom_r._bg_value)
|
|
1103
|
+
quo, rem = self.quo_rem(denom_r)
|
|
1104
|
+
if rem:
|
|
1105
|
+
raise ValueError("not divisible")
|
|
1106
|
+
else:
|
|
1107
|
+
return quo
|
|
1108
|
+
|
|
1109
|
+
def __mod__(self, other):
|
|
1110
|
+
"""
|
|
1111
|
+
TESTS::
|
|
1112
|
+
|
|
1113
|
+
sage: R.<a,b,c> = PowerSeriesRing(ZZ)
|
|
1114
|
+
sage: f = -a^3*b*c^2 + a^2*b^2*c^4 - 12*a^3*b^3*c^3 + R.O(10)
|
|
1115
|
+
sage: g = f % 2; g
|
|
1116
|
+
a^3*b*c^2 + a^2*b^2*c^4 + O(a, b, c)^10
|
|
1117
|
+
sage: g in R
|
|
1118
|
+
False
|
|
1119
|
+
sage: g in R.base_extend(Zmod(2))
|
|
1120
|
+
True
|
|
1121
|
+
sage: g.polynomial() == f.polynomial() % 2 # needs sage.libs.singular
|
|
1122
|
+
True
|
|
1123
|
+
"""
|
|
1124
|
+
if isinstance(other, (int, Integer)):
|
|
1125
|
+
return self.change_ring(Zmod(other))
|
|
1126
|
+
raise NotImplementedError("Mod on multivariate power series ring elements not defined except modulo an integer.")
|
|
1127
|
+
|
|
1128
|
+
def monomial_coefficients(self, copy=None):
|
|
1129
|
+
"""
|
|
1130
|
+
Return underlying dictionary with keys the exponents and values the
|
|
1131
|
+
coefficients of this power series.
|
|
1132
|
+
|
|
1133
|
+
EXAMPLES::
|
|
1134
|
+
|
|
1135
|
+
sage: M = PowerSeriesRing(QQ,4,'t',sparse=True); M
|
|
1136
|
+
Sparse Multivariate Power Series Ring in t0, t1, t2, t3 over
|
|
1137
|
+
Rational Field
|
|
1138
|
+
|
|
1139
|
+
sage: M.inject_variables()
|
|
1140
|
+
Defining t0, t1, t2, t3
|
|
1141
|
+
|
|
1142
|
+
sage: m = 2/3*t0*t1^15*t3^48 - t0^15*t1^21*t2^28*t3^5
|
|
1143
|
+
sage: m2 = 1/2*t0^12*t1^29*t2^46*t3^6 - 1/4*t0^39*t1^5*t2^23*t3^30 + M.O(100)
|
|
1144
|
+
sage: s = m + m2
|
|
1145
|
+
sage: s.monomial_coefficients()
|
|
1146
|
+
{(1, 15, 0, 48): 2/3,
|
|
1147
|
+
(12, 29, 46, 6): 1/2,
|
|
1148
|
+
(15, 21, 28, 5): -1,
|
|
1149
|
+
(39, 5, 23, 30): -1/4}
|
|
1150
|
+
|
|
1151
|
+
``dict`` is an alias::
|
|
1152
|
+
|
|
1153
|
+
sage: s.dict()
|
|
1154
|
+
{(1, 15, 0, 48): 2/3,
|
|
1155
|
+
(12, 29, 46, 6): 1/2,
|
|
1156
|
+
(15, 21, 28, 5): -1,
|
|
1157
|
+
(39, 5, 23, 30): -1/4}
|
|
1158
|
+
"""
|
|
1159
|
+
out_dict = {}
|
|
1160
|
+
for j in self._bg_value.coefficients():
|
|
1161
|
+
out_dict.update(j.monomial_coefficients())
|
|
1162
|
+
return out_dict
|
|
1163
|
+
|
|
1164
|
+
dict = monomial_coefficients
|
|
1165
|
+
|
|
1166
|
+
def polynomial(self):
|
|
1167
|
+
"""
|
|
1168
|
+
Return the underlying polynomial of ``self`` as an element of
|
|
1169
|
+
the underlying multivariate polynomial ring (the "foreground
|
|
1170
|
+
polynomial ring").
|
|
1171
|
+
|
|
1172
|
+
EXAMPLES::
|
|
1173
|
+
|
|
1174
|
+
sage: M = PowerSeriesRing(QQ,4,'t'); M
|
|
1175
|
+
Multivariate Power Series Ring in t0, t1, t2, t3 over Rational
|
|
1176
|
+
Field
|
|
1177
|
+
sage: t = M.gens()
|
|
1178
|
+
sage: f = 1/2*t[0]^3*t[1]^3*t[2]^2 + 2/3*t[0]*t[2]^6*t[3] \
|
|
1179
|
+
....: - t[0]^3*t[1]^3*t[3]^3 - 1/4*t[0]*t[1]*t[2]^7 + M.O(10)
|
|
1180
|
+
sage: f
|
|
1181
|
+
1/2*t0^3*t1^3*t2^2 + 2/3*t0*t2^6*t3 - t0^3*t1^3*t3^3
|
|
1182
|
+
- 1/4*t0*t1*t2^7 + O(t0, t1, t2, t3)^10
|
|
1183
|
+
|
|
1184
|
+
sage: f.polynomial()
|
|
1185
|
+
1/2*t0^3*t1^3*t2^2 + 2/3*t0*t2^6*t3 - t0^3*t1^3*t3^3
|
|
1186
|
+
- 1/4*t0*t1*t2^7
|
|
1187
|
+
|
|
1188
|
+
sage: f.polynomial().parent()
|
|
1189
|
+
Multivariate Polynomial Ring in t0, t1, t2, t3 over Rational Field
|
|
1190
|
+
|
|
1191
|
+
Contrast with :meth:`truncate`::
|
|
1192
|
+
|
|
1193
|
+
sage: f.truncate()
|
|
1194
|
+
1/2*t0^3*t1^3*t2^2 + 2/3*t0*t2^6*t3 - t0^3*t1^3*t3^3 - 1/4*t0*t1*t2^7
|
|
1195
|
+
sage: f.truncate().parent()
|
|
1196
|
+
Multivariate Power Series Ring in t0, t1, t2, t3 over Rational Field
|
|
1197
|
+
"""
|
|
1198
|
+
return self._value()
|
|
1199
|
+
|
|
1200
|
+
def variables(self):
|
|
1201
|
+
"""
|
|
1202
|
+
Return tuple of variables occurring in ``self``.
|
|
1203
|
+
|
|
1204
|
+
EXAMPLES::
|
|
1205
|
+
|
|
1206
|
+
sage: T = PowerSeriesRing(GF(3),5,'t'); T
|
|
1207
|
+
Multivariate Power Series Ring in t0, t1, t2, t3, t4 over
|
|
1208
|
+
Finite Field of size 3
|
|
1209
|
+
sage: t = T.gens()
|
|
1210
|
+
sage: w = t[0] - 2*t[0]*t[2] + 5*t[4]^3 - t[0]^3*t[2]^2 + T.O(6)
|
|
1211
|
+
sage: w
|
|
1212
|
+
t0 + t0*t2 - t4^3 - t0^3*t2^2 + O(t0, t1, t2, t3, t4)^6
|
|
1213
|
+
sage: w.variables()
|
|
1214
|
+
(t0, t2, t4)
|
|
1215
|
+
"""
|
|
1216
|
+
return tuple(self.parent(v) for v in self._value().variables())
|
|
1217
|
+
|
|
1218
|
+
def monomials(self):
|
|
1219
|
+
"""
|
|
1220
|
+
Return a list of monomials of ``self``.
|
|
1221
|
+
|
|
1222
|
+
These are the keys of the dict returned by :meth:`coefficients`.
|
|
1223
|
+
|
|
1224
|
+
EXAMPLES::
|
|
1225
|
+
|
|
1226
|
+
sage: R.<a,b,c> = PowerSeriesRing(ZZ); R
|
|
1227
|
+
Multivariate Power Series Ring in a, b, c over Integer Ring
|
|
1228
|
+
sage: f = 1 + a + b - a*b - b*c - a*c + R.O(4)
|
|
1229
|
+
sage: sorted(f.monomials())
|
|
1230
|
+
[b*c, a*c, a*b, b, a, 1]
|
|
1231
|
+
sage: f = 1 + 2*a + 7*b - 2*a*b - 4*b*c - 13*a*c + R.O(4)
|
|
1232
|
+
sage: sorted(f.monomials())
|
|
1233
|
+
[b*c, a*c, a*b, b, a, 1]
|
|
1234
|
+
sage: f = R.zero()
|
|
1235
|
+
sage: f.monomials()
|
|
1236
|
+
[]
|
|
1237
|
+
"""
|
|
1238
|
+
return list(self.coefficients())
|
|
1239
|
+
|
|
1240
|
+
def coefficients(self):
|
|
1241
|
+
"""
|
|
1242
|
+
Return a dict of monomials and coefficients.
|
|
1243
|
+
|
|
1244
|
+
EXAMPLES::
|
|
1245
|
+
|
|
1246
|
+
sage: R.<s,t> = PowerSeriesRing(ZZ); R
|
|
1247
|
+
Multivariate Power Series Ring in s, t over Integer Ring
|
|
1248
|
+
sage: f = 1 + t + s + s*t + R.O(3)
|
|
1249
|
+
sage: f.coefficients()
|
|
1250
|
+
{s*t: 1, t: 1, s: 1, 1: 1}
|
|
1251
|
+
sage: (f^2).coefficients()
|
|
1252
|
+
{t^2: 1, s*t: 4, s^2: 1, t: 2, s: 2, 1: 1}
|
|
1253
|
+
|
|
1254
|
+
sage: g = f^2 + f - 2; g
|
|
1255
|
+
3*s + 3*t + s^2 + 5*s*t + t^2 + O(s, t)^3
|
|
1256
|
+
sage: cd = g.coefficients()
|
|
1257
|
+
sage: g2 = sum(k*v for (k,v) in cd.items()); g2
|
|
1258
|
+
3*s + 3*t + s^2 + 5*s*t + t^2
|
|
1259
|
+
sage: g2 == g.truncate()
|
|
1260
|
+
True
|
|
1261
|
+
"""
|
|
1262
|
+
if self.is_sparse():
|
|
1263
|
+
return self.monomial_coefficients()
|
|
1264
|
+
tmp = {}
|
|
1265
|
+
for j in self._bg_value.coefficients():
|
|
1266
|
+
for m in j.monomials():
|
|
1267
|
+
tmp[self.parent(m)] = j.monomial_coefficient(self.parent()._poly_ring(m))
|
|
1268
|
+
return tmp
|
|
1269
|
+
|
|
1270
|
+
def constant_coefficient(self):
|
|
1271
|
+
"""
|
|
1272
|
+
Return constant coefficient of ``self``.
|
|
1273
|
+
|
|
1274
|
+
EXAMPLES::
|
|
1275
|
+
|
|
1276
|
+
sage: R.<a,b,c> = PowerSeriesRing(ZZ); R
|
|
1277
|
+
Multivariate Power Series Ring in a, b, c over Integer Ring
|
|
1278
|
+
sage: f = 3 + a + b - a*b - b*c - a*c + R.O(4)
|
|
1279
|
+
sage: f.constant_coefficient()
|
|
1280
|
+
3
|
|
1281
|
+
sage: f.constant_coefficient().parent()
|
|
1282
|
+
Integer Ring
|
|
1283
|
+
"""
|
|
1284
|
+
return self.base_ring()(self._bg_value[0])
|
|
1285
|
+
|
|
1286
|
+
def exponents(self):
|
|
1287
|
+
"""
|
|
1288
|
+
Return a list of tuples which hold the exponents of each monomial
|
|
1289
|
+
of ``self``.
|
|
1290
|
+
|
|
1291
|
+
EXAMPLES::
|
|
1292
|
+
|
|
1293
|
+
sage: H = QQ[['x,y']]
|
|
1294
|
+
sage: (x,y) = H.gens()
|
|
1295
|
+
sage: h = -y^2 - x*y^3 - 6/5*y^6 - x^7 + 2*x^5*y^2 + H.O(10)
|
|
1296
|
+
sage: h
|
|
1297
|
+
-y^2 - x*y^3 - 6/5*y^6 - x^7 + 2*x^5*y^2 + O(x, y)^10
|
|
1298
|
+
sage: h.exponents()
|
|
1299
|
+
[(0, 2), (1, 3), (0, 6), (7, 0), (5, 2)]
|
|
1300
|
+
"""
|
|
1301
|
+
exp_list = []
|
|
1302
|
+
for m in self._bg_value.coefficients():
|
|
1303
|
+
exp_list += m.exponents()
|
|
1304
|
+
return exp_list
|
|
1305
|
+
|
|
1306
|
+
def V(self, n):
|
|
1307
|
+
r"""
|
|
1308
|
+
If
|
|
1309
|
+
|
|
1310
|
+
.. MATH::
|
|
1311
|
+
|
|
1312
|
+
f = \sum a_{m_0, \ldots, m_k} x_0^{m_0} \cdots x_k^{m_k},
|
|
1313
|
+
|
|
1314
|
+
then this function returns
|
|
1315
|
+
|
|
1316
|
+
.. MATH::
|
|
1317
|
+
|
|
1318
|
+
\sum a_{m_0, \ldots, m_k} x_0^{n m_0} \cdots x_k^{n m_k}.
|
|
1319
|
+
|
|
1320
|
+
The total-degree precision of the output is ``n`` times the precision
|
|
1321
|
+
of ``self``.
|
|
1322
|
+
|
|
1323
|
+
EXAMPLES::
|
|
1324
|
+
|
|
1325
|
+
sage: H = QQ[['x,y,z']]
|
|
1326
|
+
sage: (x,y,z) = H.gens()
|
|
1327
|
+
sage: h = -x*y^4*z^7 - 1/4*y*z^12 + 1/2*x^7*y^5*z^2 \
|
|
1328
|
+
....: + 2/3*y^6*z^8 + H.O(15)
|
|
1329
|
+
sage: h.V(3)
|
|
1330
|
+
-x^3*y^12*z^21 - 1/4*y^3*z^36 + 1/2*x^21*y^15*z^6 + 2/3*y^18*z^24 + O(x, y, z)^45
|
|
1331
|
+
"""
|
|
1332
|
+
cd = self.coefficients()
|
|
1333
|
+
Vs = sum(v * k**n for k, v in cd.items())
|
|
1334
|
+
return Vs.add_bigoh(self.prec()*n)
|
|
1335
|
+
|
|
1336
|
+
def prec(self):
|
|
1337
|
+
"""
|
|
1338
|
+
Return precision of ``self``.
|
|
1339
|
+
|
|
1340
|
+
EXAMPLES::
|
|
1341
|
+
|
|
1342
|
+
sage: R.<a,b,c> = PowerSeriesRing(ZZ); R
|
|
1343
|
+
Multivariate Power Series Ring in a, b, c over Integer Ring
|
|
1344
|
+
sage: f = 3 + a + b - a*b - b*c - a*c + R.O(4)
|
|
1345
|
+
sage: f.prec()
|
|
1346
|
+
4
|
|
1347
|
+
sage: f.truncate().prec()
|
|
1348
|
+
+Infinity
|
|
1349
|
+
"""
|
|
1350
|
+
return self._prec
|
|
1351
|
+
|
|
1352
|
+
def add_bigoh(self, prec):
|
|
1353
|
+
"""
|
|
1354
|
+
Return a multivariate power series of precision ``prec``
|
|
1355
|
+
obtained by truncating ``self`` at precision ``prec``.
|
|
1356
|
+
|
|
1357
|
+
This is the same as :meth:`O`.
|
|
1358
|
+
|
|
1359
|
+
EXAMPLES::
|
|
1360
|
+
|
|
1361
|
+
sage: B.<x,y> = PowerSeriesRing(QQ); B
|
|
1362
|
+
Multivariate Power Series Ring in x, y over Rational Field
|
|
1363
|
+
sage: r = 1 - x*y + x^2
|
|
1364
|
+
sage: r.add_bigoh(4)
|
|
1365
|
+
1 + x^2 - x*y + O(x, y)^4
|
|
1366
|
+
sage: r.add_bigoh(2)
|
|
1367
|
+
1 + O(x, y)^2
|
|
1368
|
+
|
|
1369
|
+
Note that this does not change ``self``::
|
|
1370
|
+
|
|
1371
|
+
sage: r
|
|
1372
|
+
1 + x^2 - x*y
|
|
1373
|
+
"""
|
|
1374
|
+
return self.parent(self._bg_value.add_bigoh(prec))
|
|
1375
|
+
|
|
1376
|
+
def O(self, prec):
|
|
1377
|
+
"""
|
|
1378
|
+
Return a multivariate power series of precision ``prec``
|
|
1379
|
+
obtained by truncating ``self`` at precision ``prec``.
|
|
1380
|
+
|
|
1381
|
+
This is the same as :meth:`add_bigoh`.
|
|
1382
|
+
|
|
1383
|
+
EXAMPLES::
|
|
1384
|
+
|
|
1385
|
+
sage: B.<x,y> = PowerSeriesRing(QQ); B
|
|
1386
|
+
Multivariate Power Series Ring in x, y over Rational Field
|
|
1387
|
+
sage: r = 1 - x*y + x^2
|
|
1388
|
+
sage: r.O(4)
|
|
1389
|
+
1 + x^2 - x*y + O(x, y)^4
|
|
1390
|
+
sage: r.O(2)
|
|
1391
|
+
1 + O(x, y)^2
|
|
1392
|
+
|
|
1393
|
+
Note that this does not change ``self``::
|
|
1394
|
+
|
|
1395
|
+
sage: r
|
|
1396
|
+
1 + x^2 - x*y
|
|
1397
|
+
"""
|
|
1398
|
+
return self.parent(self._bg_value.O(prec))
|
|
1399
|
+
|
|
1400
|
+
def truncate(self, prec=infinity):
|
|
1401
|
+
"""
|
|
1402
|
+
Return infinite precision multivariate power series formed by
|
|
1403
|
+
truncating ``self`` at precision ``prec``.
|
|
1404
|
+
|
|
1405
|
+
EXAMPLES::
|
|
1406
|
+
|
|
1407
|
+
sage: M = PowerSeriesRing(QQ,4,'t'); M
|
|
1408
|
+
Multivariate Power Series Ring in t0, t1, t2, t3 over Rational Field
|
|
1409
|
+
sage: t = M.gens()
|
|
1410
|
+
sage: f = 1/2*t[0]^3*t[1]^3*t[2]^2 + 2/3*t[0]*t[2]^6*t[3] \
|
|
1411
|
+
....: - t[0]^3*t[1]^3*t[3]^3 - 1/4*t[0]*t[1]*t[2]^7 + M.O(10)
|
|
1412
|
+
sage: f
|
|
1413
|
+
1/2*t0^3*t1^3*t2^2 + 2/3*t0*t2^6*t3 - t0^3*t1^3*t3^3
|
|
1414
|
+
- 1/4*t0*t1*t2^7 + O(t0, t1, t2, t3)^10
|
|
1415
|
+
|
|
1416
|
+
sage: f.truncate()
|
|
1417
|
+
1/2*t0^3*t1^3*t2^2 + 2/3*t0*t2^6*t3 - t0^3*t1^3*t3^3
|
|
1418
|
+
- 1/4*t0*t1*t2^7
|
|
1419
|
+
sage: f.truncate().parent()
|
|
1420
|
+
Multivariate Power Series Ring in t0, t1, t2, t3 over Rational Field
|
|
1421
|
+
|
|
1422
|
+
Contrast with polynomial::
|
|
1423
|
+
|
|
1424
|
+
sage: f.polynomial()
|
|
1425
|
+
1/2*t0^3*t1^3*t2^2 + 2/3*t0*t2^6*t3 - t0^3*t1^3*t3^3 - 1/4*t0*t1*t2^7
|
|
1426
|
+
sage: f.polynomial().parent()
|
|
1427
|
+
Multivariate Polynomial Ring in t0, t1, t2, t3 over Rational Field
|
|
1428
|
+
"""
|
|
1429
|
+
return self.parent((self.O(prec))._value())
|
|
1430
|
+
|
|
1431
|
+
def valuation(self):
|
|
1432
|
+
r"""
|
|
1433
|
+
Return the valuation of ``self``.
|
|
1434
|
+
|
|
1435
|
+
The valuation of a power series `f` is the highest nonnegative
|
|
1436
|
+
integer `k` less or equal to the precision of `f` and such
|
|
1437
|
+
that the coefficient of `f` before each term of degree `< k` is
|
|
1438
|
+
zero. (If such an integer does not exist, then the valuation is
|
|
1439
|
+
the precision of `f` itself.)
|
|
1440
|
+
|
|
1441
|
+
EXAMPLES::
|
|
1442
|
+
|
|
1443
|
+
sage: # needs sage.rings.finite_rings
|
|
1444
|
+
sage: R.<a,b> = PowerSeriesRing(GF(4949717)); R
|
|
1445
|
+
Multivariate Power Series Ring in a, b
|
|
1446
|
+
over Finite Field of size 4949717
|
|
1447
|
+
sage: f = a^2 + a*b + a^3 + R.O(9)
|
|
1448
|
+
sage: f.valuation()
|
|
1449
|
+
2
|
|
1450
|
+
sage: g = 1 + a + a^3
|
|
1451
|
+
sage: g.valuation()
|
|
1452
|
+
0
|
|
1453
|
+
sage: R.zero().valuation()
|
|
1454
|
+
+Infinity
|
|
1455
|
+
"""
|
|
1456
|
+
try:
|
|
1457
|
+
return self._bg_value.valuation()
|
|
1458
|
+
except (TypeError, AttributeError):
|
|
1459
|
+
if self._bg_value == 0:
|
|
1460
|
+
return infinity
|
|
1461
|
+
|
|
1462
|
+
# at this stage, self is probably a nonzero
|
|
1463
|
+
# element of the base ring
|
|
1464
|
+
for a in range(len(self._bg_value.list())):
|
|
1465
|
+
if self._bg_value.list()[a] != 0:
|
|
1466
|
+
return a
|
|
1467
|
+
|
|
1468
|
+
def is_nilpotent(self):
|
|
1469
|
+
"""
|
|
1470
|
+
Return ``True`` if ``self`` is nilpotent. This occurs if
|
|
1471
|
+
|
|
1472
|
+
- ``self`` has finite precision and positive valuation, or
|
|
1473
|
+
- ``self`` is constant and nilpotent in base ring.
|
|
1474
|
+
|
|
1475
|
+
Otherwise, return ``False``.
|
|
1476
|
+
|
|
1477
|
+
.. WARNING::
|
|
1478
|
+
|
|
1479
|
+
This is so far just a sufficient condition, so don't trust
|
|
1480
|
+
a ``False`` output to be legit!
|
|
1481
|
+
|
|
1482
|
+
.. TODO::
|
|
1483
|
+
|
|
1484
|
+
What should we do about this method? Is nilpotency of a
|
|
1485
|
+
power series even decidable (assuming a nilpotency oracle
|
|
1486
|
+
in the base ring)? And I am not sure that returning
|
|
1487
|
+
``True`` just because the series has finite precision and
|
|
1488
|
+
zero constant term is a good idea.
|
|
1489
|
+
|
|
1490
|
+
EXAMPLES::
|
|
1491
|
+
|
|
1492
|
+
sage: R.<a,b,c> = PowerSeriesRing(Zmod(8)); R
|
|
1493
|
+
Multivariate Power Series Ring in a, b, c over Ring of integers modulo 8
|
|
1494
|
+
sage: f = a + b + c + a^2*c
|
|
1495
|
+
sage: f.is_nilpotent()
|
|
1496
|
+
False
|
|
1497
|
+
sage: f = f.O(4); f
|
|
1498
|
+
a + b + c + a^2*c + O(a, b, c)^4
|
|
1499
|
+
sage: f.is_nilpotent()
|
|
1500
|
+
True
|
|
1501
|
+
|
|
1502
|
+
sage: g = R(2)
|
|
1503
|
+
sage: g.is_nilpotent()
|
|
1504
|
+
True
|
|
1505
|
+
sage: (g.O(4)).is_nilpotent()
|
|
1506
|
+
True
|
|
1507
|
+
|
|
1508
|
+
sage: S = R.change_ring(QQ)
|
|
1509
|
+
sage: S(g).is_nilpotent()
|
|
1510
|
+
False
|
|
1511
|
+
sage: S(g.O(4)).is_nilpotent()
|
|
1512
|
+
False
|
|
1513
|
+
"""
|
|
1514
|
+
if self.prec() < infinity and self.valuation() > 0:
|
|
1515
|
+
return True
|
|
1516
|
+
elif self == self.constant_coefficient() and \
|
|
1517
|
+
self.base_ring()(self.constant_coefficient()).is_nilpotent():
|
|
1518
|
+
return True
|
|
1519
|
+
else:
|
|
1520
|
+
return False
|
|
1521
|
+
|
|
1522
|
+
def degree(self):
|
|
1523
|
+
"""
|
|
1524
|
+
Return degree of underlying polynomial of ``self``.
|
|
1525
|
+
|
|
1526
|
+
EXAMPLES::
|
|
1527
|
+
|
|
1528
|
+
sage: B.<x,y> = PowerSeriesRing(QQ)
|
|
1529
|
+
sage: B
|
|
1530
|
+
Multivariate Power Series Ring in x, y over Rational Field
|
|
1531
|
+
sage: r = 1 - x*y + x^2
|
|
1532
|
+
sage: r = r.add_bigoh(4); r
|
|
1533
|
+
1 + x^2 - x*y + O(x, y)^4
|
|
1534
|
+
sage: r.degree()
|
|
1535
|
+
2
|
|
1536
|
+
"""
|
|
1537
|
+
return self._value().degree()
|
|
1538
|
+
|
|
1539
|
+
def is_unit(self):
|
|
1540
|
+
"""
|
|
1541
|
+
A multivariate power series is a unit if and only if its constant
|
|
1542
|
+
coefficient is a unit.
|
|
1543
|
+
|
|
1544
|
+
EXAMPLES::
|
|
1545
|
+
|
|
1546
|
+
sage: R.<a,b> = PowerSeriesRing(ZZ); R
|
|
1547
|
+
Multivariate Power Series Ring in a, b over Integer Ring
|
|
1548
|
+
sage: f = 2 + a^2 + a*b + a^3 + R.O(9)
|
|
1549
|
+
sage: f.is_unit()
|
|
1550
|
+
False
|
|
1551
|
+
sage: f.base_extend(QQ).is_unit()
|
|
1552
|
+
True
|
|
1553
|
+
sage: (O(a,b)^0).is_unit()
|
|
1554
|
+
False
|
|
1555
|
+
"""
|
|
1556
|
+
# Return False for 0 + O(a, b)^0, which is the only element with precision_absolute == 0.
|
|
1557
|
+
if self.precision_absolute() == 0:
|
|
1558
|
+
return False
|
|
1559
|
+
return self._bg_value[0].is_unit()
|
|
1560
|
+
|
|
1561
|
+
###
|
|
1562
|
+
### the following could be implemented, but aren't
|
|
1563
|
+
###
|
|
1564
|
+
|
|
1565
|
+
def padded_list(self):
|
|
1566
|
+
"""
|
|
1567
|
+
Method from univariate power series not yet implemented.
|
|
1568
|
+
|
|
1569
|
+
TESTS::
|
|
1570
|
+
|
|
1571
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ,2)
|
|
1572
|
+
sage: f = a + b + a*b + T.O(5)
|
|
1573
|
+
sage: f.padded_list()
|
|
1574
|
+
Traceback (most recent call last):
|
|
1575
|
+
...
|
|
1576
|
+
NotImplementedError: padded_list
|
|
1577
|
+
"""
|
|
1578
|
+
raise NotImplementedError("padded_list")
|
|
1579
|
+
|
|
1580
|
+
def is_square(self):
|
|
1581
|
+
"""
|
|
1582
|
+
Method from univariate power series not yet implemented.
|
|
1583
|
+
|
|
1584
|
+
TESTS::
|
|
1585
|
+
|
|
1586
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
1587
|
+
sage: f = a + b + a*b + T.O(5)
|
|
1588
|
+
sage: f.is_square()
|
|
1589
|
+
Traceback (most recent call last):
|
|
1590
|
+
...
|
|
1591
|
+
NotImplementedError: is_square
|
|
1592
|
+
"""
|
|
1593
|
+
raise NotImplementedError("is_square")
|
|
1594
|
+
|
|
1595
|
+
def square_root(self):
|
|
1596
|
+
"""
|
|
1597
|
+
Method from univariate power series not yet implemented.
|
|
1598
|
+
Depends on square root method for multivariate polynomials.
|
|
1599
|
+
|
|
1600
|
+
TESTS::
|
|
1601
|
+
|
|
1602
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
1603
|
+
sage: f = a + b + a*b + T.O(5)
|
|
1604
|
+
sage: f.square_root()
|
|
1605
|
+
Traceback (most recent call last):
|
|
1606
|
+
...
|
|
1607
|
+
NotImplementedError: square_root
|
|
1608
|
+
"""
|
|
1609
|
+
raise NotImplementedError("square_root")
|
|
1610
|
+
|
|
1611
|
+
sqrt = square_root
|
|
1612
|
+
|
|
1613
|
+
def derivative(self, *args):
|
|
1614
|
+
"""
|
|
1615
|
+
The formal derivative of this power series, with respect to
|
|
1616
|
+
variables supplied in ``args``.
|
|
1617
|
+
|
|
1618
|
+
EXAMPLES::
|
|
1619
|
+
|
|
1620
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
1621
|
+
sage: f = a + b + a^2*b + T.O(5)
|
|
1622
|
+
sage: f.derivative(a)
|
|
1623
|
+
1 + 2*a*b + O(a, b)^4
|
|
1624
|
+
sage: f.derivative(a,2)
|
|
1625
|
+
2*b + O(a, b)^3
|
|
1626
|
+
sage: f.derivative(a,a)
|
|
1627
|
+
2*b + O(a, b)^3
|
|
1628
|
+
sage: f.derivative([a,a])
|
|
1629
|
+
2*b + O(a, b)^3
|
|
1630
|
+
sage: f.derivative(a,5)
|
|
1631
|
+
0 + O(a, b)^0
|
|
1632
|
+
sage: f.derivative(a,6)
|
|
1633
|
+
0 + O(a, b)^0
|
|
1634
|
+
"""
|
|
1635
|
+
from sage.misc.derivative import derivative_parse
|
|
1636
|
+
R = self.parent()
|
|
1637
|
+
variables = [ x.polynomial() for x in derivative_parse(args) ]
|
|
1638
|
+
deriv = self.polynomial().derivative(variables)
|
|
1639
|
+
new_prec = max(self.prec()-len(variables), 0)
|
|
1640
|
+
return R(deriv) + R.O(new_prec)
|
|
1641
|
+
|
|
1642
|
+
def integral(self, *args):
|
|
1643
|
+
"""
|
|
1644
|
+
The formal integral of this multivariate power series, with respect to
|
|
1645
|
+
variables supplied in ``args``.
|
|
1646
|
+
|
|
1647
|
+
The variable sequence ``args`` can contain both variables and
|
|
1648
|
+
counts; for the syntax, see
|
|
1649
|
+
:meth:`~sage.misc.derivative.derivative_parse`.
|
|
1650
|
+
|
|
1651
|
+
EXAMPLES::
|
|
1652
|
+
|
|
1653
|
+
sage: T.<a,b> = PowerSeriesRing(QQ, 2)
|
|
1654
|
+
sage: f = a + b + a^2*b + T.O(5)
|
|
1655
|
+
sage: f.integral(a, 2)
|
|
1656
|
+
1/6*a^3 + 1/2*a^2*b + 1/12*a^4*b + O(a, b)^7
|
|
1657
|
+
sage: f.integral(a, b)
|
|
1658
|
+
1/2*a^2*b + 1/2*a*b^2 + 1/6*a^3*b^2 + O(a, b)^7
|
|
1659
|
+
sage: f.integral(a, 5)
|
|
1660
|
+
1/720*a^6 + 1/120*a^5*b + 1/2520*a^7*b + O(a, b)^10
|
|
1661
|
+
|
|
1662
|
+
Only integration with respect to variables works::
|
|
1663
|
+
|
|
1664
|
+
sage: f.integral(a + b)
|
|
1665
|
+
Traceback (most recent call last):
|
|
1666
|
+
...
|
|
1667
|
+
ValueError: a + b is not a variable
|
|
1668
|
+
|
|
1669
|
+
.. warning:: Coefficient division.
|
|
1670
|
+
|
|
1671
|
+
If the base ring is not a field (e.g. `ZZ`), or if it has a
|
|
1672
|
+
nonzero characteristic, (e.g. `ZZ/3ZZ`), integration is not
|
|
1673
|
+
always possible while staying with the same base ring. In the
|
|
1674
|
+
first case, Sage will report that it has not been able to
|
|
1675
|
+
coerce some coefficient to the base ring::
|
|
1676
|
+
|
|
1677
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
1678
|
+
sage: f = a + T.O(5)
|
|
1679
|
+
sage: f.integral(a)
|
|
1680
|
+
Traceback (most recent call last):
|
|
1681
|
+
...
|
|
1682
|
+
TypeError: no conversion of this rational to integer
|
|
1683
|
+
|
|
1684
|
+
One can get the correct result by changing the base ring first::
|
|
1685
|
+
|
|
1686
|
+
sage: f.change_ring(QQ).integral(a)
|
|
1687
|
+
1/2*a^2 + O(a, b)^6
|
|
1688
|
+
|
|
1689
|
+
However, a correct result is returned even without base change
|
|
1690
|
+
if the denominator cancels::
|
|
1691
|
+
|
|
1692
|
+
sage: f = 2*b + T.O(5)
|
|
1693
|
+
sage: f.integral(b)
|
|
1694
|
+
b^2 + O(a, b)^6
|
|
1695
|
+
|
|
1696
|
+
In nonzero characteristic, Sage will report that a zero division
|
|
1697
|
+
occurred ::
|
|
1698
|
+
|
|
1699
|
+
sage: T.<a,b> = PowerSeriesRing(Zmod(3), 2)
|
|
1700
|
+
sage: (a^3).integral(a)
|
|
1701
|
+
a^4
|
|
1702
|
+
sage: (a^2).integral(a)
|
|
1703
|
+
Traceback (most recent call last):
|
|
1704
|
+
...
|
|
1705
|
+
ZeroDivisionError: inverse of Mod(0, 3) does not exist
|
|
1706
|
+
"""
|
|
1707
|
+
from sage.misc.derivative import derivative_parse
|
|
1708
|
+
res = self
|
|
1709
|
+
for v in derivative_parse(args):
|
|
1710
|
+
res = res._integral(v)
|
|
1711
|
+
return res
|
|
1712
|
+
|
|
1713
|
+
def _integral(self, xx):
|
|
1714
|
+
"""
|
|
1715
|
+
Formal integral for multivariate power series.
|
|
1716
|
+
|
|
1717
|
+
INPUT:
|
|
1718
|
+
|
|
1719
|
+
- ``xx`` -- a generator of the power series ring (the
|
|
1720
|
+
one with respect to which to integrate)
|
|
1721
|
+
|
|
1722
|
+
EXAMPLES::
|
|
1723
|
+
|
|
1724
|
+
sage: T.<a,b> = PowerSeriesRing(QQ,2)
|
|
1725
|
+
sage: f = a + b + a^2*b + T.O(5)
|
|
1726
|
+
sage: f._integral(a)
|
|
1727
|
+
1/2*a^2 + a*b + 1/3*a^3*b + O(a, b)^6
|
|
1728
|
+
sage: f._integral(b)
|
|
1729
|
+
a*b + 1/2*b^2 + 1/2*a^2*b^2 + O(a, b)^6
|
|
1730
|
+
|
|
1731
|
+
TESTS:
|
|
1732
|
+
|
|
1733
|
+
We try to recognize variables even if they are not recognized as
|
|
1734
|
+
generators of the rings::
|
|
1735
|
+
|
|
1736
|
+
sage: T.<a,b> = PowerSeriesRing(QQ,2)
|
|
1737
|
+
sage: a.is_gen()
|
|
1738
|
+
True
|
|
1739
|
+
sage: (a+0).is_gen()
|
|
1740
|
+
False
|
|
1741
|
+
sage: (a+b).integral(a+0)
|
|
1742
|
+
1/2*a^2 + a*b
|
|
1743
|
+
|
|
1744
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ,2)
|
|
1745
|
+
sage: aa = a.change_ring(Zmod(5))
|
|
1746
|
+
sage: aa.is_gen()
|
|
1747
|
+
False
|
|
1748
|
+
sage: aa.integral(aa)
|
|
1749
|
+
3*a^2
|
|
1750
|
+
sage: aa.integral(a)
|
|
1751
|
+
3*a^2
|
|
1752
|
+
"""
|
|
1753
|
+
P = self.parent()
|
|
1754
|
+
R = P.base_ring()
|
|
1755
|
+
xx = P(xx)
|
|
1756
|
+
if not xx.is_gen():
|
|
1757
|
+
for g in P.gens(): # try to find a generator equal to xx
|
|
1758
|
+
if g == xx:
|
|
1759
|
+
xx = g
|
|
1760
|
+
break
|
|
1761
|
+
else:
|
|
1762
|
+
raise ValueError("%s is not a variable" % xx)
|
|
1763
|
+
xxe = xx.exponents()[0]
|
|
1764
|
+
pos = [i for i, c in enumerate(xxe) if c != 0][0] # get the position of the variable
|
|
1765
|
+
res = {mon.eadd(xxe): R(co / (mon[pos]+1))
|
|
1766
|
+
for mon, co in self.monomial_coefficients().items()}
|
|
1767
|
+
return P( res ).add_bigoh(self.prec()+1)
|
|
1768
|
+
|
|
1769
|
+
def ogf(self):
|
|
1770
|
+
"""
|
|
1771
|
+
Method from univariate power series not yet implemented.
|
|
1772
|
+
|
|
1773
|
+
TESTS::
|
|
1774
|
+
|
|
1775
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
1776
|
+
sage: f = a + b + a*b + T.O(5)
|
|
1777
|
+
sage: f.ogf()
|
|
1778
|
+
Traceback (most recent call last):
|
|
1779
|
+
...
|
|
1780
|
+
NotImplementedError: ogf
|
|
1781
|
+
"""
|
|
1782
|
+
raise NotImplementedError("ogf")
|
|
1783
|
+
|
|
1784
|
+
def egf(self):
|
|
1785
|
+
"""
|
|
1786
|
+
Method from univariate power series not yet implemented.
|
|
1787
|
+
|
|
1788
|
+
TESTS::
|
|
1789
|
+
|
|
1790
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
1791
|
+
sage: f = a + b + a*b + T.O(5)
|
|
1792
|
+
sage: f.egf()
|
|
1793
|
+
Traceback (most recent call last):
|
|
1794
|
+
...
|
|
1795
|
+
NotImplementedError: egf
|
|
1796
|
+
"""
|
|
1797
|
+
raise NotImplementedError("egf")
|
|
1798
|
+
|
|
1799
|
+
def __pari__(self):
|
|
1800
|
+
"""
|
|
1801
|
+
Method from univariate power series not yet implemented.
|
|
1802
|
+
|
|
1803
|
+
TESTS::
|
|
1804
|
+
|
|
1805
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
1806
|
+
sage: f = a + b + a*b + T.O(5)
|
|
1807
|
+
sage: f.__pari__()
|
|
1808
|
+
Traceback (most recent call last):
|
|
1809
|
+
...
|
|
1810
|
+
NotImplementedError: __pari__
|
|
1811
|
+
"""
|
|
1812
|
+
raise NotImplementedError("__pari__")
|
|
1813
|
+
|
|
1814
|
+
###
|
|
1815
|
+
### the following don't make sense for multivariable power series
|
|
1816
|
+
###
|
|
1817
|
+
def list(self):
|
|
1818
|
+
"""
|
|
1819
|
+
Doesn't make sense for multivariate power series.
|
|
1820
|
+
Multivariate polynomials don't have list of coefficients either.
|
|
1821
|
+
|
|
1822
|
+
TESTS::
|
|
1823
|
+
|
|
1824
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
1825
|
+
sage: f = a + b + a*b + T.O(5)
|
|
1826
|
+
sage: f.list()
|
|
1827
|
+
Traceback (most recent call last):
|
|
1828
|
+
...
|
|
1829
|
+
NotImplementedError: Multivariate power series do not have list
|
|
1830
|
+
of coefficients; use 'coefficients' to get a dict of coefficients.
|
|
1831
|
+
"""
|
|
1832
|
+
#return [self.parent(c) for c in self._bg_value.list()]
|
|
1833
|
+
raise NotImplementedError("Multivariate power series do not have list of coefficients; use 'coefficients' to get a dict of coefficients.")
|
|
1834
|
+
|
|
1835
|
+
def variable(self):
|
|
1836
|
+
"""
|
|
1837
|
+
Doesn't make sense for multivariate power series.
|
|
1838
|
+
|
|
1839
|
+
TESTS::
|
|
1840
|
+
|
|
1841
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
1842
|
+
sage: f = a + b + a*b + T.O(5)
|
|
1843
|
+
sage: f.variable()
|
|
1844
|
+
Traceback (most recent call last):
|
|
1845
|
+
...
|
|
1846
|
+
NotImplementedError: variable not defined for multivariate power
|
|
1847
|
+
series; use 'variables' instead.
|
|
1848
|
+
"""
|
|
1849
|
+
raise NotImplementedError("variable not defined for multivariate power series; use 'variables' instead.")
|
|
1850
|
+
|
|
1851
|
+
def shift(self, n):
|
|
1852
|
+
"""
|
|
1853
|
+
Doesn't make sense for multivariate power series.
|
|
1854
|
+
|
|
1855
|
+
TESTS::
|
|
1856
|
+
|
|
1857
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
1858
|
+
sage: f = a + b + a*b + T.O(5)
|
|
1859
|
+
sage: f.shift(3)
|
|
1860
|
+
Traceback (most recent call last):
|
|
1861
|
+
...
|
|
1862
|
+
NotImplementedError: shift not defined for multivariate power series.
|
|
1863
|
+
"""
|
|
1864
|
+
raise NotImplementedError("shift not defined for multivariate power series.")
|
|
1865
|
+
|
|
1866
|
+
def __lshift__(self, n):
|
|
1867
|
+
"""
|
|
1868
|
+
Doesn't make sense for multivariate power series.
|
|
1869
|
+
|
|
1870
|
+
TESTS::
|
|
1871
|
+
|
|
1872
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
1873
|
+
sage: f = a + b + a*b + T.O(5)
|
|
1874
|
+
sage: f.__lshift__(3)
|
|
1875
|
+
Traceback (most recent call last):
|
|
1876
|
+
...
|
|
1877
|
+
NotImplementedError: __lshift__ not defined for multivariate power series.
|
|
1878
|
+
"""
|
|
1879
|
+
raise NotImplementedError("__lshift__ not defined for multivariate power series.")
|
|
1880
|
+
|
|
1881
|
+
def __rshift__(self, n):
|
|
1882
|
+
"""
|
|
1883
|
+
Doesn't make sense for multivariate power series.
|
|
1884
|
+
|
|
1885
|
+
TESTS::
|
|
1886
|
+
|
|
1887
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
1888
|
+
sage: f = a + b + a*b + T.O(5)
|
|
1889
|
+
sage: f.__rshift__(3)
|
|
1890
|
+
Traceback (most recent call last):
|
|
1891
|
+
...
|
|
1892
|
+
NotImplementedError: __rshift__ not defined for multivariate power series.
|
|
1893
|
+
"""
|
|
1894
|
+
raise NotImplementedError("__rshift__ not defined for multivariate power series.")
|
|
1895
|
+
|
|
1896
|
+
def valuation_zero_part(self):
|
|
1897
|
+
"""
|
|
1898
|
+
Doesn't make sense for multivariate power series;
|
|
1899
|
+
valuation zero with respect to which variable?
|
|
1900
|
+
|
|
1901
|
+
TESTS::
|
|
1902
|
+
|
|
1903
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
1904
|
+
sage: f = a + b + a*b + T.O(5)
|
|
1905
|
+
sage: f.valuation_zero_part()
|
|
1906
|
+
Traceback (most recent call last):
|
|
1907
|
+
...
|
|
1908
|
+
NotImplementedError: valuation_zero_part not defined for multivariate
|
|
1909
|
+
power series; perhaps 'constant_coefficient' is what you want.
|
|
1910
|
+
"""
|
|
1911
|
+
raise NotImplementedError("valuation_zero_part not defined for multivariate power series; perhaps 'constant_coefficient' is what you want.")
|
|
1912
|
+
|
|
1913
|
+
def solve_linear_de(self, prec=infinity, b=None, f0=None):
|
|
1914
|
+
"""
|
|
1915
|
+
Not implemented for multivariate power series.
|
|
1916
|
+
|
|
1917
|
+
TESTS::
|
|
1918
|
+
|
|
1919
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
1920
|
+
sage: f = a + b + a*b + T.O(5)
|
|
1921
|
+
sage: f.solve_linear_de()
|
|
1922
|
+
Traceback (most recent call last):
|
|
1923
|
+
...
|
|
1924
|
+
NotImplementedError: solve_linear_de not defined for multivariate power series.
|
|
1925
|
+
"""
|
|
1926
|
+
raise NotImplementedError("solve_linear_de not defined for multivariate power series.")
|
|
1927
|
+
|
|
1928
|
+
def exp(self, prec=infinity):
|
|
1929
|
+
r"""
|
|
1930
|
+
Exponentiate the formal power series.
|
|
1931
|
+
|
|
1932
|
+
INPUT:
|
|
1933
|
+
|
|
1934
|
+
- ``prec`` -- integer or ``infinity``; the degree to truncate
|
|
1935
|
+
the result to
|
|
1936
|
+
|
|
1937
|
+
OUTPUT:
|
|
1938
|
+
|
|
1939
|
+
The exponentiated multivariate power series as a new
|
|
1940
|
+
multivariate power series.
|
|
1941
|
+
|
|
1942
|
+
EXAMPLES::
|
|
1943
|
+
|
|
1944
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
1945
|
+
sage: f = a + b + a*b + T.O(3)
|
|
1946
|
+
sage: exp(f)
|
|
1947
|
+
1 + a + b + 1/2*a^2 + 2*a*b + 1/2*b^2 + O(a, b)^3
|
|
1948
|
+
sage: f.exp()
|
|
1949
|
+
1 + a + b + 1/2*a^2 + 2*a*b + 1/2*b^2 + O(a, b)^3
|
|
1950
|
+
sage: f.exp(prec=2)
|
|
1951
|
+
1 + a + b + O(a, b)^2
|
|
1952
|
+
sage: log(exp(f)) - f
|
|
1953
|
+
0 + O(a, b)^3
|
|
1954
|
+
|
|
1955
|
+
If the power series has a constant coefficient `c` and
|
|
1956
|
+
`\exp(c)` is transcendental, then `\exp(f)` would have to be a
|
|
1957
|
+
power series over the :class:`~sage.symbolic.ring.SymbolicRing`. These
|
|
1958
|
+
are not yet implemented and therefore such cases raise an error::
|
|
1959
|
+
|
|
1960
|
+
sage: g = 2 + f
|
|
1961
|
+
sage: exp(g) # needs sage.symbolic
|
|
1962
|
+
Traceback (most recent call last):
|
|
1963
|
+
...
|
|
1964
|
+
TypeError: unsupported operand parent(s) for *: 'Symbolic Ring' and
|
|
1965
|
+
'Power Series Ring in Tbg over Multivariate Polynomial Ring in a, b
|
|
1966
|
+
over Rational Field'
|
|
1967
|
+
|
|
1968
|
+
Another workaround for this limitation is to change base ring
|
|
1969
|
+
to one which is closed under exponentiation, such as `\RR` or `\CC`::
|
|
1970
|
+
|
|
1971
|
+
sage: exp(g.change_ring(RDF)) # needs sage.symbolic
|
|
1972
|
+
7.38905609... + 7.38905609...*a + 7.38905609...*b + 3.69452804...*a^2 +
|
|
1973
|
+
14.7781121...*a*b + 3.69452804...*b^2 + O(a, b)^3
|
|
1974
|
+
|
|
1975
|
+
If no precision is specified, the default precision is used::
|
|
1976
|
+
|
|
1977
|
+
sage: T.default_prec()
|
|
1978
|
+
12
|
|
1979
|
+
sage: exp(a)
|
|
1980
|
+
1 + a + 1/2*a^2 + 1/6*a^3 + 1/24*a^4 + 1/120*a^5 + 1/720*a^6 + 1/5040*a^7 +
|
|
1981
|
+
1/40320*a^8 + 1/362880*a^9 + 1/3628800*a^10 + 1/39916800*a^11 + O(a, b)^12
|
|
1982
|
+
sage: a.exp(prec=5)
|
|
1983
|
+
1 + a + 1/2*a^2 + 1/6*a^3 + 1/24*a^4 + O(a, b)^5
|
|
1984
|
+
sage: exp(a + T.O(5))
|
|
1985
|
+
1 + a + 1/2*a^2 + 1/6*a^3 + 1/24*a^4 + O(a, b)^5
|
|
1986
|
+
|
|
1987
|
+
TESTS::
|
|
1988
|
+
|
|
1989
|
+
sage: exp(a^2 + T.O(5))
|
|
1990
|
+
1 + a^2 + 1/2*a^4 + O(a, b)^5
|
|
1991
|
+
"""
|
|
1992
|
+
R = self.parent()
|
|
1993
|
+
Rbg = R._bg_power_series_ring
|
|
1994
|
+
|
|
1995
|
+
c = self.constant_coefficient()
|
|
1996
|
+
if not c:
|
|
1997
|
+
exp_c = self.base_ring().one()
|
|
1998
|
+
else:
|
|
1999
|
+
from sage.functions.log import exp
|
|
2000
|
+
exp_c = exp(c)
|
|
2001
|
+
x = self._bg_value - c
|
|
2002
|
+
if x.is_zero():
|
|
2003
|
+
return exp_c
|
|
2004
|
+
val = x.valuation()
|
|
2005
|
+
assert (val >= 1)
|
|
2006
|
+
|
|
2007
|
+
prec = min(prec, self.prec())
|
|
2008
|
+
if isinstance(prec, InfinityElement):
|
|
2009
|
+
prec = R.default_prec()
|
|
2010
|
+
n_inv_factorial = R.base_ring().one()
|
|
2011
|
+
x_pow_n = Rbg.one()
|
|
2012
|
+
exp_x = Rbg.one().add_bigoh(prec)
|
|
2013
|
+
for n in range(1,prec//val+1):
|
|
2014
|
+
x_pow_n = (x_pow_n * x).add_bigoh(prec)
|
|
2015
|
+
n_inv_factorial /= n
|
|
2016
|
+
exp_x += x_pow_n * n_inv_factorial
|
|
2017
|
+
result_bg = exp_c*exp_x
|
|
2018
|
+
|
|
2019
|
+
if result_bg.base_ring() is not self.base_ring():
|
|
2020
|
+
R = R.change_ring(self.base_ring().fraction_field())
|
|
2021
|
+
return R(result_bg, prec=prec)
|
|
2022
|
+
|
|
2023
|
+
def log(self, prec=infinity):
|
|
2024
|
+
r"""
|
|
2025
|
+
Return the logarithm of the formal power series.
|
|
2026
|
+
|
|
2027
|
+
INPUT:
|
|
2028
|
+
|
|
2029
|
+
- ``prec`` -- integer or ``infinity``; the degree to truncate
|
|
2030
|
+
the result to
|
|
2031
|
+
|
|
2032
|
+
OUTPUT:
|
|
2033
|
+
|
|
2034
|
+
The logarithm of the multivariate power series as a new
|
|
2035
|
+
multivariate power series.
|
|
2036
|
+
|
|
2037
|
+
EXAMPLES::
|
|
2038
|
+
|
|
2039
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ, 2)
|
|
2040
|
+
sage: f = 1 + a + b + a*b + T.O(5)
|
|
2041
|
+
sage: f.log()
|
|
2042
|
+
a + b - 1/2*a^2 - 1/2*b^2 + 1/3*a^3 + 1/3*b^3 - 1/4*a^4 - 1/4*b^4 + O(a, b)^5
|
|
2043
|
+
sage: log(f)
|
|
2044
|
+
a + b - 1/2*a^2 - 1/2*b^2 + 1/3*a^3 + 1/3*b^3 - 1/4*a^4 - 1/4*b^4 + O(a, b)^5
|
|
2045
|
+
sage: exp(log(f)) - f
|
|
2046
|
+
0 + O(a, b)^5
|
|
2047
|
+
|
|
2048
|
+
If the power series has a constant coefficient `c` and
|
|
2049
|
+
`\exp(c)` is transcendental, then `\exp(f)` would have to be a
|
|
2050
|
+
power series over the :class:`~sage.symbolic.ring.SymbolicRing`. These
|
|
2051
|
+
are not yet implemented and therefore such cases raise an error::
|
|
2052
|
+
|
|
2053
|
+
sage: g = 2 + f
|
|
2054
|
+
sage: log(g) # needs sage.symbolic
|
|
2055
|
+
Traceback (most recent call last):
|
|
2056
|
+
...
|
|
2057
|
+
TypeError: unsupported operand parent(s) for -: 'Symbolic Ring' and 'Power
|
|
2058
|
+
Series Ring in Tbg over Multivariate Polynomial Ring in a, b over Rational Field'
|
|
2059
|
+
|
|
2060
|
+
Another workaround for this limitation is to change base ring
|
|
2061
|
+
to one which is closed under exponentiation, such as `\RR` or `\CC`::
|
|
2062
|
+
|
|
2063
|
+
sage: log(g.change_ring(RDF)) # needs sage.symbolic
|
|
2064
|
+
1.09861228... + 0.333333333...*a + 0.333333333...*b - 0.0555555555...*a^2
|
|
2065
|
+
+ 0.222222222...*a*b - 0.0555555555...*b^2 + 0.0123456790...*a^3
|
|
2066
|
+
- 0.0740740740...*a^2*b - 0.0740740740...*a*b^2 + 0.0123456790...*b^3
|
|
2067
|
+
- 0.00308641975...*a^4 + 0.0246913580...*a^3*b + 0.0246913580...*a*b^3
|
|
2068
|
+
- 0.00308641975...*b^4 + O(a, b)^5
|
|
2069
|
+
|
|
2070
|
+
TESTS::
|
|
2071
|
+
|
|
2072
|
+
sage: (1+a).log(prec=10).exp()
|
|
2073
|
+
1 + a + O(a, b)^10
|
|
2074
|
+
sage: a.exp(prec=10).log()
|
|
2075
|
+
a + O(a, b)^10
|
|
2076
|
+
|
|
2077
|
+
sage: log(1+a)
|
|
2078
|
+
a - 1/2*a^2 + 1/3*a^3 - 1/4*a^4 + 1/5*a^5 - 1/6*a^6 + 1/7*a^7
|
|
2079
|
+
- 1/8*a^8 + 1/9*a^9 - 1/10*a^10 + 1/11*a^11 + O(a, b)^12
|
|
2080
|
+
sage: -log(1-a+T.O(5))
|
|
2081
|
+
a + 1/2*a^2 + 1/3*a^3 + 1/4*a^4 + O(a, b)^5
|
|
2082
|
+
sage: a.log(prec=10)
|
|
2083
|
+
Traceback (most recent call last):
|
|
2084
|
+
...
|
|
2085
|
+
ValueError: Can only take formal power series for nonzero constant term.
|
|
2086
|
+
"""
|
|
2087
|
+
R = self.parent()
|
|
2088
|
+
Rbg = R._bg_power_series_ring
|
|
2089
|
+
|
|
2090
|
+
c = self.constant_coefficient()
|
|
2091
|
+
if c.is_zero():
|
|
2092
|
+
raise ValueError('Can only take formal power series for nonzero constant term.')
|
|
2093
|
+
if c.is_one():
|
|
2094
|
+
log_c = self.base_ring().zero()
|
|
2095
|
+
else:
|
|
2096
|
+
from sage.functions.log import log
|
|
2097
|
+
log_c = log(c)
|
|
2098
|
+
x = 1 - self._bg_value/c
|
|
2099
|
+
if x.is_zero():
|
|
2100
|
+
return log_c
|
|
2101
|
+
val = x.valuation()
|
|
2102
|
+
assert (val >= 1)
|
|
2103
|
+
|
|
2104
|
+
prec = min(prec, self.prec())
|
|
2105
|
+
if isinstance(prec, InfinityElement):
|
|
2106
|
+
prec = R.default_prec()
|
|
2107
|
+
x_pow_n = Rbg.one()
|
|
2108
|
+
log_x = Rbg.zero().add_bigoh(prec)
|
|
2109
|
+
for n in range(1,prec//val+1):
|
|
2110
|
+
x_pow_n = (x_pow_n * x).add_bigoh(prec)
|
|
2111
|
+
log_x += x_pow_n / n
|
|
2112
|
+
result_bg = log_c - log_x
|
|
2113
|
+
|
|
2114
|
+
if result_bg.base_ring() is not self.base_ring():
|
|
2115
|
+
R = R.change_ring(self.base_ring().fraction_field())
|
|
2116
|
+
return R(result_bg, prec=prec)
|
|
2117
|
+
|
|
2118
|
+
def laurent_series(self):
|
|
2119
|
+
"""
|
|
2120
|
+
Not implemented for multivariate power series.
|
|
2121
|
+
|
|
2122
|
+
TESTS::
|
|
2123
|
+
|
|
2124
|
+
sage: T.<a,b> = PowerSeriesRing(ZZ,2)
|
|
2125
|
+
sage: f = a + b + a*b + T.O(5)
|
|
2126
|
+
sage: f.laurent_series()
|
|
2127
|
+
Traceback (most recent call last):
|
|
2128
|
+
...
|
|
2129
|
+
NotImplementedError: laurent_series not defined for multivariate power series.
|
|
2130
|
+
"""
|
|
2131
|
+
raise NotImplementedError("laurent_series not defined for multivariate power series.")
|
|
2132
|
+
|
|
2133
|
+
|
|
2134
|
+
class MO:
|
|
2135
|
+
"""
|
|
2136
|
+
Object representing a zero element with given precision.
|
|
2137
|
+
|
|
2138
|
+
EXAMPLES::
|
|
2139
|
+
|
|
2140
|
+
sage: R.<u,v> = QQ[[]]
|
|
2141
|
+
sage: m = O(u, v)
|
|
2142
|
+
sage: m^4
|
|
2143
|
+
0 + O(u, v)^4
|
|
2144
|
+
sage: m^1
|
|
2145
|
+
0 + O(u, v)^1
|
|
2146
|
+
|
|
2147
|
+
sage: T.<a,b,c> = PowerSeriesRing(ZZ, 3)
|
|
2148
|
+
sage: z = O(a, b, c)
|
|
2149
|
+
sage: z^1
|
|
2150
|
+
0 + O(a, b, c)^1
|
|
2151
|
+
sage: 1 + a + z^1
|
|
2152
|
+
1 + O(a, b, c)^1
|
|
2153
|
+
|
|
2154
|
+
sage: w = 1 + a + O(a, b, c)^2; w
|
|
2155
|
+
1 + a + O(a, b, c)^2
|
|
2156
|
+
sage: w^2
|
|
2157
|
+
1 + 2*a + O(a, b, c)^2
|
|
2158
|
+
"""
|
|
2159
|
+
def __init__(self, x):
|
|
2160
|
+
"""
|
|
2161
|
+
Initialize ``self``.
|
|
2162
|
+
|
|
2163
|
+
EXAMPLES::
|
|
2164
|
+
|
|
2165
|
+
sage: R.<u,v> = QQ[[]]
|
|
2166
|
+
sage: m = O(u, v)
|
|
2167
|
+
"""
|
|
2168
|
+
self._vars = x
|
|
2169
|
+
|
|
2170
|
+
def __pow__(self, prec):
|
|
2171
|
+
"""
|
|
2172
|
+
Raise ``self`` to the given precision ``prec``.
|
|
2173
|
+
|
|
2174
|
+
EXAMPLES::
|
|
2175
|
+
|
|
2176
|
+
sage: R.<u,v> = QQ[[]]
|
|
2177
|
+
sage: m = O(u, v)
|
|
2178
|
+
sage: m^4
|
|
2179
|
+
0 + O(u, v)^4
|
|
2180
|
+
"""
|
|
2181
|
+
parent = self._vars[0].parent()
|
|
2182
|
+
if self._vars != parent.gens():
|
|
2183
|
+
raise NotImplementedError
|
|
2184
|
+
return self._vars[0].parent()(0,prec)
|