Skip to content

Commit

Permalink
Allow coercion from Frac(QQ[x]) to LaurentSeriesRing(QQ)
Browse files Browse the repository at this point in the history
  • Loading branch information
user202729 committed Jan 22, 2025
1 parent 5188024 commit 20ac0fb
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/sage/rings/laurent_series_ring.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,8 @@ def _coerce_map_from_(self, P):
True
sage: S.has_coerce_map_from(PolynomialRing(ZZ, 't'))
True
sage: S.has_coerce_map_from(Frac(PolynomialRing(ZZ, 't')))
False
sage: S.has_coerce_map_from(LaurentPolynomialRing(ZZ, 't'))
True
sage: S.has_coerce_map_from(PowerSeriesRing(ZZ, 't'))
Expand All @@ -671,6 +673,12 @@ def _coerce_map_from_(self, P):
sage: S.has_coerce_map_from(LaurentSeriesRing(QQ, 't'))
False
sage: T.<t> = LaurentSeriesRing(QQ)
sage: T.has_coerce_map_from(QQ['t'])
True
sage: T.has_coerce_map_from(Frac(QQ['t']))
True
sage: R.<t> = LaurentSeriesRing(QQ['x'])
sage: R.has_coerce_map_from(QQ[['t']])
True
Expand All @@ -687,7 +695,10 @@ def _coerce_map_from_(self, P):
sage: R.has_coerce_map_from(LazyLaurentSeriesRing(ZZ['x'], 't'))
True
"""
from sage.rings.fraction_field import FractionField_generic
A = self.base_ring()
if isinstance(P, FractionField_generic) and A.is_field():
return self.has_coerce_map_from(P.base())
if (isinstance(P, (LaurentSeriesRing, LazyLaurentSeriesRing,
LaurentPolynomialRing_generic,
PowerSeriesRing_generic, LazyPowerSeriesRing,
Expand Down

0 comments on commit 20ac0fb

Please sign in to comment.