From 60f0664c21b596ef0bd539cdfe61f3552ac75373 Mon Sep 17 00:00:00 2001 From: Martin Rubey Date: Sun, 18 Sep 2022 14:21:26 +0200 Subject: [PATCH] fix more _an_element and some_element with incorrect coefficients --- src/sage/rings/lazy_series_ring.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/sage/rings/lazy_series_ring.py b/src/sage/rings/lazy_series_ring.py index 6cd4706a61e..1635aada162 100644 --- a/src/sage/rings/lazy_series_ring.py +++ b/src/sage/rings/lazy_series_ring.py @@ -1129,12 +1129,12 @@ def _an_element_(self): sage: L = LazyLaurentSeriesRing(ZZ, 'z') sage: L.an_element() - z^-2 + 3*z^-1 + 2*z + z^2 + z^3 + z^4 + O(z^5) + z^-2 + z^3 + z^4 + z^5 + O(z^6) """ - R = self.base_ring() - coeff_stream = Stream_exact([R.an_element(), 3, 0, 2*R.an_element(), 1], - self._sparse, order=-2, constant=R.one()) - return self.element_class(self, coeff_stream) + return self(self._laurent_poly_ring.an_element(), + valuation=-2, + degree=3, + constant=self.base_ring().an_element()) def some_elements(self): """ @@ -1146,7 +1146,7 @@ def some_elements(self): sage: L.some_elements()[:7] [0, 1, z, -3*z^-4 + z^-3 - 12*z^-2 - 2*z^-1 - 10 - 8*z + z^2 + z^3, - z^-2 + 3*z^-1 + 2*z + z^2 + z^3 + z^4 + O(z^5), + z^-2 + z^3 + z^4 + z^5 + O(z^6), -2*z^-3 - 2*z^-2 + 4*z^-1 + 11 - z - 34*z^2 - 31*z^3 + O(z^4), 4*z^-2 + z^-1 + z + 4*z^2 + 9*z^3 + 16*z^4 + O(z^5)] @@ -1154,7 +1154,7 @@ def some_elements(self): sage: L.some_elements()[:7] [0, 1, z, z^-4 + z^-3 + z^2 + z^3, - z^-1 + z^2 + z^3 + z^4 + O(z^5), + z^-2, 1 + z + z^3 + z^4 + z^6 + O(z^7), z^-1 + z + z^3 + O(z^5)] @@ -1162,7 +1162,7 @@ def some_elements(self): sage: L.some_elements()[:7] [0, 1, z, z^-3 + z^-1 + 2 + z + z^2 + z^3, - z^2 + z^3 + z^4 + O(z^5), + z^-2, z^-3 + z^-2 + z^-1 + 2 + 2*z + 2*z^2 + O(z^3), z^-2 + z^-1 + z + z^2 + z^4 + O(z^5)] """ @@ -1724,12 +1724,15 @@ def _an_element_(self): sage: L = LazyPowerSeriesRing(ZZ, 'z') sage: L.an_element() - z + z + z^2 + z^3 + O(z^4) sage: L = LazyPowerSeriesRing(ZZ, 'x, y') sage: L.an_element() x """ + if self._arity == 1: + return self(self._laurent_poly_ring.an_element(), + constant=self.base_ring().an_element()) return self(self._laurent_poly_ring.an_element()) def uniformizer(self): @@ -1774,14 +1777,14 @@ def some_elements(self): sage: L = LazyPowerSeriesRing(ZZ, 'z') sage: L.some_elements()[:6] - [0, 1, z, + [0, 1, z + z^2 + z^3 + O(z^4), -12 - 8*z + z^2 + z^3, 1 + z - 2*z^2 - 7*z^3 - z^4 + 20*z^5 + 23*z^6 + O(z^7), z + 4*z^2 + 9*z^3 + 16*z^4 + 25*z^5 + 36*z^6 + O(z^7)] sage: L = LazyPowerSeriesRing(GF(3)["q"], 'z') sage: L.some_elements()[:6] - [0, 1, z, + [0, 1, z + q*z^2 + q*z^3 + q*z^4 + O(z^5), z + z^2 + z^3, 1 + z + z^2 + 2*z^3 + 2*z^4 + 2*z^5 + O(z^6), z + z^2 + z^4 + z^5 + O(z^7)]