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

LarentPolynomial.__call__ is broken for Laurent polynomial's that have negative exponents #3617

Closed
mwhansen opened this issue Jul 8, 2008 · 6 comments

Comments

@mwhansen
Copy link
Contributor

mwhansen commented Jul 8, 2008

sage: P.<q> = LaurentPolynomialRing(QQ)
sage: qi = q^(-1)
sage: qi in P
False
sage: q in P
True
sage: P(qi)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/home/mike/<ipython console> in <module>()

/opt/sage/local/lib/python2.5/site-packages/sage/rings/polynomial/laurent_polynomial_ring.py in __call__(self, x)
    679             sage: L(1/2)
    680             1/2
    681         """
--> 682         return LaurentPolynomial_mpair(self, x)
    683     

/home/mike/laurent_polynomial.pyx in sage.rings.polynomial.laurent_polynomial.LaurentPolynomial_mpair.__init__ (sage/rings/polynomial/laurent_polynomial.c:1889)()

/home/mike/multi_polynomial_libsingular.pyx in sage.rings.polynomial.multi_polynomial_libsingular.MPolynomialRing_libsingular.__call__ (sage/rings/polynomial/multi_polynomial_libsingular.cpp:5984)()

/opt/sage/local/lib/python2.5/site-packages/sage/rings/rational_field.py in __call__(self, x, base)
    216             return x
    217 
--> 218         return sage.rings.rational.Rational(x, base)
    219         
    220     def construction(self):

/home/mike/rational.pyx in sage.rings.rational.Rational.__init__ (sage/rings/rational.c:3321)()

/home/mike/rational.pyx in sage.rings.rational.Rational.__set_value (sage/rings/rational.c:4494)()

TypeError: Unable to coerce q^-1 (<type 'sage.rings.polynomial.laurent_polynomial.LaurentPolynomial_mpair'>) to Rational

Component: commutative algebra

Author: Mike Hansen

Reviewer: Sebastian Pancratz

Merged: sage-4.3.2.alpha0

Issue created by migration from https://trac.sagemath.org/ticket/3617

@mwhansen
Copy link
Contributor Author

Author: Mike Hansen

@mwhansen
Copy link
Contributor Author

comment:2

This also fixes #5468.

@mwhansen
Copy link
Contributor Author

Attachment: trac_3617.patch.gz

@sagetrac-spancratz
Copy link
Mannequin

sagetrac-spancratz mannequin commented Jan 20, 2010

comment:3

This seems fine to me, and applies and passes all doctests on 4.3.

Sebastian

@sagetrac-spancratz
Copy link
Mannequin

sagetrac-spancratz mannequin commented Jan 20, 2010

Reviewer: Sebastian Pancratz

@sagetrac-mvngu
Copy link
Mannequin

sagetrac-mvngu mannequin commented Jan 23, 2010

Merged: sage-4.3.2.alpha0

@sagetrac-mvngu sagetrac-mvngu mannequin closed this as completed Jan 23, 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants