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,1927 @@
|
|
|
1
|
+
# sage_setup: distribution = sagemath-categories
|
|
2
|
+
r"""
|
|
3
|
+
Laurent Series
|
|
4
|
+
|
|
5
|
+
Laurent series in Sage are represented internally as a power of the variable
|
|
6
|
+
times the power series part. If a Laurent series `f` is represented as
|
|
7
|
+
`f = t^n \cdot u` where `t` is the variable and `u` has nonzero constant term,
|
|
8
|
+
`u` can be accessed through :meth:`~LaurentSeries.valuation_zero_part` and `n`
|
|
9
|
+
can be accessed through :meth:`~LaurentSeries.valuation`.
|
|
10
|
+
|
|
11
|
+
EXAMPLES::
|
|
12
|
+
|
|
13
|
+
sage: R.<t> = LaurentSeriesRing(GF(7), 't'); R
|
|
14
|
+
Laurent Series Ring in t over Finite Field of size 7
|
|
15
|
+
sage: f = 1/(1-t+O(t^10)); f
|
|
16
|
+
1 + t + t^2 + t^3 + t^4 + t^5 + t^6 + t^7 + t^8 + t^9 + O(t^10)
|
|
17
|
+
|
|
18
|
+
Laurent series are immutable::
|
|
19
|
+
|
|
20
|
+
sage: f[2]
|
|
21
|
+
1
|
|
22
|
+
sage: f[2] = 5
|
|
23
|
+
Traceback (most recent call last):
|
|
24
|
+
...
|
|
25
|
+
IndexError: Laurent series are immutable
|
|
26
|
+
|
|
27
|
+
We compute with a Laurent series over the complex mpfr numbers.
|
|
28
|
+
|
|
29
|
+
::
|
|
30
|
+
|
|
31
|
+
sage: K.<q> = Frac(CC[['q']]); K # needs sage.rings.real_mpfr
|
|
32
|
+
Laurent Series Ring in q over Complex Field with 53 bits of precision
|
|
33
|
+
sage: q # needs sage.rings.real_mpfr
|
|
34
|
+
1.00000000000000*q
|
|
35
|
+
|
|
36
|
+
Saving and loading.
|
|
37
|
+
|
|
38
|
+
::
|
|
39
|
+
|
|
40
|
+
sage: loads(q.dumps()) == q # needs sage.rings.real_mpfr
|
|
41
|
+
True
|
|
42
|
+
sage: loads(K.dumps()) == K # needs sage.rings.real_mpfr
|
|
43
|
+
True
|
|
44
|
+
|
|
45
|
+
AUTHORS:
|
|
46
|
+
|
|
47
|
+
- William Stein: original version
|
|
48
|
+
|
|
49
|
+
- David Joyner (2006-01-22): added examples
|
|
50
|
+
|
|
51
|
+
- Robert Bradshaw (2007-04): optimizations, shifting
|
|
52
|
+
|
|
53
|
+
- Robert Bradshaw: Cython version
|
|
54
|
+
"""
|
|
55
|
+
# ****************************************************************************
|
|
56
|
+
# Copyright (C) 2005 William Stein <wstein@gmail.com>
|
|
57
|
+
# 2017 Vincent Delecroix <20100.delecroix@gmail.com>
|
|
58
|
+
#
|
|
59
|
+
# Distributed under the terms of the GNU General Public License (GPL)
|
|
60
|
+
#
|
|
61
|
+
# This code is distributed in the hope that it will be useful,
|
|
62
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
63
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
64
|
+
# General Public License for more details.
|
|
65
|
+
#
|
|
66
|
+
# The full text of the GPL is available at:
|
|
67
|
+
#
|
|
68
|
+
# https://www.gnu.org/licenses/
|
|
69
|
+
# ****************************************************************************
|
|
70
|
+
|
|
71
|
+
from sage.rings.infinity import infinity
|
|
72
|
+
|
|
73
|
+
from sage.rings.rational_field import QQ
|
|
74
|
+
import sage.misc.latex
|
|
75
|
+
from sage.rings.polynomial.laurent_polynomial import LaurentPolynomial_univariate
|
|
76
|
+
from sage.rings.power_series_ring_element cimport PowerSeries
|
|
77
|
+
from sage.structure.element cimport Element, AlgebraElement
|
|
78
|
+
from sage.structure.richcmp cimport richcmp_not_equal, rich_to_bool
|
|
79
|
+
from sage.misc.derivative import multi_derivative
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def is_LaurentSeries(x):
|
|
83
|
+
from sage.misc.superseded import deprecation_cython
|
|
84
|
+
deprecation_cython(38266,
|
|
85
|
+
"The function is_LaurentSeries is deprecated; "
|
|
86
|
+
"use 'isinstance(..., LaurentSeries)' instead.")
|
|
87
|
+
return isinstance(x, LaurentSeries)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
cdef class LaurentSeries(AlgebraElement):
|
|
91
|
+
r"""
|
|
92
|
+
A Laurent Series.
|
|
93
|
+
|
|
94
|
+
We consider a Laurent series of the form `f = t^n \cdot u` where `u` is a
|
|
95
|
+
power series with nonzero constant term.
|
|
96
|
+
|
|
97
|
+
INPUT:
|
|
98
|
+
|
|
99
|
+
- ``parent`` -- a Laurent series ring
|
|
100
|
+
|
|
101
|
+
- ``f`` -- a power series (or something can be coerced
|
|
102
|
+
to one); note that ``f`` does *not* have to be a unit
|
|
103
|
+
|
|
104
|
+
- ``n`` -- (default: 0) integer
|
|
105
|
+
"""
|
|
106
|
+
def __init__(self, parent, f, n=0):
|
|
107
|
+
r"""
|
|
108
|
+
Initialize ``self``.
|
|
109
|
+
|
|
110
|
+
OUTPUT: a Laurent series
|
|
111
|
+
|
|
112
|
+
EXAMPLES::
|
|
113
|
+
|
|
114
|
+
sage: R.<q> = LaurentSeriesRing(ZZ)
|
|
115
|
+
sage: R([1,2,3])
|
|
116
|
+
1 + 2*q + 3*q^2
|
|
117
|
+
sage: R([1,2,3], -5)
|
|
118
|
+
q^-5 + 2*q^-4 + 3*q^-3
|
|
119
|
+
|
|
120
|
+
::
|
|
121
|
+
|
|
122
|
+
sage: # needs sage.rings.finite_rings sage.rings.padics
|
|
123
|
+
sage: S.<s> = LaurentSeriesRing(GF(5))
|
|
124
|
+
sage: T.<t> = PowerSeriesRing(pAdicRing(5))
|
|
125
|
+
sage: S(t)
|
|
126
|
+
s
|
|
127
|
+
sage: parent(S(t))
|
|
128
|
+
Laurent Series Ring in s over Finite Field of size 5
|
|
129
|
+
sage: parent(S(t)[1])
|
|
130
|
+
Finite Field of size 5
|
|
131
|
+
"""
|
|
132
|
+
AlgebraElement.__init__(self, parent)
|
|
133
|
+
|
|
134
|
+
if isinstance(f, LaurentSeries):
|
|
135
|
+
n += (<LaurentSeries>f).__n
|
|
136
|
+
if (<LaurentSeries>f).__u._parent is parent._power_series_ring:
|
|
137
|
+
f = (<LaurentSeries>f).__u
|
|
138
|
+
else:
|
|
139
|
+
f = parent._power_series_ring((<LaurentSeries>f).__u)
|
|
140
|
+
elif isinstance(f, LaurentPolynomial_univariate):
|
|
141
|
+
f = f(parent.gen())
|
|
142
|
+
elif isinstance(f, dict):
|
|
143
|
+
## Sanitize input to make sure all exponents are nonnegative,
|
|
144
|
+
## adjusting n to match.
|
|
145
|
+
n1 = min(f.keys())
|
|
146
|
+
if n1 < 0:
|
|
147
|
+
f = {e - n1: c for e, c in f.items()}
|
|
148
|
+
n += n1
|
|
149
|
+
f = parent._power_series_ring(f)
|
|
150
|
+
elif not isinstance(f, PowerSeries):
|
|
151
|
+
f = parent._power_series_ring(f)
|
|
152
|
+
## now this is a power series, over a different ring ...
|
|
153
|
+
## requires that power series rings with same vars over the
|
|
154
|
+
## same parent are unique.
|
|
155
|
+
elif parent is not f.parent():
|
|
156
|
+
f = parent._power_series_ring(f)
|
|
157
|
+
|
|
158
|
+
# self is that t^n * u:
|
|
159
|
+
if not f:
|
|
160
|
+
if n is infinity:
|
|
161
|
+
self.__n = 0
|
|
162
|
+
self.__u = parent._power_series_ring.zero()
|
|
163
|
+
else:
|
|
164
|
+
self.__n = n
|
|
165
|
+
self.__u = parent._power_series_ring(f)
|
|
166
|
+
else:
|
|
167
|
+
val = f.valuation()
|
|
168
|
+
if val is infinity:
|
|
169
|
+
self.__n = 0
|
|
170
|
+
self.__u = parent._power_series_ring(f)
|
|
171
|
+
elif val == 0:
|
|
172
|
+
self.__n = n # power of the variable
|
|
173
|
+
self.__u = parent._power_series_ring(f) # unit part
|
|
174
|
+
else:
|
|
175
|
+
self.__n = n + val
|
|
176
|
+
self.__u = parent._power_series_ring(f >> val)
|
|
177
|
+
|
|
178
|
+
def __reduce__(self):
|
|
179
|
+
return self._parent, (self.__u, self.__n)
|
|
180
|
+
|
|
181
|
+
def change_ring(self, R):
|
|
182
|
+
"""
|
|
183
|
+
Change the base ring of ``self``.
|
|
184
|
+
|
|
185
|
+
EXAMPLES::
|
|
186
|
+
|
|
187
|
+
sage: R.<q> = LaurentSeriesRing(ZZ)
|
|
188
|
+
sage: p = R([1,2,3]); p
|
|
189
|
+
1 + 2*q + 3*q^2
|
|
190
|
+
sage: p.change_ring(GF(2))
|
|
191
|
+
1 + q^2
|
|
192
|
+
"""
|
|
193
|
+
return self._parent.change_ring(R)(self)
|
|
194
|
+
|
|
195
|
+
def is_unit(self):
|
|
196
|
+
"""
|
|
197
|
+
Return ``True`` if this is Laurent series is a unit in this ring.
|
|
198
|
+
|
|
199
|
+
EXAMPLES::
|
|
200
|
+
|
|
201
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
202
|
+
sage: (2 + t).is_unit()
|
|
203
|
+
True
|
|
204
|
+
sage: f = 2 + t^2 + O(t^10); f.is_unit()
|
|
205
|
+
True
|
|
206
|
+
sage: 1/f
|
|
207
|
+
1/2 - 1/4*t^2 + 1/8*t^4 - 1/16*t^6 + 1/32*t^8 + O(t^10)
|
|
208
|
+
sage: R(0).is_unit()
|
|
209
|
+
False
|
|
210
|
+
sage: R.<s> = LaurentSeriesRing(ZZ)
|
|
211
|
+
sage: f = 2 + s^2 + O(s^10)
|
|
212
|
+
sage: f.is_unit()
|
|
213
|
+
False
|
|
214
|
+
sage: 1/f
|
|
215
|
+
Traceback (most recent call last):
|
|
216
|
+
...
|
|
217
|
+
ValueError: constant term 2 is not a unit
|
|
218
|
+
|
|
219
|
+
ALGORITHM: A Laurent series is a unit if and only if its "unit
|
|
220
|
+
part" is a unit.
|
|
221
|
+
"""
|
|
222
|
+
return self.__u.is_unit()
|
|
223
|
+
|
|
224
|
+
def is_zero(self):
|
|
225
|
+
"""
|
|
226
|
+
EXAMPLES::
|
|
227
|
+
|
|
228
|
+
sage: x = Frac(QQ[['x']]).0
|
|
229
|
+
sage: f = 1/x + x + x^2 + 3*x^4 + O(x^7)
|
|
230
|
+
sage: f.is_zero()
|
|
231
|
+
0
|
|
232
|
+
sage: z = 0*f
|
|
233
|
+
sage: z.is_zero()
|
|
234
|
+
1
|
|
235
|
+
"""
|
|
236
|
+
return self.__u.is_zero()
|
|
237
|
+
|
|
238
|
+
def is_monomial(self):
|
|
239
|
+
"""
|
|
240
|
+
Return ``True`` if this element is a monomial. That is, if ``self`` is
|
|
241
|
+
`x^n` for some integer `n`.
|
|
242
|
+
|
|
243
|
+
EXAMPLES::
|
|
244
|
+
|
|
245
|
+
sage: k.<z> = LaurentSeriesRing(QQ, 'z')
|
|
246
|
+
sage: (30*z).is_monomial()
|
|
247
|
+
False
|
|
248
|
+
sage: k(1).is_monomial()
|
|
249
|
+
True
|
|
250
|
+
sage: (z+1).is_monomial()
|
|
251
|
+
False
|
|
252
|
+
sage: (z^-2909).is_monomial()
|
|
253
|
+
True
|
|
254
|
+
sage: (3*z^-2909).is_monomial()
|
|
255
|
+
False
|
|
256
|
+
"""
|
|
257
|
+
return self.__u.is_monomial()
|
|
258
|
+
|
|
259
|
+
def __bool__(self):
|
|
260
|
+
"""
|
|
261
|
+
EXAMPLES::
|
|
262
|
+
|
|
263
|
+
sage: R.<t> = LaurentSeriesRing(ZZ)
|
|
264
|
+
sage: bool(t)
|
|
265
|
+
True
|
|
266
|
+
sage: bool(1/t)
|
|
267
|
+
True
|
|
268
|
+
sage: bool(2 + t)
|
|
269
|
+
True
|
|
270
|
+
sage: bool(1/(1-t))
|
|
271
|
+
True
|
|
272
|
+
sage: bool(1 + O(t^3))
|
|
273
|
+
True
|
|
274
|
+
sage: bool(t + O(t^3))
|
|
275
|
+
True
|
|
276
|
+
sage: bool(O(t^3))
|
|
277
|
+
False
|
|
278
|
+
sage: bool(O(t^-3))
|
|
279
|
+
False
|
|
280
|
+
sage: bool(R.zero())
|
|
281
|
+
False
|
|
282
|
+
"""
|
|
283
|
+
return bool(self.__u)
|
|
284
|
+
|
|
285
|
+
def _im_gens_(self, codomain, im_gens, base_map=None):
|
|
286
|
+
"""
|
|
287
|
+
Return the image of this series under the map that sends the generators of
|
|
288
|
+
the parent to ``im_gens``.
|
|
289
|
+
|
|
290
|
+
EXAMPLES::
|
|
291
|
+
|
|
292
|
+
sage: # needs sage.rings.number_field
|
|
293
|
+
sage: Zx.<x> = ZZ[]
|
|
294
|
+
sage: K.<i> = NumberField(x^2 + 1)
|
|
295
|
+
sage: R.<t> = LaurentSeriesRing(K)
|
|
296
|
+
sage: z = t^-1 + i*t
|
|
297
|
+
sage: z._im_gens_(R, [t^2])
|
|
298
|
+
t^-2 + i*t^2
|
|
299
|
+
|
|
300
|
+
The argument ``base_map`` is not yet supported, because it isn't over power series::
|
|
301
|
+
|
|
302
|
+
sage: cc = K.hom([i]) # needs sage.rings.number_field
|
|
303
|
+
sage: z._im_gens_(R, [t^2], base_map=cc) # needs sage.rings.number_field
|
|
304
|
+
Traceback (most recent call last):
|
|
305
|
+
...
|
|
306
|
+
NotImplementedError
|
|
307
|
+
"""
|
|
308
|
+
x = im_gens[0]
|
|
309
|
+
return codomain(self.__u._im_gens_(codomain, im_gens, base_map=base_map) * x**self.__n)
|
|
310
|
+
|
|
311
|
+
cdef _normalize(self):
|
|
312
|
+
r"""
|
|
313
|
+
A Laurent series is a pair (u(t), n), where either u=0 (to some
|
|
314
|
+
precision) or u is a unit. This pair corresponds to
|
|
315
|
+
`t^n\cdot u(t)`.
|
|
316
|
+
"""
|
|
317
|
+
if self.is_zero():
|
|
318
|
+
return
|
|
319
|
+
v = self.__u.valuation()
|
|
320
|
+
if v == 0:
|
|
321
|
+
return
|
|
322
|
+
self.__n += v
|
|
323
|
+
self.__u = self.__u.valuation_zero_part()
|
|
324
|
+
|
|
325
|
+
def _repr_(self):
|
|
326
|
+
"""
|
|
327
|
+
EXAMPLES::
|
|
328
|
+
|
|
329
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
330
|
+
sage: (2 + (2/3)*t^3).__repr__()
|
|
331
|
+
'2 + 2/3*t^3'
|
|
332
|
+
"""
|
|
333
|
+
if self.is_zero():
|
|
334
|
+
if self.prec() is infinity:
|
|
335
|
+
return "0"
|
|
336
|
+
return "O(%s^%s)" % (self._parent.variable_name(), self.prec())
|
|
337
|
+
s = " "
|
|
338
|
+
v = self.__u.list()
|
|
339
|
+
valuation = self.__n
|
|
340
|
+
m = len(v)
|
|
341
|
+
X = self._parent.variable_name()
|
|
342
|
+
atomic_repr = self._parent.base_ring()._repr_option('element_is_atomic')
|
|
343
|
+
first = True
|
|
344
|
+
for n in range(m):
|
|
345
|
+
x = v[n]
|
|
346
|
+
e = n + valuation
|
|
347
|
+
x = str(x)
|
|
348
|
+
if x != '0':
|
|
349
|
+
if not first:
|
|
350
|
+
s += " + "
|
|
351
|
+
if not atomic_repr and (x[1:].find("+") != -1 or x[1:].find("-") != -1):
|
|
352
|
+
x = "(%s)" % x
|
|
353
|
+
if e == 1:
|
|
354
|
+
var = "*%s" % X
|
|
355
|
+
elif e == 0:
|
|
356
|
+
var = ""
|
|
357
|
+
else:
|
|
358
|
+
var = "*%s^%s" % (X, e)
|
|
359
|
+
s += "%s%s" % (x, var)
|
|
360
|
+
first = False
|
|
361
|
+
s = s.replace(" + -", " - ")
|
|
362
|
+
s = s.replace(" 1*"," ")
|
|
363
|
+
s = s.replace(" -1*", " -")
|
|
364
|
+
if self.prec() == 0:
|
|
365
|
+
bigoh = "O(1)"
|
|
366
|
+
elif self.prec() == 1:
|
|
367
|
+
bigoh = "O(%s)" % self._parent.variable_name()
|
|
368
|
+
else:
|
|
369
|
+
bigoh = "O(%s^%s)" % (self._parent.variable_name(),self.prec())
|
|
370
|
+
if self.prec() != infinity:
|
|
371
|
+
if s == " ":
|
|
372
|
+
return bigoh
|
|
373
|
+
s += " + %s" % bigoh
|
|
374
|
+
return s[1:]
|
|
375
|
+
|
|
376
|
+
def verschiebung(self, n):
|
|
377
|
+
r"""
|
|
378
|
+
Return the ``n``-th Verschiebung of ``self``.
|
|
379
|
+
|
|
380
|
+
If `f = \sum a_m x^m` then this function returns `\sum a_m x^{mn}`.
|
|
381
|
+
|
|
382
|
+
EXAMPLES::
|
|
383
|
+
|
|
384
|
+
sage: R.<x> = LaurentSeriesRing(QQ)
|
|
385
|
+
sage: f = -1/x + 1 + 2*x^2 + 5*x^5
|
|
386
|
+
sage: f.V(2)
|
|
387
|
+
-x^-2 + 1 + 2*x^4 + 5*x^10
|
|
388
|
+
sage: f.V(-1)
|
|
389
|
+
5*x^-5 + 2*x^-2 + 1 - x
|
|
390
|
+
sage: h = f.add_bigoh(7)
|
|
391
|
+
sage: h.V(2)
|
|
392
|
+
-x^-2 + 1 + 2*x^4 + 5*x^10 + O(x^14)
|
|
393
|
+
sage: h.V(-2)
|
|
394
|
+
Traceback (most recent call last):
|
|
395
|
+
...
|
|
396
|
+
ValueError: For finite precision only positive arguments allowed
|
|
397
|
+
|
|
398
|
+
TESTS::
|
|
399
|
+
|
|
400
|
+
sage: R.<x> = LaurentSeriesRing(QQ)
|
|
401
|
+
sage: f = x
|
|
402
|
+
sage: f.V(3)
|
|
403
|
+
x^3
|
|
404
|
+
sage: f.V(-3)
|
|
405
|
+
x^-3
|
|
406
|
+
sage: g = 2*x^(-1) + 3 + 5*x
|
|
407
|
+
sage: g.V(-1)
|
|
408
|
+
5*x^-1 + 3 + 2*x
|
|
409
|
+
"""
|
|
410
|
+
if n == 0:
|
|
411
|
+
raise ValueError('n must be nonzero')
|
|
412
|
+
|
|
413
|
+
if n < 0:
|
|
414
|
+
if not self.prec() is infinity:
|
|
415
|
+
raise ValueError('For finite precision only positive arguments allowed')
|
|
416
|
+
|
|
417
|
+
exponents = [e * n for e in self.exponents()]
|
|
418
|
+
u = min(exponents)
|
|
419
|
+
exponents = [e - u for e in exponents]
|
|
420
|
+
coefficients = self.coefficients()
|
|
421
|
+
zero = self.base_ring().zero()
|
|
422
|
+
w = [zero] * (max(exponents) + 1)
|
|
423
|
+
for i in range(len(exponents)):
|
|
424
|
+
e = exponents[i]
|
|
425
|
+
c = coefficients[i]
|
|
426
|
+
w[e] = c
|
|
427
|
+
l = LaurentSeries(self._parent, w, u)
|
|
428
|
+
else:
|
|
429
|
+
__u = self.__u.V(n)
|
|
430
|
+
__n = <long>self.__n * n
|
|
431
|
+
l = LaurentSeries(self._parent, __u, __n)
|
|
432
|
+
return l
|
|
433
|
+
|
|
434
|
+
V = verschiebung
|
|
435
|
+
|
|
436
|
+
def _latex_(self):
|
|
437
|
+
r"""
|
|
438
|
+
EXAMPLES::
|
|
439
|
+
|
|
440
|
+
sage: x = Frac(QQ[['x']]).0
|
|
441
|
+
sage: f = (17/2)*x^-2 + x + x^2 + 3*x^4 + O(x^7)
|
|
442
|
+
sage: latex(f)
|
|
443
|
+
\frac{\frac{17}{2}}{x^{2}} + x + x^{2} + 3x^{4} + O(x^{7})
|
|
444
|
+
|
|
445
|
+
Verify that :issue:`6656` has been fixed::
|
|
446
|
+
|
|
447
|
+
sage: R.<a,b> = PolynomialRing(QQ)
|
|
448
|
+
sage: T.<x> = LaurentSeriesRing(R)
|
|
449
|
+
sage: y = a*x + b*x
|
|
450
|
+
sage: y._latex_()
|
|
451
|
+
'\\left(a + b\\right)x'
|
|
452
|
+
sage: latex(y)
|
|
453
|
+
\left(a + b\right)x
|
|
454
|
+
"""
|
|
455
|
+
if self.is_zero():
|
|
456
|
+
if self.prec() is infinity:
|
|
457
|
+
return "0"
|
|
458
|
+
else:
|
|
459
|
+
return "0 + \\cdots"
|
|
460
|
+
s = " "
|
|
461
|
+
v = self.__u.list()
|
|
462
|
+
valuation = self.__n
|
|
463
|
+
m = len(v)
|
|
464
|
+
X = self._parent.latex_variable_names()[0]
|
|
465
|
+
atomic_repr = self._parent.base_ring()._repr_option('element_is_atomic')
|
|
466
|
+
first = True
|
|
467
|
+
for n in range(m):
|
|
468
|
+
x = v[n]
|
|
469
|
+
e = n + valuation
|
|
470
|
+
x = sage.misc.latex.latex(x)
|
|
471
|
+
if x != '0':
|
|
472
|
+
if not first:
|
|
473
|
+
s += " + "
|
|
474
|
+
if not atomic_repr and e > 0 and (x[1:].find("+") != -1 or x[1:].find("-") != -1):
|
|
475
|
+
x = "\\left(%s\\right)" % x
|
|
476
|
+
if e == 1:
|
|
477
|
+
var = "|%s" % X
|
|
478
|
+
elif e == 0:
|
|
479
|
+
var = ""
|
|
480
|
+
elif e > 0:
|
|
481
|
+
var = "|%s^{%s}" % (X, e)
|
|
482
|
+
if e >= 0:
|
|
483
|
+
s += "%s%s" % (x, var)
|
|
484
|
+
else: # negative e
|
|
485
|
+
if e == -1:
|
|
486
|
+
s += "\\frac{%s}{%s}" % (x, X)
|
|
487
|
+
else:
|
|
488
|
+
s += "\\frac{%s}{%s^{%s}}" % (x, X, -e)
|
|
489
|
+
first = False
|
|
490
|
+
s = s.replace(" + -", " - ")
|
|
491
|
+
s = s.replace(" 1|"," ")
|
|
492
|
+
s = s.replace(" -1|", " -")
|
|
493
|
+
s = s.replace("|","")
|
|
494
|
+
pr = self.prec()
|
|
495
|
+
if pr != infinity:
|
|
496
|
+
if pr == 0:
|
|
497
|
+
bigoh = "O(1)"
|
|
498
|
+
elif pr == 1:
|
|
499
|
+
bigoh = "O(%s)" % (X,)
|
|
500
|
+
else:
|
|
501
|
+
bigoh = "O(%s^{%s})" % (X, pr)
|
|
502
|
+
if s == " ":
|
|
503
|
+
return bigoh
|
|
504
|
+
s += " + %s" % bigoh
|
|
505
|
+
return s[1:]
|
|
506
|
+
|
|
507
|
+
def __hash__(self):
|
|
508
|
+
return hash(self.__u) ^ self.__n
|
|
509
|
+
|
|
510
|
+
def __getitem__(self, i):
|
|
511
|
+
"""
|
|
512
|
+
EXAMPLES::
|
|
513
|
+
|
|
514
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
515
|
+
sage: f = -5/t^(10) + t + t^2 - 10/3*t^3; f
|
|
516
|
+
-5*t^-10 + t + t^2 - 10/3*t^3
|
|
517
|
+
sage: f[-10]
|
|
518
|
+
-5
|
|
519
|
+
sage: f[1]
|
|
520
|
+
1
|
|
521
|
+
sage: f[3]
|
|
522
|
+
-10/3
|
|
523
|
+
sage: f[-9]
|
|
524
|
+
0
|
|
525
|
+
sage: f = -5/t^(10) + 1/3 + t + t^2 - 10/3*t^3 + O(t^5); f
|
|
526
|
+
-5*t^-10 + 1/3 + t + t^2 - 10/3*t^3 + O(t^5)
|
|
527
|
+
|
|
528
|
+
Slicing can be used to truncate, keeping the same precision::
|
|
529
|
+
|
|
530
|
+
sage: f[:2]
|
|
531
|
+
-5*t^-10 + 1/3 + t + O(t^5)
|
|
532
|
+
|
|
533
|
+
Any other kind of slicing is an error, see :issue:`18940`::
|
|
534
|
+
|
|
535
|
+
sage: f[-10:2:2]
|
|
536
|
+
Traceback (most recent call last):
|
|
537
|
+
...
|
|
538
|
+
IndexError: polynomial slicing with a step is not defined
|
|
539
|
+
|
|
540
|
+
sage: f[0:]
|
|
541
|
+
Traceback (most recent call last):
|
|
542
|
+
...
|
|
543
|
+
IndexError: polynomial slicing with a start is not defined
|
|
544
|
+
"""
|
|
545
|
+
if isinstance(i, slice):
|
|
546
|
+
start, stop, step = i.start, i.stop, i.step
|
|
547
|
+
if step is not None:
|
|
548
|
+
raise IndexError("polynomial slicing with a step is not defined")
|
|
549
|
+
if start is not None:
|
|
550
|
+
raise IndexError("polynomial slicing with a start is not defined")
|
|
551
|
+
if stop > self.__u.degree() or stop is None:
|
|
552
|
+
stop = self.__u.degree()
|
|
553
|
+
f = self.__u[:stop - self.__n]
|
|
554
|
+
return type(self)(self._parent, f, self.__n)
|
|
555
|
+
|
|
556
|
+
return self.__u[i - self.__n]
|
|
557
|
+
|
|
558
|
+
def __iter__(self):
|
|
559
|
+
"""
|
|
560
|
+
Iterate through the coefficients from the first nonzero one to the
|
|
561
|
+
last nonzero one.
|
|
562
|
+
|
|
563
|
+
EXAMPLES::
|
|
564
|
+
|
|
565
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
566
|
+
sage: f = -5/t^(2) + t + t^2 - 10/3*t^3; f
|
|
567
|
+
-5*t^-2 + t + t^2 - 10/3*t^3
|
|
568
|
+
sage: for a in f: print(a)
|
|
569
|
+
-5
|
|
570
|
+
0
|
|
571
|
+
0
|
|
572
|
+
1
|
|
573
|
+
1
|
|
574
|
+
-10/3
|
|
575
|
+
"""
|
|
576
|
+
return iter(self.__u)
|
|
577
|
+
|
|
578
|
+
def list(self):
|
|
579
|
+
"""
|
|
580
|
+
EXAMPLES::
|
|
581
|
+
|
|
582
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
583
|
+
sage: f = -5/t^(2) + t + t^2 - 10/3*t^3
|
|
584
|
+
sage: f.list()
|
|
585
|
+
[-5, 0, 0, 1, 1, -10/3]
|
|
586
|
+
"""
|
|
587
|
+
return self.__u.list()
|
|
588
|
+
|
|
589
|
+
def coefficients(self):
|
|
590
|
+
"""
|
|
591
|
+
Return the nonzero coefficients of ``self``.
|
|
592
|
+
|
|
593
|
+
EXAMPLES::
|
|
594
|
+
|
|
595
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
596
|
+
sage: f = -5/t^(2) + t + t^2 - 10/3*t^3
|
|
597
|
+
sage: f.coefficients()
|
|
598
|
+
[-5, 1, 1, -10/3]
|
|
599
|
+
"""
|
|
600
|
+
zero = self._parent.base_ring().zero()
|
|
601
|
+
return [c for c in self.list() if c != zero]
|
|
602
|
+
|
|
603
|
+
def residue(self):
|
|
604
|
+
r"""
|
|
605
|
+
Return the residue of ``self``.
|
|
606
|
+
|
|
607
|
+
Consider the Laurent series
|
|
608
|
+
|
|
609
|
+
.. MATH::
|
|
610
|
+
|
|
611
|
+
f = \sum_{n \in \ZZ} a_n t^n
|
|
612
|
+
= \cdots + \frac{a_{-2}}{t^2} + \frac{a_{-1}}{t} + a_0
|
|
613
|
+
+ a_1 t + a_2 t^2 + \cdots,
|
|
614
|
+
|
|
615
|
+
then the residue of `f` is `a_{-1}`. Alternatively this is the
|
|
616
|
+
coefficient of `1/t`.
|
|
617
|
+
|
|
618
|
+
EXAMPLES::
|
|
619
|
+
|
|
620
|
+
sage: t = LaurentSeriesRing(ZZ,'t').gen()
|
|
621
|
+
sage: f = 1/t**2 + 2/t + 3 + 4*t
|
|
622
|
+
sage: f.residue()
|
|
623
|
+
2
|
|
624
|
+
sage: f = t + t**2
|
|
625
|
+
sage: f.residue()
|
|
626
|
+
0
|
|
627
|
+
sage: f.residue().parent()
|
|
628
|
+
Integer Ring
|
|
629
|
+
"""
|
|
630
|
+
return self[-1]
|
|
631
|
+
|
|
632
|
+
def exponents(self):
|
|
633
|
+
"""
|
|
634
|
+
Return the exponents appearing in ``self`` with nonzero coefficients.
|
|
635
|
+
|
|
636
|
+
EXAMPLES::
|
|
637
|
+
|
|
638
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
639
|
+
sage: f = -5/t^(2) + t + t^2 - 10/3*t^3
|
|
640
|
+
sage: f.exponents()
|
|
641
|
+
[-2, 1, 2, 3]
|
|
642
|
+
"""
|
|
643
|
+
zero = self._parent.base_ring().zero()
|
|
644
|
+
v = self.valuation()
|
|
645
|
+
return [i+v for i,val in enumerate(self.list()) if val != zero]
|
|
646
|
+
|
|
647
|
+
def laurent_polynomial(self):
|
|
648
|
+
"""
|
|
649
|
+
Return the corresponding Laurent polynomial.
|
|
650
|
+
|
|
651
|
+
EXAMPLES::
|
|
652
|
+
|
|
653
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
654
|
+
sage: f = t^-3 + t + 7*t^2 + O(t^5)
|
|
655
|
+
sage: g = f.laurent_polynomial(); g
|
|
656
|
+
t^-3 + t + 7*t^2
|
|
657
|
+
sage: g.parent()
|
|
658
|
+
Univariate Laurent Polynomial Ring in t over Rational Field
|
|
659
|
+
"""
|
|
660
|
+
R = self._parent.laurent_polynomial_ring()
|
|
661
|
+
return R(self.__u.polynomial()) * R.gen()**(self.__n)
|
|
662
|
+
|
|
663
|
+
def lift_to_precision(self, absprec=None):
|
|
664
|
+
"""
|
|
665
|
+
Return a congruent Laurent series with absolute precision at least
|
|
666
|
+
``absprec``.
|
|
667
|
+
|
|
668
|
+
INPUT:
|
|
669
|
+
|
|
670
|
+
- ``absprec`` -- integer or ``None`` (default: ``None``); the
|
|
671
|
+
absolute precision of the result. If ``None``, lifts to an exact
|
|
672
|
+
element.
|
|
673
|
+
|
|
674
|
+
EXAMPLES::
|
|
675
|
+
|
|
676
|
+
sage: # needs sage.rings.finite_rings
|
|
677
|
+
sage: A.<t> = LaurentSeriesRing(GF(5))
|
|
678
|
+
sage: x = t^(-1) + t^2 + O(t^5)
|
|
679
|
+
sage: x.lift_to_precision(10)
|
|
680
|
+
t^-1 + t^2 + O(t^10)
|
|
681
|
+
sage: x.lift_to_precision()
|
|
682
|
+
t^-1 + t^2
|
|
683
|
+
"""
|
|
684
|
+
if absprec is not None and absprec <= self.precision_absolute():
|
|
685
|
+
return self
|
|
686
|
+
|
|
687
|
+
exact = self._parent(0) if self.is_zero() else self._parent(self.list()) << self.__n
|
|
688
|
+
if absprec is None:
|
|
689
|
+
return exact
|
|
690
|
+
else:
|
|
691
|
+
return exact.add_bigoh(absprec)
|
|
692
|
+
|
|
693
|
+
def __setitem__(self, n, value):
|
|
694
|
+
"""
|
|
695
|
+
EXAMPLES::
|
|
696
|
+
|
|
697
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
698
|
+
sage: f = t^2 + t^3 + O(t^10)
|
|
699
|
+
sage: f[2] = 5
|
|
700
|
+
Traceback (most recent call last):
|
|
701
|
+
...
|
|
702
|
+
IndexError: Laurent series are immutable
|
|
703
|
+
"""
|
|
704
|
+
raise IndexError("Laurent series are immutable")
|
|
705
|
+
|
|
706
|
+
def _unsafe_mutate(self, i, value):
|
|
707
|
+
"""
|
|
708
|
+
Never use this unless you really know what you are doing.
|
|
709
|
+
|
|
710
|
+
.. WARNING::
|
|
711
|
+
|
|
712
|
+
This could easily introduce subtle bugs, since Sage assumes
|
|
713
|
+
everywhere that Laurent series are immutable. It's OK to use
|
|
714
|
+
this if you really know what you're doing.
|
|
715
|
+
|
|
716
|
+
EXAMPLES::
|
|
717
|
+
|
|
718
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
719
|
+
sage: f = t^2 + t^3 + O(t^10); f
|
|
720
|
+
t^2 + t^3 + O(t^10)
|
|
721
|
+
sage: f._unsafe_mutate(2, -3)
|
|
722
|
+
sage: f
|
|
723
|
+
-3*t^2 + t^3 + O(t^10)
|
|
724
|
+
"""
|
|
725
|
+
j = i - self.__n
|
|
726
|
+
if j >= 0:
|
|
727
|
+
self.__u._unsafe_mutate(j, value)
|
|
728
|
+
else: # off to the left
|
|
729
|
+
if value != 0:
|
|
730
|
+
self.__n = self.__n + j
|
|
731
|
+
R = self._parent.base_ring()
|
|
732
|
+
coeffs = [value] + [R(0) for _ in range(1,-j)] + self.__u.list()
|
|
733
|
+
self.__u = self.__u._parent(coeffs)
|
|
734
|
+
self._normalize()
|
|
735
|
+
|
|
736
|
+
cpdef _add_(self, right_m):
|
|
737
|
+
"""
|
|
738
|
+
Add two power series with the same parent.
|
|
739
|
+
|
|
740
|
+
EXAMPLES::
|
|
741
|
+
|
|
742
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
743
|
+
sage: t + t
|
|
744
|
+
2*t
|
|
745
|
+
sage: f = 1/t + t^2 + t^3 - 17/3 * t^4 + O(t^5)
|
|
746
|
+
sage: g = 1/(1-t + O(t^7)); g
|
|
747
|
+
1 + t + t^2 + t^3 + t^4 + t^5 + t^6 + O(t^7)
|
|
748
|
+
sage: f + g
|
|
749
|
+
t^-1 + 1 + t + 2*t^2 + 2*t^3 - 14/3*t^4 + O(t^5)
|
|
750
|
+
sage: f + 0
|
|
751
|
+
t^-1 + t^2 + t^3 - 17/3*t^4 + O(t^5)
|
|
752
|
+
sage: 0 + f
|
|
753
|
+
t^-1 + t^2 + t^3 - 17/3*t^4 + O(t^5)
|
|
754
|
+
sage: R(0) + R(0)
|
|
755
|
+
0
|
|
756
|
+
sage: (t^3 + O(t^10)) + (t^-3 +O(t^9))
|
|
757
|
+
t^-3 + t^3 + O(t^9)
|
|
758
|
+
|
|
759
|
+
ALGORITHM: Shift the unit parts to align them, then add.
|
|
760
|
+
|
|
761
|
+
TESTS:
|
|
762
|
+
|
|
763
|
+
Verify that :issue:`35860` is fixed::
|
|
764
|
+
|
|
765
|
+
sage: R.<t> = LaurentPolynomialRing(ZZ)
|
|
766
|
+
sage: sqrt(t^2) + t^-1
|
|
767
|
+
t^-1 + t
|
|
768
|
+
"""
|
|
769
|
+
cdef LaurentSeries right = <LaurentSeries>right_m
|
|
770
|
+
cdef long m
|
|
771
|
+
|
|
772
|
+
# 1. Special case when one or the other is 0.
|
|
773
|
+
if not right:
|
|
774
|
+
return self.add_bigoh(right.prec())
|
|
775
|
+
if not self:
|
|
776
|
+
return right.add_bigoh(self.prec())
|
|
777
|
+
|
|
778
|
+
# 2. Align the unit parts.
|
|
779
|
+
if self.__n < right.__n:
|
|
780
|
+
m = self.__n
|
|
781
|
+
f1 = self.__u
|
|
782
|
+
f2 = right.__u << right.__n - m
|
|
783
|
+
elif self.__n > right.__n:
|
|
784
|
+
m = right.__n
|
|
785
|
+
f1 = self.__u << self.__n - m
|
|
786
|
+
f2 = right.__u
|
|
787
|
+
else:
|
|
788
|
+
m = self.__n
|
|
789
|
+
f1 = self.__u
|
|
790
|
+
f2 = right.__u
|
|
791
|
+
# 3. Add
|
|
792
|
+
return type(self)(self._parent, f1 + f2, m)
|
|
793
|
+
|
|
794
|
+
cpdef _sub_(self, right_m):
|
|
795
|
+
"""
|
|
796
|
+
Subtract two power series with the same parent.
|
|
797
|
+
|
|
798
|
+
EXAMPLES::
|
|
799
|
+
|
|
800
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
801
|
+
sage: t - t
|
|
802
|
+
0
|
|
803
|
+
sage: t^5 + 2 * t^-5
|
|
804
|
+
2*t^-5 + t^5
|
|
805
|
+
|
|
806
|
+
ALGORITHM: Shift the unit parts to align them, then subtract.
|
|
807
|
+
"""
|
|
808
|
+
cdef LaurentSeries right = <LaurentSeries>right_m
|
|
809
|
+
cdef long m
|
|
810
|
+
|
|
811
|
+
# 1. Special case when one or the other is 0.
|
|
812
|
+
if not right:
|
|
813
|
+
return self.add_bigoh(right.prec())
|
|
814
|
+
if not self:
|
|
815
|
+
return -right.add_bigoh(self.prec())
|
|
816
|
+
|
|
817
|
+
# 2. Align the unit parts.
|
|
818
|
+
if self.__n < right.__n:
|
|
819
|
+
m = self.__n
|
|
820
|
+
f1 = self.__u
|
|
821
|
+
f2 = right.__u << right.__n - m
|
|
822
|
+
else:
|
|
823
|
+
m = right.__n
|
|
824
|
+
f1 = self.__u << self.__n - m
|
|
825
|
+
f2 = right.__u
|
|
826
|
+
# 3. Subtract
|
|
827
|
+
return type(self)(self._parent, f1 - f2, m)
|
|
828
|
+
|
|
829
|
+
def add_bigoh(self, prec):
|
|
830
|
+
"""
|
|
831
|
+
Return the truncated series at chosen precision ``prec``.
|
|
832
|
+
|
|
833
|
+
See also :meth:`O`.
|
|
834
|
+
|
|
835
|
+
INPUT:
|
|
836
|
+
|
|
837
|
+
- ``prec`` -- the precision of the series as an integer
|
|
838
|
+
|
|
839
|
+
EXAMPLES::
|
|
840
|
+
|
|
841
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
842
|
+
sage: f = t^2 + t^3 + O(t^10); f
|
|
843
|
+
t^2 + t^3 + O(t^10)
|
|
844
|
+
sage: f.add_bigoh(5)
|
|
845
|
+
t^2 + t^3 + O(t^5)
|
|
846
|
+
|
|
847
|
+
TESTS:
|
|
848
|
+
|
|
849
|
+
Check that :issue:`28239` is fixed::
|
|
850
|
+
|
|
851
|
+
sage: (t^(-2)).add_bigoh(-1)
|
|
852
|
+
t^-2 + O(t^-1)
|
|
853
|
+
sage: (t^(-2)).add_bigoh(-2)
|
|
854
|
+
O(t^-2)
|
|
855
|
+
sage: (t^(-2)).add_bigoh(-3)
|
|
856
|
+
O(t^-3)
|
|
857
|
+
"""
|
|
858
|
+
if prec is infinity or prec >= self.prec():
|
|
859
|
+
return self
|
|
860
|
+
P = self._parent
|
|
861
|
+
if not self or prec < self.__n:
|
|
862
|
+
return type(self)(P, P._power_series_ring(0, prec=0), prec)
|
|
863
|
+
u = self.__u.add_bigoh(prec - self.__n)
|
|
864
|
+
return type(self)(P, u, self.__n)
|
|
865
|
+
|
|
866
|
+
def O(self, prec):
|
|
867
|
+
r"""
|
|
868
|
+
Return the Laurent series of precision at most ``prec`` obtained by
|
|
869
|
+
adding `O(q^\text{prec})`, where `q` is the variable.
|
|
870
|
+
|
|
871
|
+
The precision of ``self`` and the integer ``prec`` can be arbitrary. The
|
|
872
|
+
resulting Laurent series will have precision equal to the minimum of
|
|
873
|
+
the precision of ``self`` and ``prec``. The term `O(q^\text{prec})` is the
|
|
874
|
+
zero series with precision ``prec``.
|
|
875
|
+
|
|
876
|
+
See also :meth:`add_bigoh`.
|
|
877
|
+
|
|
878
|
+
EXAMPLES::
|
|
879
|
+
|
|
880
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
881
|
+
sage: f = t^-5 + t^-4 + t^3 + O(t^10); f
|
|
882
|
+
t^-5 + t^-4 + t^3 + O(t^10)
|
|
883
|
+
sage: f.O(-4)
|
|
884
|
+
t^-5 + O(t^-4)
|
|
885
|
+
sage: f.O(15)
|
|
886
|
+
t^-5 + t^-4 + t^3 + O(t^10)
|
|
887
|
+
"""
|
|
888
|
+
return self.add_bigoh(prec)
|
|
889
|
+
|
|
890
|
+
def degree(self):
|
|
891
|
+
"""
|
|
892
|
+
Return the degree of a polynomial equivalent to this power series
|
|
893
|
+
modulo big oh of the precision.
|
|
894
|
+
|
|
895
|
+
EXAMPLES::
|
|
896
|
+
|
|
897
|
+
sage: x = Frac(QQ[['x']]).0
|
|
898
|
+
sage: g = x^2 - x^4 + O(x^8)
|
|
899
|
+
sage: g.degree()
|
|
900
|
+
4
|
|
901
|
+
sage: g = -10/x^5 + x^2 - x^4 + O(x^8)
|
|
902
|
+
sage: g.degree()
|
|
903
|
+
4
|
|
904
|
+
sage: (x^-2 + O(x^0)).degree()
|
|
905
|
+
-2
|
|
906
|
+
"""
|
|
907
|
+
return self.__u.degree() + self.__n
|
|
908
|
+
|
|
909
|
+
def __neg__(self):
|
|
910
|
+
"""
|
|
911
|
+
EXAMPLES::
|
|
912
|
+
|
|
913
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
914
|
+
sage: -(1+t^5)
|
|
915
|
+
-1 - t^5
|
|
916
|
+
sage: -(1/(1+t+O(t^5)))
|
|
917
|
+
-1 + t - t^2 + t^3 - t^4 + O(t^5)
|
|
918
|
+
"""
|
|
919
|
+
return type(self)(self._parent, -self.__u, self.__n)
|
|
920
|
+
|
|
921
|
+
cpdef _mul_(self, right_r):
|
|
922
|
+
"""
|
|
923
|
+
EXAMPLES::
|
|
924
|
+
|
|
925
|
+
sage: x = Frac(QQ[['x']]).0
|
|
926
|
+
sage: f = 1/x^3 + x + x^2 + 3*x^4 + O(x^7)
|
|
927
|
+
sage: g = 1 - x + x^2 - x^4 + O(x^8)
|
|
928
|
+
sage: f*g
|
|
929
|
+
x^-3 - x^-2 + x^-1 + 4*x^4 + O(x^5)
|
|
930
|
+
"""
|
|
931
|
+
cdef LaurentSeries right = <LaurentSeries>right_r
|
|
932
|
+
return type(self)(self._parent,
|
|
933
|
+
self.__u * right.__u,
|
|
934
|
+
self.__n + right.__n)
|
|
935
|
+
|
|
936
|
+
cpdef _rmul_(self, Element c):
|
|
937
|
+
return type(self)(self._parent, self.__u._rmul_(c), self.__n)
|
|
938
|
+
|
|
939
|
+
cpdef _lmul_(self, Element c):
|
|
940
|
+
return type(self)(self._parent, self.__u._lmul_(c), self.__n)
|
|
941
|
+
|
|
942
|
+
def __pow__(_self, r, dummy):
|
|
943
|
+
"""
|
|
944
|
+
EXAMPLES::
|
|
945
|
+
|
|
946
|
+
sage: x = Frac(QQ[['x']]).0
|
|
947
|
+
sage: f = x + x^2 + 3*x^4 + O(x^7)
|
|
948
|
+
sage: g = 1/x^10 - x + x^2 - x^4 + O(x^8)
|
|
949
|
+
sage: f^7
|
|
950
|
+
x^7 + 7*x^8 + 21*x^9 + 56*x^10 + 161*x^11 + 336*x^12 + O(x^13)
|
|
951
|
+
sage: g^7
|
|
952
|
+
x^-70 - 7*x^-59 + 7*x^-58 - 7*x^-56 + O(x^-52)
|
|
953
|
+
sage: g^(1/2)
|
|
954
|
+
x^-5 - 1/2*x^6 + 1/2*x^7 - 1/2*x^9 + O(x^13)
|
|
955
|
+
sage: g^(1/5)
|
|
956
|
+
x^-2 - 1/5*x^9 + 1/5*x^10 - 1/5*x^12 + O(x^16)
|
|
957
|
+
sage: g^(2/5)
|
|
958
|
+
x^-4 - 2/5*x^7 + 2/5*x^8 - 2/5*x^10 + O(x^14)
|
|
959
|
+
sage: h = x^2 + 2*x^4 + x^6
|
|
960
|
+
sage: h^(1/2)
|
|
961
|
+
x + x^3
|
|
962
|
+
"""
|
|
963
|
+
cdef LaurentSeries self = _self
|
|
964
|
+
|
|
965
|
+
try:
|
|
966
|
+
right = QQ.coerce(r)
|
|
967
|
+
except TypeError:
|
|
968
|
+
raise ValueError("exponent must be a rational number")
|
|
969
|
+
|
|
970
|
+
if right.denominator() == 1:
|
|
971
|
+
right = right.numerator()
|
|
972
|
+
return type(self)(self._parent, self.__u**right, self.__n*right)
|
|
973
|
+
|
|
974
|
+
if self.is_zero():
|
|
975
|
+
return self._parent(0).O(self.prec()*right)
|
|
976
|
+
|
|
977
|
+
d = right.denominator()
|
|
978
|
+
n = right.numerator()
|
|
979
|
+
|
|
980
|
+
val = self.valuation()
|
|
981
|
+
|
|
982
|
+
if val % d:
|
|
983
|
+
raise ValueError("power series valuation would be fractional")
|
|
984
|
+
|
|
985
|
+
u = self.valuation_zero_part().nth_root(d)
|
|
986
|
+
|
|
987
|
+
s = type(self)(self._parent, u, val // d)
|
|
988
|
+
|
|
989
|
+
return s**n
|
|
990
|
+
|
|
991
|
+
def shift(self, k):
|
|
992
|
+
r"""
|
|
993
|
+
Return this Laurent series multiplied by the power `t^n`.
|
|
994
|
+
Does not change this series.
|
|
995
|
+
|
|
996
|
+
.. NOTE::
|
|
997
|
+
|
|
998
|
+
Despite the fact that higher order terms are printed to the
|
|
999
|
+
right in a power series, right shifting decreases the
|
|
1000
|
+
powers of `t`, while left shifting increases
|
|
1001
|
+
them. This is to be consistent with polynomials, integers,
|
|
1002
|
+
etc.
|
|
1003
|
+
|
|
1004
|
+
EXAMPLES::
|
|
1005
|
+
|
|
1006
|
+
sage: R.<t> = LaurentSeriesRing(QQ['y'])
|
|
1007
|
+
sage: f = (t+t^-1)^4; f
|
|
1008
|
+
t^-4 + 4*t^-2 + 6 + 4*t^2 + t^4
|
|
1009
|
+
sage: f.shift(10)
|
|
1010
|
+
t^6 + 4*t^8 + 6*t^10 + 4*t^12 + t^14
|
|
1011
|
+
sage: f >> 10
|
|
1012
|
+
t^-14 + 4*t^-12 + 6*t^-10 + 4*t^-8 + t^-6
|
|
1013
|
+
sage: t << 4
|
|
1014
|
+
t^5
|
|
1015
|
+
sage: t + O(t^3) >> 4
|
|
1016
|
+
t^-3 + O(t^-1)
|
|
1017
|
+
|
|
1018
|
+
AUTHORS:
|
|
1019
|
+
|
|
1020
|
+
- Robert Bradshaw (2007-04-18)
|
|
1021
|
+
"""
|
|
1022
|
+
return type(self)(self._parent, self.__u, self.__n + k)
|
|
1023
|
+
|
|
1024
|
+
def __lshift__(LaurentSeries self, k):
|
|
1025
|
+
return type(self)(self._parent, self.__u, self.__n + k)
|
|
1026
|
+
|
|
1027
|
+
def __rshift__(LaurentSeries self, k):
|
|
1028
|
+
return type(self)(self._parent, self.__u, self.__n - k)
|
|
1029
|
+
|
|
1030
|
+
def truncate(self, long n):
|
|
1031
|
+
r"""
|
|
1032
|
+
Return the Laurent series of degree ` < n` which is
|
|
1033
|
+
equivalent to ``self`` modulo `x^n`.
|
|
1034
|
+
|
|
1035
|
+
EXAMPLES::
|
|
1036
|
+
|
|
1037
|
+
sage: A.<x> = LaurentSeriesRing(ZZ)
|
|
1038
|
+
sage: f = 1/(1-x)
|
|
1039
|
+
sage: f
|
|
1040
|
+
1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9 + x^10 + x^11
|
|
1041
|
+
+ x^12 + x^13 + x^14 + x^15 + x^16 + x^17 + x^18 + x^19 + O(x^20)
|
|
1042
|
+
sage: f.truncate(10)
|
|
1043
|
+
1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9
|
|
1044
|
+
"""
|
|
1045
|
+
if n <= self.__n:
|
|
1046
|
+
return self._parent.zero()
|
|
1047
|
+
else:
|
|
1048
|
+
return type(self)(self._parent, self.__u.truncate(n - self.__n), self.__n)
|
|
1049
|
+
|
|
1050
|
+
def truncate_laurentseries(self, long n):
|
|
1051
|
+
r"""
|
|
1052
|
+
Replace any terms of degree >= n by big oh.
|
|
1053
|
+
|
|
1054
|
+
EXAMPLES::
|
|
1055
|
+
|
|
1056
|
+
sage: A.<x> = LaurentSeriesRing(ZZ)
|
|
1057
|
+
sage: f = 1/(1-x)
|
|
1058
|
+
sage: f
|
|
1059
|
+
1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9 + x^10 + x^11
|
|
1060
|
+
+ x^12 + x^13 + x^14 + x^15 + x^16 + x^17 + x^18 + x^19 + O(x^20)
|
|
1061
|
+
sage: f.truncate_laurentseries(10)
|
|
1062
|
+
1 + x + x^2 + x^3 + x^4 + x^5 + x^6 + x^7 + x^8 + x^9 + O(x^10)
|
|
1063
|
+
"""
|
|
1064
|
+
if n <= self.__n:
|
|
1065
|
+
return self._parent.zero()
|
|
1066
|
+
else:
|
|
1067
|
+
return type(self)(self._parent, self.__u.truncate_powerseries(n - self.__n), self.__n)
|
|
1068
|
+
|
|
1069
|
+
def truncate_neg(self, long n):
|
|
1070
|
+
r"""
|
|
1071
|
+
Return the Laurent series equivalent to ``self`` except without any
|
|
1072
|
+
degree ``n`` terms.
|
|
1073
|
+
|
|
1074
|
+
This is equivalent to::
|
|
1075
|
+
|
|
1076
|
+
``self - self.truncate(n)``
|
|
1077
|
+
|
|
1078
|
+
EXAMPLES::
|
|
1079
|
+
|
|
1080
|
+
sage: A.<t> = LaurentSeriesRing(ZZ)
|
|
1081
|
+
sage: f = 1/(1-t)
|
|
1082
|
+
sage: f.truncate_neg(15)
|
|
1083
|
+
t^15 + t^16 + t^17 + t^18 + t^19 + O(t^20)
|
|
1084
|
+
|
|
1085
|
+
TESTS:
|
|
1086
|
+
|
|
1087
|
+
Check that :issue:`39710` is fixed::
|
|
1088
|
+
|
|
1089
|
+
sage: S.<t> = LaurentSeriesRing(QQ)
|
|
1090
|
+
sage: (t+t^2).truncate_neg(-1)
|
|
1091
|
+
t + t^2
|
|
1092
|
+
sage: (t+t^2).truncate_neg(-2)
|
|
1093
|
+
t + t^2
|
|
1094
|
+
|
|
1095
|
+
Check that :issue:`39842` is fixed::
|
|
1096
|
+
|
|
1097
|
+
sage: f = LaurentSeriesRing(QQ, "t")(LaurentPolynomialRing(QQ, "t")([1, 2, 3]))
|
|
1098
|
+
sage: f
|
|
1099
|
+
1 + 2*t + 3*t^2
|
|
1100
|
+
sage: f.truncate_neg(1)
|
|
1101
|
+
2*t + 3*t^2
|
|
1102
|
+
"""
|
|
1103
|
+
return type(self)(self._parent, self.__u >> (n - self.__n), n)
|
|
1104
|
+
|
|
1105
|
+
cpdef _div_(self, right_r):
|
|
1106
|
+
"""
|
|
1107
|
+
EXAMPLES::
|
|
1108
|
+
|
|
1109
|
+
sage: x = Frac(QQ[['x']]).0
|
|
1110
|
+
sage: f = x + x^2 + 3*x^4 + O(x^7)
|
|
1111
|
+
sage: g = 1/x^7 - x + x^2 - x^4 + O(x^8)
|
|
1112
|
+
sage: f/x
|
|
1113
|
+
1 + x + 3*x^3 + O(x^6)
|
|
1114
|
+
sage: f/g
|
|
1115
|
+
x^8 + x^9 + 3*x^11 + O(x^14)
|
|
1116
|
+
"""
|
|
1117
|
+
cdef LaurentSeries right = <LaurentSeries>right_r
|
|
1118
|
+
if right.__u.is_zero():
|
|
1119
|
+
raise ZeroDivisionError
|
|
1120
|
+
try:
|
|
1121
|
+
return type(self)(self._parent,
|
|
1122
|
+
self.__u / right.__u,
|
|
1123
|
+
self.__n - right.__n)
|
|
1124
|
+
except TypeError as msg:
|
|
1125
|
+
# todo: this could also make something in the formal fraction field.
|
|
1126
|
+
raise ArithmeticError("division not defined")
|
|
1127
|
+
|
|
1128
|
+
def common_prec(self, other):
|
|
1129
|
+
r"""
|
|
1130
|
+
Return the minimum precision of ``self`` and ``other``.
|
|
1131
|
+
|
|
1132
|
+
EXAMPLES::
|
|
1133
|
+
|
|
1134
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
1135
|
+
|
|
1136
|
+
::
|
|
1137
|
+
|
|
1138
|
+
sage: f = t^(-1) + t + t^2 + O(t^3)
|
|
1139
|
+
sage: g = t + t^3 + t^4 + O(t^4)
|
|
1140
|
+
sage: f.common_prec(g)
|
|
1141
|
+
3
|
|
1142
|
+
sage: g.common_prec(f)
|
|
1143
|
+
3
|
|
1144
|
+
|
|
1145
|
+
::
|
|
1146
|
+
|
|
1147
|
+
sage: f = t + t^2 + O(t^3)
|
|
1148
|
+
sage: g = t^(-3) + t^2
|
|
1149
|
+
sage: f.common_prec(g)
|
|
1150
|
+
3
|
|
1151
|
+
sage: g.common_prec(f)
|
|
1152
|
+
3
|
|
1153
|
+
|
|
1154
|
+
::
|
|
1155
|
+
|
|
1156
|
+
sage: f = t + t^2
|
|
1157
|
+
sage: g = t^2
|
|
1158
|
+
sage: f.common_prec(g)
|
|
1159
|
+
+Infinity
|
|
1160
|
+
|
|
1161
|
+
::
|
|
1162
|
+
|
|
1163
|
+
sage: f = t^(-3) + O(t^(-2))
|
|
1164
|
+
sage: g = t^(-5) + O(t^(-1))
|
|
1165
|
+
sage: f.common_prec(g)
|
|
1166
|
+
-2
|
|
1167
|
+
|
|
1168
|
+
::
|
|
1169
|
+
|
|
1170
|
+
sage: f = O(t^2)
|
|
1171
|
+
sage: g = O(t^5)
|
|
1172
|
+
sage: f.common_prec(g)
|
|
1173
|
+
2
|
|
1174
|
+
"""
|
|
1175
|
+
return min(self.prec(), other.prec())
|
|
1176
|
+
|
|
1177
|
+
def common_valuation(self, other):
|
|
1178
|
+
"""
|
|
1179
|
+
Return the minimum valuation of ``self`` and ``other``.
|
|
1180
|
+
|
|
1181
|
+
EXAMPLES::
|
|
1182
|
+
|
|
1183
|
+
sage: R.<t> = LaurentSeriesRing(QQ)
|
|
1184
|
+
|
|
1185
|
+
::
|
|
1186
|
+
|
|
1187
|
+
sage: f = t^(-1) + t + t^2 + O(t^3)
|
|
1188
|
+
sage: g = t + t^3 + t^4 + O(t^4)
|
|
1189
|
+
sage: f.common_valuation(g)
|
|
1190
|
+
-1
|
|
1191
|
+
sage: g.common_valuation(f)
|
|
1192
|
+
-1
|
|
1193
|
+
|
|
1194
|
+
::
|
|
1195
|
+
|
|
1196
|
+
sage: f = t + t^2 + O(t^3)
|
|
1197
|
+
sage: g = t^(-3) + t^2
|
|
1198
|
+
sage: f.common_valuation(g)
|
|
1199
|
+
-3
|
|
1200
|
+
sage: g.common_valuation(f)
|
|
1201
|
+
-3
|
|
1202
|
+
|
|
1203
|
+
::
|
|
1204
|
+
|
|
1205
|
+
sage: f = t + t^2
|
|
1206
|
+
sage: g = t^2
|
|
1207
|
+
sage: f.common_valuation(g)
|
|
1208
|
+
1
|
|
1209
|
+
|
|
1210
|
+
::
|
|
1211
|
+
|
|
1212
|
+
sage: f = t^(-3) + O(t^(-2))
|
|
1213
|
+
sage: g = t^(-5) + O(t^(-1))
|
|
1214
|
+
sage: f.common_valuation(g)
|
|
1215
|
+
-5
|
|
1216
|
+
|
|
1217
|
+
::
|
|
1218
|
+
|
|
1219
|
+
sage: f = O(t^2)
|
|
1220
|
+
sage: g = O(t^5)
|
|
1221
|
+
sage: f.common_valuation(g)
|
|
1222
|
+
+Infinity
|
|
1223
|
+
"""
|
|
1224
|
+
return min(self.valuation(), other.valuation())
|
|
1225
|
+
|
|
1226
|
+
cpdef _richcmp_(self, right_r, int op):
|
|
1227
|
+
r"""
|
|
1228
|
+
Comparison of ``self`` and ``right``.
|
|
1229
|
+
|
|
1230
|
+
We say two approximate Laurent series are equal, if they agree for
|
|
1231
|
+
all coefficients up to the *minimum* of the precisions of each.
|
|
1232
|
+
Comparison is done in dictionary order from lowest degree to
|
|
1233
|
+
highest degree coefficients. This is different than polynomials,
|
|
1234
|
+
but consistent with the idea that the variable of a Laurent
|
|
1235
|
+
series is considered to be "very small".
|
|
1236
|
+
|
|
1237
|
+
See :meth:`power_series_ring_element._richcmp_` for more
|
|
1238
|
+
information.
|
|
1239
|
+
|
|
1240
|
+
EXAMPLES::
|
|
1241
|
+
|
|
1242
|
+
sage: R.<x> = LaurentSeriesRing(QQ)
|
|
1243
|
+
sage: f = x^(-1) + 1 + x + O(x^2)
|
|
1244
|
+
sage: g = x^(-1) + 1 + O(x)
|
|
1245
|
+
sage: f == g
|
|
1246
|
+
True
|
|
1247
|
+
|
|
1248
|
+
::
|
|
1249
|
+
|
|
1250
|
+
sage: f = x^(-1) + 1 + x + O(x^2)
|
|
1251
|
+
sage: g = x^(-1) + 2 + O(x)
|
|
1252
|
+
sage: f == g
|
|
1253
|
+
False
|
|
1254
|
+
sage: f < g
|
|
1255
|
+
True
|
|
1256
|
+
sage: f > g
|
|
1257
|
+
False
|
|
1258
|
+
|
|
1259
|
+
::
|
|
1260
|
+
|
|
1261
|
+
sage: f = x^(-2) + 1 + x + O(x^2)
|
|
1262
|
+
sage: g = x^(-1) + 2 + O(x)
|
|
1263
|
+
sage: f == g
|
|
1264
|
+
False
|
|
1265
|
+
sage: f < g
|
|
1266
|
+
False
|
|
1267
|
+
sage: f > g
|
|
1268
|
+
True
|
|
1269
|
+
|
|
1270
|
+
Check that :issue:`19664` is fixed::
|
|
1271
|
+
|
|
1272
|
+
sage: R.<x> = LaurentSeriesRing(RR)
|
|
1273
|
+
sage: x^(10^9) > 0
|
|
1274
|
+
True
|
|
1275
|
+
"""
|
|
1276
|
+
cdef LaurentSeries right = <LaurentSeries>right_r
|
|
1277
|
+
|
|
1278
|
+
val = self.common_valuation(right)
|
|
1279
|
+
if val is infinity:
|
|
1280
|
+
return rich_to_bool(op, 0) # Both arguments are zero
|
|
1281
|
+
|
|
1282
|
+
cdef long deg = max(self.degree(), right.degree())
|
|
1283
|
+
prec = self.common_prec(right)
|
|
1284
|
+
if deg >= prec:
|
|
1285
|
+
deg = prec - 1
|
|
1286
|
+
|
|
1287
|
+
cdef long i
|
|
1288
|
+
for i in range(val, deg + 1):
|
|
1289
|
+
li = self[i]
|
|
1290
|
+
ri = right[i]
|
|
1291
|
+
if li != ri:
|
|
1292
|
+
return richcmp_not_equal(li, ri, op)
|
|
1293
|
+
return rich_to_bool(op, 0)
|
|
1294
|
+
|
|
1295
|
+
def valuation_zero_part(self):
|
|
1296
|
+
"""
|
|
1297
|
+
EXAMPLES::
|
|
1298
|
+
|
|
1299
|
+
sage: x = Frac(QQ[['x']]).0
|
|
1300
|
+
sage: f = x + x^2 + 3*x^4 + O(x^7)
|
|
1301
|
+
sage: f/x
|
|
1302
|
+
1 + x + 3*x^3 + O(x^6)
|
|
1303
|
+
sage: f.valuation_zero_part()
|
|
1304
|
+
1 + x + 3*x^3 + O(x^6)
|
|
1305
|
+
sage: g = 1/x^7 - x + x^2 - x^4 + O(x^8)
|
|
1306
|
+
sage: g.valuation_zero_part()
|
|
1307
|
+
1 - x^8 + x^9 - x^11 + O(x^15)
|
|
1308
|
+
"""
|
|
1309
|
+
return self.__u
|
|
1310
|
+
|
|
1311
|
+
def valuation(self):
|
|
1312
|
+
"""
|
|
1313
|
+
EXAMPLES::
|
|
1314
|
+
|
|
1315
|
+
sage: R.<x> = LaurentSeriesRing(QQ)
|
|
1316
|
+
sage: f = 1/x + x^2 + 3*x^4 + O(x^7)
|
|
1317
|
+
sage: g = 1 - x + x^2 - x^4 + O(x^8)
|
|
1318
|
+
sage: f.valuation()
|
|
1319
|
+
-1
|
|
1320
|
+
sage: g.valuation()
|
|
1321
|
+
0
|
|
1322
|
+
|
|
1323
|
+
Note that the valuation of an element indistinguishable from
|
|
1324
|
+
zero is infinite::
|
|
1325
|
+
|
|
1326
|
+
sage: h = f - f; h
|
|
1327
|
+
O(x^7)
|
|
1328
|
+
sage: h.valuation()
|
|
1329
|
+
+Infinity
|
|
1330
|
+
|
|
1331
|
+
TESTS:
|
|
1332
|
+
|
|
1333
|
+
The valuation of the zero element is ``+Infinity``
|
|
1334
|
+
(see :issue:`15088`)::
|
|
1335
|
+
|
|
1336
|
+
sage: zero = R(0)
|
|
1337
|
+
sage: zero.valuation()
|
|
1338
|
+
+Infinity
|
|
1339
|
+
"""
|
|
1340
|
+
if self.is_zero():
|
|
1341
|
+
return infinity
|
|
1342
|
+
return self.__n
|
|
1343
|
+
|
|
1344
|
+
def variable(self):
|
|
1345
|
+
"""
|
|
1346
|
+
EXAMPLES::
|
|
1347
|
+
|
|
1348
|
+
sage: x = Frac(QQ[['x']]).0
|
|
1349
|
+
sage: f = 1/x + x^2 + 3*x^4 + O(x^7)
|
|
1350
|
+
sage: f.variable()
|
|
1351
|
+
'x'
|
|
1352
|
+
"""
|
|
1353
|
+
return self._parent.variable_name()
|
|
1354
|
+
|
|
1355
|
+
def prec(self):
|
|
1356
|
+
"""
|
|
1357
|
+
This function returns the n so that the Laurent series is of the
|
|
1358
|
+
form (stuff) + `O(t^n)`. It doesn't matter how many
|
|
1359
|
+
negative powers appear in the expansion. In particular, prec could
|
|
1360
|
+
be negative.
|
|
1361
|
+
|
|
1362
|
+
EXAMPLES::
|
|
1363
|
+
|
|
1364
|
+
sage: x = Frac(QQ[['x']]).0
|
|
1365
|
+
sage: f = x^2 + 3*x^4 + O(x^7)
|
|
1366
|
+
sage: f.prec()
|
|
1367
|
+
7
|
|
1368
|
+
sage: g = 1/x^10 - x + x^2 - x^4 + O(x^8)
|
|
1369
|
+
sage: g.prec()
|
|
1370
|
+
8
|
|
1371
|
+
"""
|
|
1372
|
+
return self.__u.prec() + self.__n
|
|
1373
|
+
|
|
1374
|
+
def precision_absolute(self):
|
|
1375
|
+
"""
|
|
1376
|
+
Return the absolute precision of this series.
|
|
1377
|
+
|
|
1378
|
+
By definition, the absolute precision of
|
|
1379
|
+
`...+O(x^r)` is `r`.
|
|
1380
|
+
|
|
1381
|
+
EXAMPLES::
|
|
1382
|
+
|
|
1383
|
+
sage: R.<t> = ZZ[[]]
|
|
1384
|
+
sage: (t^2 + O(t^3)).precision_absolute()
|
|
1385
|
+
3
|
|
1386
|
+
sage: (1 - t^2 + O(t^100)).precision_absolute()
|
|
1387
|
+
100
|
|
1388
|
+
"""
|
|
1389
|
+
return self.prec()
|
|
1390
|
+
|
|
1391
|
+
def precision_relative(self):
|
|
1392
|
+
"""
|
|
1393
|
+
Return the relative precision of this series, that
|
|
1394
|
+
is the difference between its absolute precision
|
|
1395
|
+
and its valuation.
|
|
1396
|
+
|
|
1397
|
+
By convention, the relative precision of `0` (or
|
|
1398
|
+
`O(x^r)` for any `r`) is `0`.
|
|
1399
|
+
|
|
1400
|
+
EXAMPLES::
|
|
1401
|
+
|
|
1402
|
+
sage: R.<t> = ZZ[[]]
|
|
1403
|
+
sage: (t^2 + O(t^3)).precision_relative()
|
|
1404
|
+
1
|
|
1405
|
+
sage: (1 - t^2 + O(t^100)).precision_relative()
|
|
1406
|
+
100
|
|
1407
|
+
sage: O(t^4).precision_relative()
|
|
1408
|
+
0
|
|
1409
|
+
"""
|
|
1410
|
+
if self.is_zero():
|
|
1411
|
+
return 0
|
|
1412
|
+
else:
|
|
1413
|
+
return self.prec() - self.valuation()
|
|
1414
|
+
|
|
1415
|
+
def __copy__(self):
|
|
1416
|
+
return type(self)(self._parent, self.__u.__copy__(), self.__n)
|
|
1417
|
+
|
|
1418
|
+
def reverse(self, precision=None):
|
|
1419
|
+
"""
|
|
1420
|
+
Return the reverse of f, i.e., the series g such that g(f(x)) = x.
|
|
1421
|
+
Given an optional argument ``precision``, return the reverse with given
|
|
1422
|
+
precision (note that the reverse can have precision at most
|
|
1423
|
+
``f.prec()``). If ``f`` has infinite precision, and the argument
|
|
1424
|
+
``precision`` is not given, then the precision of the reverse defaults
|
|
1425
|
+
to the default precision of ``f.parent()``.
|
|
1426
|
+
|
|
1427
|
+
Note that this is only possible if the valuation of ``self`` is exactly
|
|
1428
|
+
1.
|
|
1429
|
+
|
|
1430
|
+
The implementation depends on the underlying power series element
|
|
1431
|
+
implementing a reverse method.
|
|
1432
|
+
|
|
1433
|
+
EXAMPLES::
|
|
1434
|
+
|
|
1435
|
+
sage: # needs sage.libs.pari
|
|
1436
|
+
sage: R.<x> = Frac(QQ[['x']])
|
|
1437
|
+
sage: f = 2*x + 3*x^2 - x^4 + O(x^5)
|
|
1438
|
+
sage: g = f.reverse()
|
|
1439
|
+
sage: g
|
|
1440
|
+
1/2*x - 3/8*x^2 + 9/16*x^3 - 131/128*x^4 + O(x^5)
|
|
1441
|
+
sage: f(g)
|
|
1442
|
+
x + O(x^5)
|
|
1443
|
+
sage: g(f)
|
|
1444
|
+
x + O(x^5)
|
|
1445
|
+
|
|
1446
|
+
sage: # needs sage.libs.pari
|
|
1447
|
+
sage: A.<t> = LaurentSeriesRing(ZZ)
|
|
1448
|
+
sage: a = t - t^2 - 2*t^4 + t^5 + O(t^6)
|
|
1449
|
+
sage: b = a.reverse(); b
|
|
1450
|
+
t + t^2 + 2*t^3 + 7*t^4 + 25*t^5 + O(t^6)
|
|
1451
|
+
sage: a(b)
|
|
1452
|
+
t + O(t^6)
|
|
1453
|
+
sage: b(a)
|
|
1454
|
+
t + O(t^6)
|
|
1455
|
+
|
|
1456
|
+
sage: # needs sage.libs.pari
|
|
1457
|
+
sage: B.<b,c> = ZZ[ ]
|
|
1458
|
+
sage: A.<t> = LaurentSeriesRing(B)
|
|
1459
|
+
sage: f = t + b*t^2 + c*t^3 + O(t^4)
|
|
1460
|
+
sage: g = f.reverse(); g
|
|
1461
|
+
t - b*t^2 + (2*b^2 - c)*t^3 + O(t^4)
|
|
1462
|
+
sage: f(g)
|
|
1463
|
+
t + O(t^4)
|
|
1464
|
+
sage: g(f)
|
|
1465
|
+
t + O(t^4)
|
|
1466
|
+
|
|
1467
|
+
sage: # needs sage.libs.pari
|
|
1468
|
+
sage: A.<t> = PowerSeriesRing(ZZ)
|
|
1469
|
+
sage: B.<s> = LaurentSeriesRing(A)
|
|
1470
|
+
sage: f = (1 - 3*t + 4*t^3 + O(t^4))*s + (2 + t + t^2 + O(t^3))*s^2 + O(s^3)
|
|
1471
|
+
sage: set_verbose(1)
|
|
1472
|
+
sage: g = f.reverse(); g
|
|
1473
|
+
verbose 1 (<module>) passing to pari failed; trying Lagrange inversion
|
|
1474
|
+
(1 + 3*t + 9*t^2 + 23*t^3 + O(t^4))*s + (-2 - 19*t - 118*t^2 + O(t^3))*s^2 + O(s^3)
|
|
1475
|
+
sage: set_verbose(0)
|
|
1476
|
+
sage: f(g) == g(f) == s
|
|
1477
|
+
True
|
|
1478
|
+
|
|
1479
|
+
If the leading coefficient is not a unit, we pass to its fraction
|
|
1480
|
+
field if possible::
|
|
1481
|
+
|
|
1482
|
+
sage: # needs sage.libs.pari
|
|
1483
|
+
sage: A.<t> = LaurentSeriesRing(ZZ)
|
|
1484
|
+
sage: a = 2*t - 4*t^2 + t^4 - t^5 + O(t^6)
|
|
1485
|
+
sage: a.reverse()
|
|
1486
|
+
1/2*t + 1/2*t^2 + t^3 + 79/32*t^4 + 437/64*t^5 + O(t^6)
|
|
1487
|
+
|
|
1488
|
+
sage: # needs sage.libs.pari
|
|
1489
|
+
sage: B.<b> = PolynomialRing(ZZ)
|
|
1490
|
+
sage: A.<t> = LaurentSeriesRing(B)
|
|
1491
|
+
sage: f = 2*b*t + b*t^2 + 3*b^2*t^3 + O(t^4)
|
|
1492
|
+
sage: g = f.reverse(); g
|
|
1493
|
+
1/(2*b)*t - 1/(8*b^2)*t^2 + ((-3*b + 1)/(16*b^3))*t^3 + O(t^4)
|
|
1494
|
+
sage: f(g)
|
|
1495
|
+
t + O(t^4)
|
|
1496
|
+
sage: g(f)
|
|
1497
|
+
t + O(t^4)
|
|
1498
|
+
|
|
1499
|
+
We can handle some base rings of positive characteristic::
|
|
1500
|
+
|
|
1501
|
+
sage: # needs sage.libs.pari
|
|
1502
|
+
sage: A8.<t> = LaurentSeriesRing(Zmod(8))
|
|
1503
|
+
sage: a = t - 15*t^2 - 2*t^4 + t^5 + O(t^6)
|
|
1504
|
+
sage: b = a.reverse(); b
|
|
1505
|
+
t + 7*t^2 + 2*t^3 + 5*t^4 + t^5 + O(t^6)
|
|
1506
|
+
sage: a(b)
|
|
1507
|
+
t + O(t^6)
|
|
1508
|
+
sage: b(a)
|
|
1509
|
+
t + O(t^6)
|
|
1510
|
+
|
|
1511
|
+
The optional argument ``precision`` sets the precision of the output::
|
|
1512
|
+
|
|
1513
|
+
sage: # needs sage.libs.pari
|
|
1514
|
+
sage: R.<x> = LaurentSeriesRing(QQ)
|
|
1515
|
+
sage: f = 2*x + 3*x^2 - 7*x^3 + x^4 + O(x^5)
|
|
1516
|
+
sage: g = f.reverse(precision=3); g
|
|
1517
|
+
1/2*x - 3/8*x^2 + O(x^3)
|
|
1518
|
+
sage: f(g)
|
|
1519
|
+
x + O(x^3)
|
|
1520
|
+
sage: g(f)
|
|
1521
|
+
x + O(x^3)
|
|
1522
|
+
|
|
1523
|
+
If the input series has infinite precision, the precision of the
|
|
1524
|
+
output is automatically set to the default precision of the parent
|
|
1525
|
+
ring::
|
|
1526
|
+
|
|
1527
|
+
sage: # needs sage.libs.pari
|
|
1528
|
+
sage: R.<x> = LaurentSeriesRing(QQ, default_prec=20)
|
|
1529
|
+
sage: (x - x^2).reverse() # get some Catalan numbers
|
|
1530
|
+
x + x^2 + 2*x^3 + 5*x^4 + 14*x^5 + 42*x^6 + 132*x^7 + 429*x^8 + 1430*x^9
|
|
1531
|
+
+ 4862*x^10 + 16796*x^11 + 58786*x^12 + 208012*x^13 + 742900*x^14
|
|
1532
|
+
+ 2674440*x^15 + 9694845*x^16 + 35357670*x^17 + 129644790*x^18
|
|
1533
|
+
+ 477638700*x^19 + O(x^20)
|
|
1534
|
+
sage: (x - x^2).reverse(precision=3)
|
|
1535
|
+
x + x^2 + O(x^3)
|
|
1536
|
+
|
|
1537
|
+
TESTS::
|
|
1538
|
+
|
|
1539
|
+
sage: R.<x> = LaurentSeriesRing(QQ)
|
|
1540
|
+
sage: f = 1 + 2*x + 3*x^2 - x^4 + O(x^5)
|
|
1541
|
+
sage: f.reverse()
|
|
1542
|
+
Traceback (most recent call last):
|
|
1543
|
+
...
|
|
1544
|
+
ValueError: Series must have valuation one for reversion.
|
|
1545
|
+
"""
|
|
1546
|
+
val = self.valuation()
|
|
1547
|
+
if val != 1:
|
|
1548
|
+
raise ValueError("Series must have valuation one for reversion.")
|
|
1549
|
+
u = self.valuation_zero_part()
|
|
1550
|
+
u = u.parent().gen(0) * u
|
|
1551
|
+
|
|
1552
|
+
rev = u.reverse(precision=precision)
|
|
1553
|
+
|
|
1554
|
+
if rev.parent() == u.parent():
|
|
1555
|
+
return self._parent(rev)
|
|
1556
|
+
else:
|
|
1557
|
+
P = self._parent.change_ring(rev.parent().base_ring())
|
|
1558
|
+
return P(rev)
|
|
1559
|
+
|
|
1560
|
+
def derivative(self, *args):
|
|
1561
|
+
"""
|
|
1562
|
+
The formal derivative of this Laurent series, with respect to
|
|
1563
|
+
variables supplied in args.
|
|
1564
|
+
|
|
1565
|
+
Multiple variables and iteration counts may be supplied; see
|
|
1566
|
+
documentation for the global derivative() function for more
|
|
1567
|
+
details.
|
|
1568
|
+
|
|
1569
|
+
.. SEEALSO::
|
|
1570
|
+
|
|
1571
|
+
:meth:`_derivative`
|
|
1572
|
+
|
|
1573
|
+
EXAMPLES::
|
|
1574
|
+
|
|
1575
|
+
sage: R.<x> = LaurentSeriesRing(QQ)
|
|
1576
|
+
sage: g = 1/x^10 - x + x^2 - x^4 + O(x^8)
|
|
1577
|
+
sage: g.derivative()
|
|
1578
|
+
-10*x^-11 - 1 + 2*x - 4*x^3 + O(x^7)
|
|
1579
|
+
sage: g.derivative(x)
|
|
1580
|
+
-10*x^-11 - 1 + 2*x - 4*x^3 + O(x^7)
|
|
1581
|
+
|
|
1582
|
+
::
|
|
1583
|
+
|
|
1584
|
+
sage: R.<t> = PolynomialRing(ZZ)
|
|
1585
|
+
sage: S.<x> = LaurentSeriesRing(R)
|
|
1586
|
+
sage: f = 2*t/x + (3*t^2 + 6*t)*x + O(x^2)
|
|
1587
|
+
sage: f.derivative()
|
|
1588
|
+
-2*t*x^-2 + (3*t^2 + 6*t) + O(x)
|
|
1589
|
+
sage: f.derivative(x)
|
|
1590
|
+
-2*t*x^-2 + (3*t^2 + 6*t) + O(x)
|
|
1591
|
+
sage: f.derivative(t)
|
|
1592
|
+
2*x^-1 + (6*t + 6)*x + O(x^2)
|
|
1593
|
+
"""
|
|
1594
|
+
return multi_derivative(self, args)
|
|
1595
|
+
|
|
1596
|
+
def _derivative(self, var=None):
|
|
1597
|
+
"""
|
|
1598
|
+
The formal derivative of this Laurent series with respect to var.
|
|
1599
|
+
|
|
1600
|
+
If var is None or the generator of this ring, it's the formal
|
|
1601
|
+
derivative as expected. Otherwise, _derivative(var) gets called
|
|
1602
|
+
recursively on each coefficient.
|
|
1603
|
+
|
|
1604
|
+
.. SEEALSO::
|
|
1605
|
+
|
|
1606
|
+
:meth:`derivative`
|
|
1607
|
+
|
|
1608
|
+
EXAMPLES::
|
|
1609
|
+
|
|
1610
|
+
sage: x = Frac(QQ[['x']]).0
|
|
1611
|
+
sage: f = x^2 + 3*x^4 + O(x^7)
|
|
1612
|
+
sage: f._derivative()
|
|
1613
|
+
2*x + 12*x^3 + O(x^6)
|
|
1614
|
+
sage: f._derivative(x)
|
|
1615
|
+
2*x + 12*x^3 + O(x^6)
|
|
1616
|
+
sage: g = 1/x^10 - x + x^2 - x^4 + O(x^8)
|
|
1617
|
+
sage: g._derivative()
|
|
1618
|
+
-10*x^-11 - 1 + 2*x - 4*x^3 + O(x^7)
|
|
1619
|
+
|
|
1620
|
+
Differentiating with respect to something other than the generator
|
|
1621
|
+
gets recursed into the base ring::
|
|
1622
|
+
|
|
1623
|
+
sage: R.<t> = PolynomialRing(ZZ)
|
|
1624
|
+
sage: S.<x> = LaurentSeriesRing(R)
|
|
1625
|
+
sage: f = 2*t/x + (3*t^2 + 6*t)*x + O(x^2)
|
|
1626
|
+
sage: f._derivative(t)
|
|
1627
|
+
2*x^-1 + (6*t + 6)*x + O(x^2)
|
|
1628
|
+
|
|
1629
|
+
TESTS::
|
|
1630
|
+
|
|
1631
|
+
sage: y = var('y') # needs sage.symbolic
|
|
1632
|
+
sage: f.derivative(y) # needs sage.symbolic
|
|
1633
|
+
Traceback (most recent call last):
|
|
1634
|
+
...
|
|
1635
|
+
ValueError: cannot differentiate with respect to y
|
|
1636
|
+
"""
|
|
1637
|
+
if var is not None and var != self._parent.gen():
|
|
1638
|
+
try:
|
|
1639
|
+
# call _derivative() recursively on coefficients
|
|
1640
|
+
u = [coeff._derivative(var) for coeff in self.__u.list()]
|
|
1641
|
+
u = self._parent._power_series_ring(u, self.__u.prec())
|
|
1642
|
+
return type(self)(self._parent, u, self.__n)
|
|
1643
|
+
except AttributeError:
|
|
1644
|
+
raise ValueError("cannot differentiate with respect to {}".format(var))
|
|
1645
|
+
|
|
1646
|
+
# compute formal derivative with respect to generator
|
|
1647
|
+
if self.is_zero():
|
|
1648
|
+
return type(self)(self._parent, 0, self.__u.prec() - 1)
|
|
1649
|
+
cdef long m, n = self.__n
|
|
1650
|
+
a = self.__u.list()
|
|
1651
|
+
v = [(n+m)*a[m] for m from 0 <= m < len(a)]
|
|
1652
|
+
u = self._parent._power_series_ring(v, self.__u.prec())
|
|
1653
|
+
return type(self)(self._parent, u, n-1)
|
|
1654
|
+
|
|
1655
|
+
def integral(self):
|
|
1656
|
+
r"""
|
|
1657
|
+
The formal integral of this Laurent series with 0 constant term.
|
|
1658
|
+
|
|
1659
|
+
EXAMPLES: The integral may or may not be defined if the base ring
|
|
1660
|
+
is not a field.
|
|
1661
|
+
|
|
1662
|
+
::
|
|
1663
|
+
|
|
1664
|
+
sage: t = LaurentSeriesRing(ZZ, 't').0
|
|
1665
|
+
sage: f = 2*t^-3 + 3*t^2 + O(t^4)
|
|
1666
|
+
sage: f.integral()
|
|
1667
|
+
-t^-2 + t^3 + O(t^5)
|
|
1668
|
+
|
|
1669
|
+
::
|
|
1670
|
+
|
|
1671
|
+
sage: f = t^3
|
|
1672
|
+
sage: f.integral()
|
|
1673
|
+
Traceback (most recent call last):
|
|
1674
|
+
...
|
|
1675
|
+
ArithmeticError: Coefficients of integral cannot be coerced into the base ring
|
|
1676
|
+
|
|
1677
|
+
The integral of 1/t is `\log(t)`, which is not given by a
|
|
1678
|
+
Laurent series::
|
|
1679
|
+
|
|
1680
|
+
sage: t = Frac(QQ[['t']]).0
|
|
1681
|
+
sage: f = -1/t^3 - 31/t + O(t^3)
|
|
1682
|
+
sage: f.integral()
|
|
1683
|
+
Traceback (most recent call last):
|
|
1684
|
+
...
|
|
1685
|
+
ArithmeticError: The integral of is not a Laurent series, since t^-1 has nonzero coefficient.
|
|
1686
|
+
|
|
1687
|
+
Another example with just one negative coefficient::
|
|
1688
|
+
|
|
1689
|
+
sage: A.<t> = QQ[[]]
|
|
1690
|
+
sage: f = -2*t^(-4) + O(t^8)
|
|
1691
|
+
sage: f.integral()
|
|
1692
|
+
2/3*t^-3 + O(t^9)
|
|
1693
|
+
sage: f.integral().derivative() == f
|
|
1694
|
+
True
|
|
1695
|
+
"""
|
|
1696
|
+
cdef long i, n = self.__n
|
|
1697
|
+
a = self.__u.list()
|
|
1698
|
+
if self[-1] != 0:
|
|
1699
|
+
raise ArithmeticError("The integral of is not a Laurent series, since t^-1 has nonzero coefficient.")
|
|
1700
|
+
|
|
1701
|
+
if n < 0:
|
|
1702
|
+
v = [a[i]/(n+i+1) for i in range(min(-1-n,len(a)))] + [0]
|
|
1703
|
+
else:
|
|
1704
|
+
v = []
|
|
1705
|
+
v += [a[i]/(n+i+1) for i in range(max(-n,0), len(a))]
|
|
1706
|
+
try:
|
|
1707
|
+
u = self._parent._power_series_ring(v, self.__u.prec())
|
|
1708
|
+
except TypeError:
|
|
1709
|
+
raise ArithmeticError("Coefficients of integral cannot be coerced into the base ring")
|
|
1710
|
+
return type(self)(self._parent, u, n+1)
|
|
1711
|
+
|
|
1712
|
+
def nth_root(self, long n, prec=None):
|
|
1713
|
+
r"""
|
|
1714
|
+
Return the ``n``-th root of this Laurent power series.
|
|
1715
|
+
|
|
1716
|
+
INPUT:
|
|
1717
|
+
|
|
1718
|
+
- ``n`` -- integer
|
|
1719
|
+
|
|
1720
|
+
- ``prec`` -- integer (optional); precision of the result. Though, if
|
|
1721
|
+
this series has finite precision, then the result cannot have larger
|
|
1722
|
+
precision.
|
|
1723
|
+
|
|
1724
|
+
EXAMPLES::
|
|
1725
|
+
|
|
1726
|
+
sage: R.<x> = LaurentSeriesRing(QQ)
|
|
1727
|
+
sage: (x^-2 + 1 + x).nth_root(2)
|
|
1728
|
+
x^-1 + 1/2*x + 1/2*x^2 - ... - 19437/65536*x^18 + O(x^19)
|
|
1729
|
+
sage: (x^-2 + 1 + x).nth_root(2)**2
|
|
1730
|
+
x^-2 + 1 + x + O(x^18)
|
|
1731
|
+
|
|
1732
|
+
sage: # needs sage.modular
|
|
1733
|
+
sage: j = j_invariant_qexp()
|
|
1734
|
+
sage: q = j.parent().gen()
|
|
1735
|
+
sage: j(q^3).nth_root(3)
|
|
1736
|
+
q^-1 + 248*q^2 + 4124*q^5 + ... + O(q^29)
|
|
1737
|
+
sage: (j(q^2) - 1728).nth_root(2)
|
|
1738
|
+
q^-1 - 492*q - 22590*q^3 - ... + O(q^19)
|
|
1739
|
+
"""
|
|
1740
|
+
if prec is None:
|
|
1741
|
+
prec = self.prec()
|
|
1742
|
+
if prec is infinity:
|
|
1743
|
+
prec = self.parent().default_prec()
|
|
1744
|
+
else:
|
|
1745
|
+
prec = min(self.prec(), prec)
|
|
1746
|
+
|
|
1747
|
+
if n <= 0:
|
|
1748
|
+
raise ValueError('n must be positive')
|
|
1749
|
+
|
|
1750
|
+
i = self.valuation()
|
|
1751
|
+
if i % n:
|
|
1752
|
+
raise ValueError('valuation must be divisible by n')
|
|
1753
|
+
|
|
1754
|
+
q = self.__u.nth_root(n, prec)
|
|
1755
|
+
return type(self)(self._parent, q + self.parent()(0).O(prec), i // n)
|
|
1756
|
+
|
|
1757
|
+
def power_series(self):
|
|
1758
|
+
"""
|
|
1759
|
+
Convert this Laurent series to a power series.
|
|
1760
|
+
|
|
1761
|
+
An error is raised if the Laurent series has a term (or an error
|
|
1762
|
+
term `O(x^k)`) whose exponent is negative.
|
|
1763
|
+
|
|
1764
|
+
EXAMPLES::
|
|
1765
|
+
|
|
1766
|
+
sage: R.<t> = LaurentSeriesRing(ZZ)
|
|
1767
|
+
sage: f = 1/(1-t+O(t^10)); f.parent()
|
|
1768
|
+
Laurent Series Ring in t over Integer Ring
|
|
1769
|
+
sage: g = f.power_series(); g
|
|
1770
|
+
1 + t + t^2 + t^3 + t^4 + t^5 + t^6 + t^7 + t^8 + t^9 + O(t^10)
|
|
1771
|
+
sage: parent(g)
|
|
1772
|
+
Power Series Ring in t over Integer Ring
|
|
1773
|
+
sage: f = 3/t^2 + t^2 + t^3 + O(t^10)
|
|
1774
|
+
sage: f.power_series()
|
|
1775
|
+
Traceback (most recent call last):
|
|
1776
|
+
...
|
|
1777
|
+
TypeError: self is not a power series
|
|
1778
|
+
|
|
1779
|
+
TESTS:
|
|
1780
|
+
|
|
1781
|
+
Check whether a polynomial over a Laurent series ring is contained in the
|
|
1782
|
+
polynomial ring over the power series ring (see :issue:`19459`):
|
|
1783
|
+
|
|
1784
|
+
sage: # needs sage.rings.finite_rings
|
|
1785
|
+
sage: L.<t> = LaurentSeriesRing(GF(2))
|
|
1786
|
+
sage: R.<x,y> = PolynomialRing(L)
|
|
1787
|
+
sage: S.<x,y> = PolynomialRing(L._power_series_ring)
|
|
1788
|
+
sage: t**(-1)*x*y in S
|
|
1789
|
+
False
|
|
1790
|
+
|
|
1791
|
+
There used to be an issue with non-canonical representations of zero,
|
|
1792
|
+
see :issue:`31383`::
|
|
1793
|
+
|
|
1794
|
+
sage: S.<x> = PowerSeriesRing(QQ)
|
|
1795
|
+
sage: L = Frac(S)
|
|
1796
|
+
sage: s = L(O(x^2))
|
|
1797
|
+
sage: (s*x^(-1)).power_series()
|
|
1798
|
+
O(x^1)
|
|
1799
|
+
sage: (s*x^(-2)).power_series()
|
|
1800
|
+
O(x^0)
|
|
1801
|
+
sage: (s*x^(-3)).power_series()
|
|
1802
|
+
Traceback (most recent call last):
|
|
1803
|
+
...
|
|
1804
|
+
TypeError: self is not a power series
|
|
1805
|
+
|
|
1806
|
+
Test for :issue:`32440`::
|
|
1807
|
+
|
|
1808
|
+
sage: L.<x> = LaurentSeriesRing(QQ, implementation='pari') # needs sage.libs.pari
|
|
1809
|
+
sage: (x + O(x^3)).power_series() # needs sage.libs.pari
|
|
1810
|
+
x + O(x^3)
|
|
1811
|
+
"""
|
|
1812
|
+
if self.__n < 0:
|
|
1813
|
+
if self.__u.is_zero() and self.__u.prec() >= - self.__n:
|
|
1814
|
+
return self.__u >> (- self.__n)
|
|
1815
|
+
else:
|
|
1816
|
+
raise TypeError("self is not a power series")
|
|
1817
|
+
return self.__u << self.__n
|
|
1818
|
+
|
|
1819
|
+
def inverse(self):
|
|
1820
|
+
"""
|
|
1821
|
+
Return the inverse of self, i.e., self^(-1).
|
|
1822
|
+
|
|
1823
|
+
EXAMPLES::
|
|
1824
|
+
|
|
1825
|
+
sage: R.<t> = LaurentSeriesRing(ZZ)
|
|
1826
|
+
sage: t.inverse()
|
|
1827
|
+
t^-1
|
|
1828
|
+
sage: (1-t).inverse()
|
|
1829
|
+
1 + t + t^2 + t^3 + t^4 + t^5 + t^6 + t^7 + t^8 + ...
|
|
1830
|
+
"""
|
|
1831
|
+
return ~self
|
|
1832
|
+
|
|
1833
|
+
def __call__(self, *x, **kwds):
|
|
1834
|
+
"""
|
|
1835
|
+
Compute value of this Laurent series at x.
|
|
1836
|
+
|
|
1837
|
+
EXAMPLES::
|
|
1838
|
+
|
|
1839
|
+
sage: P.<x, y> = ZZ[]
|
|
1840
|
+
sage: R.<t> = LaurentSeriesRing(P)
|
|
1841
|
+
sage: f = x*t^-2 + y*t^2 + O(t^8)
|
|
1842
|
+
sage: f(t^3)
|
|
1843
|
+
x*t^-6 + y*t^6 + O(t^24)
|
|
1844
|
+
sage: f(t=t^3)
|
|
1845
|
+
x*t^-6 + y*t^6 + O(t^24)
|
|
1846
|
+
sage: f(t + O(t^5))
|
|
1847
|
+
x*t^-2 + O(t^2)
|
|
1848
|
+
sage: f(y=x)
|
|
1849
|
+
x*t^-2 + x*t^2 + O(t^8)
|
|
1850
|
+
sage: f(t^3, x=2, y=x + x^2)
|
|
1851
|
+
2*t^-6 + (x^2 + x)*t^6 + O(t^24)
|
|
1852
|
+
sage: f(t^3, 2, x+x^2)
|
|
1853
|
+
2*t^-6 + (x^2 + x)*t^6 + O(t^24)
|
|
1854
|
+
sage: f(x=2, t=t^3, y=x + x^2)
|
|
1855
|
+
2*t^-6 + (x^2 + x)*t^6 + O(t^24)
|
|
1856
|
+
sage: f(2, x + x^2, t=t^3)
|
|
1857
|
+
Traceback (most recent call last):
|
|
1858
|
+
...
|
|
1859
|
+
ValueError: must not specify t keyword and positional argument
|
|
1860
|
+
|
|
1861
|
+
It is only possible to substitute elements of positive valuation::
|
|
1862
|
+
|
|
1863
|
+
sage: f(t^-2)
|
|
1864
|
+
Traceback (most recent call last):
|
|
1865
|
+
...
|
|
1866
|
+
ValueError: Can only substitute elements of positive valuation
|
|
1867
|
+
|
|
1868
|
+
Test for :issue:`23928`::
|
|
1869
|
+
|
|
1870
|
+
sage: R.<x> = LaurentSeriesRing(QQ, implementation='pari') # needs sage.libs.pari
|
|
1871
|
+
sage: f = x.add_bigoh(7) # needs sage.libs.pari
|
|
1872
|
+
sage: f(x) # needs sage.libs.pari
|
|
1873
|
+
x + O(x^7)
|
|
1874
|
+
"""
|
|
1875
|
+
if len(kwds) >= 1:
|
|
1876
|
+
name = self.parent().variable_name()
|
|
1877
|
+
if name in kwds: # a keyword specifies the Laurent series generator
|
|
1878
|
+
if x:
|
|
1879
|
+
raise ValueError("must not specify %s keyword and positional argument" % name)
|
|
1880
|
+
a = self(kwds[name])
|
|
1881
|
+
del kwds[name]
|
|
1882
|
+
try:
|
|
1883
|
+
return a(**kwds)
|
|
1884
|
+
except TypeError:
|
|
1885
|
+
return a
|
|
1886
|
+
elif x: # both keywords and positional arguments
|
|
1887
|
+
a = self(*x)
|
|
1888
|
+
try:
|
|
1889
|
+
return a(**kwds)
|
|
1890
|
+
except TypeError:
|
|
1891
|
+
return a
|
|
1892
|
+
else: # keywords but no positional arguments
|
|
1893
|
+
return self.__u(**kwds)*(self.parent().gen()**self.__n)
|
|
1894
|
+
|
|
1895
|
+
if len(x) == 0:
|
|
1896
|
+
return self
|
|
1897
|
+
|
|
1898
|
+
if isinstance(x[0], tuple):
|
|
1899
|
+
x = x[0]
|
|
1900
|
+
|
|
1901
|
+
return self.__u(*x)*(x[0]**self.__n)
|
|
1902
|
+
|
|
1903
|
+
def __pari__(self):
|
|
1904
|
+
"""
|
|
1905
|
+
Convert ``self`` to a PARI object.
|
|
1906
|
+
|
|
1907
|
+
TESTS::
|
|
1908
|
+
|
|
1909
|
+
sage: L.<x> = LaurentSeriesRing(QQ)
|
|
1910
|
+
sage: f = x + 1/x + O(x^2); f
|
|
1911
|
+
x^-1 + x + O(x^2)
|
|
1912
|
+
sage: f.__pari__() # needs sage.libs.pari
|
|
1913
|
+
x^-1 + x + O(x^2)
|
|
1914
|
+
|
|
1915
|
+
Check that :issue:`32437` is fixed::
|
|
1916
|
+
|
|
1917
|
+
sage: # needs sage.rings.finite_rings
|
|
1918
|
+
sage: F.<u> = GF(257^2)
|
|
1919
|
+
sage: R.<t> = LaurentSeriesRing(F)
|
|
1920
|
+
sage: g = t + O(t^99)
|
|
1921
|
+
sage: f = u*t + O(t^99)
|
|
1922
|
+
sage: g(f) # indirect doctest # needs sage.libs.pari
|
|
1923
|
+
u*t + O(t^99)
|
|
1924
|
+
"""
|
|
1925
|
+
f = self.__u
|
|
1926
|
+
x = f.parent().gen()
|
|
1927
|
+
return f.__pari__() * x.__pari__()**self.__n
|