From 2b40d390c2d554e02192dd6fda48caa6264ba5d7 Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Sun, 26 Sep 2021 15:18:58 +0900 Subject: [PATCH] Strengthening Laurent series conversion. --- src/sage/rings/lazy_series_ring.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/sage/rings/lazy_series_ring.py b/src/sage/rings/lazy_series_ring.py index f68dbecac83..35e1c921dfc 100644 --- a/src/sage/rings/lazy_series_ring.py +++ b/src/sage/rings/lazy_series_ring.py @@ -34,6 +34,7 @@ from sage.rings.polynomial.laurent_polynomial_ring import LaurentPolynomialRing from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing from sage.rings.lazy_series import (LazyModuleElement, + LazyCauchyProductSeries, LazyLaurentSeries, LazyDirichletSeries) from sage.structure.global_options import GlobalOptions @@ -253,6 +254,13 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No ... ValueError: constant may only be specified if the degree is specified + sage: D = LazyDirichletSeriesRing(ZZ, 't') + sage: m = D(moebius) + sage: L(m) + Traceback (most recent call last): + ... + ValueError: unable to convert ... into Lazy Laurent Series Ring ... + We support the old input format for ``constant``:: sage: f = L(lambda i: i, valuation=-3, constant=-1, degree=3) @@ -263,11 +271,6 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No sage: f == g True - sage: D = LazyDirichletSeriesRing(ZZ, 't') - sage: m = D(moebius) - sage: L(m) - z - z^2 - z^3 - z^5 + z^6 - z^7 + O(z^8) - .. TODO:: Add a method to change the sparse/dense implementation. @@ -318,7 +321,7 @@ def _element_constructor_(self, x=None, valuation=None, degree=None, constant=No return self.element_class(self, coeff_stream) # Handle when it is a lazy series - if isinstance(x, LazyModuleElement): + if isinstance(x, LazyCauchyProductSeries): if x._coeff_stream._is_sparse is not self._sparse: # TODO: Implement a way to make a self._sparse copy raise NotImplementedError("cannot convert between sparse and dense")