Hi Dan,

You're right, this is a bug in the Laurent polynomial ring.  The
underlying cause of the problem is this:


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

I've made this the following ticket:
http://trac.sagemath.org/sage_trac/ticket/3617

--Mike

On Tue, Jul 8, 2008 at 4:02 PM, Daniel Bump <[EMAIL PROTECTED]> wrote:
>
>
> The following appears to me to be a bug. Shouldn't q^(-1) be
> in this Laurent polynomial ring?
>
> Dan
>
> sage: P.<q> = LaurentPolynomialRing(QQ)
> sage: type(q),type(q^(-1))
>
> (<type 'sage.rings.polynomial.laurent_polynomial.LaurentPolynomial_mpair'>,
>  <type 'sage.rings.polynomial.laurent_polynomial.LaurentPolynomial_mpair'>)
> sage: q in P
> True
> sage: q^(-1) in P
> False
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to