Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow creation of polynomial ring over lazy power series ring #39730

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/sage/rings/lazy_series.py
Original file line number Diff line number Diff line change
@@ -221,7 +221,7 @@
# https://www.gnu.org/licenses/
# ****************************************************************************

from sage.structure.element import Element, parent
from sage.structure.element import Element, ModuleElement, RingElement, parent
from sage.structure.richcmp import op_EQ, op_NE
from sage.misc.misc_c import prod
from sage.arith.power import generic_power
@@ -262,7 +262,7 @@
)


class LazyModuleElement(Element):
class LazyModuleElement(ModuleElement):
r"""
A lazy sequence with a module structure given by term-wise
addition and scalar multiplication.
@@ -2928,7 +2928,7 @@ def sqrt(self):
return self ** QQ((1, 2)) # == 1/2


class LazyCauchyProductSeries(LazyModuleElement):
class LazyCauchyProductSeries(LazyModuleElement, RingElement):
r"""
A class for series where multiplication is the Cauchy product.

@@ -2945,6 +2945,13 @@ class LazyCauchyProductSeries(LazyModuleElement):
sage: f = 1 / (1 - z)
sage: f
1 + z + z^2 + O(z^3)

TESTS:

Check creation of polynomial ring over lazy power series ring::

sage: R.<x> = LazyPowerSeriesRing(QQ)
sage: T.<t> = R[]
"""
def valuation(self):
r"""
4 changes: 3 additions & 1 deletion src/sage/symbolic/expression.pyx
Original file line number Diff line number Diff line change
@@ -13733,6 +13733,7 @@ cpdef new_Expression(parent, x):

from sage.rings.infinity import (infinity, minus_infinity,
unsigned_infinity)
from sage.rings.lazy_series import LazyCauchyProductSeries
from sage.structure.factorization import Factorization
from sage.categories.sets_cat import Sets

@@ -13757,7 +13758,8 @@ cpdef new_Expression(parent, x):
return new_Expression_from_GEx(parent, g_mInfinity)
elif x is unsigned_infinity:
return new_Expression_from_GEx(parent, g_UnsignedInfinity)
elif isinstance(x, (RingElement, Matrix)):
elif isinstance(x, (RingElement, Matrix)) and not isinstance(x, LazyCauchyProductSeries):
# TODO allow conversion from LazyCauchyProductSeries to SR results in some mysterious bug
if x.parent().characteristic():
raise TypeError('positive characteristic not allowed in symbolic computations')
exp = x
Loading