File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -751,6 +751,14 @@ cdef class LaurentSeries(AlgebraElement):
751
751
t^-3 + t^3 + O(t^9)
752
752
753
753
ALGORITHM: Shift the unit parts to align them, then add.
754
+
755
+ TESTS:
756
+
757
+ Verify that :trac:`35860` is fixed::
758
+
759
+ sage: R.<t> = LaurentPolynomialRing(ZZ)
760
+ sage: sqrt(t^2) + t^-1
761
+ t^-1 + t
754
762
"""
755
763
cdef LaurentSeries right = < LaurentSeries> right_m
756
764
cdef long m
Original file line number Diff line number Diff line change @@ -1988,6 +1988,12 @@ cdef class Polynomial(CommutativePolynomial):
1988
1988
False
1989
1989
sage: R(0).is_square()
1990
1990
True
1991
+
1992
+ Make sure :trac:`35860` is fixed::
1993
+
1994
+ sage: S.<x> = PolynomialRing(ZZ)
1995
+ sage: is_square(S(1), True)[1].parent()
1996
+ Univariate Polynomial Ring in x over Integer Ring
1991
1997
"""
1992
1998
if self .is_zero():
1993
1999
return (True , self ) if root else True
@@ -2000,7 +2006,7 @@ cdef class Polynomial(CommutativePolynomial):
2000
2006
u = self ._parent.base_ring()(f.unit())
2001
2007
2002
2008
if all (a[1 ] % 2 == 0 for a in f) and u.is_square():
2003
- g = u.sqrt()
2009
+ g = self ._parent( u.sqrt() )
2004
2010
for a in f:
2005
2011
g *= a[0 ] ** (a[1 ] // 2 )
2006
2012
return (True , g) if root else True
You can’t perform that action at this time.
0 commit comments