Ticket #2952 (new defect)

Opened 8 months ago

Last modified 3 months ago

[with patch, needs work] LaurentPolynomialRing coercion error

Reported by: mhansen Assigned to: roed
Priority: critical Milestone: sage-3.2.2
Component: coercion Keywords:
Cc:

Description

Currently

sage: R.<q>=QQ[]
sage: L.<x,y,z> = LaurentPolynomialRing(R)
sage: f=(x+y+z^-1)^2
sage: f.substitute(z=1)

gives an error because it PolynomialRing? isn't imported categories/pushout.py for the Laurent functor.

Once, that it is fixed, the above commands give a coercion error between the fraction field of QQq? and the Laurent polynomial ring over QQq?

Attachments

2952.2.patch (12.3 kB) - added by roed on 04/21/2008 03:27:10 AM.

Change History

04/20/2008 07:34:54 PM changed by was

  • milestone changed from sage-3.0 to sage-3.0.1.

04/21/2008 03:27:10 AM changed by roed

  • attachment 2952.2.patch added.

04/21/2008 03:28:12 AM changed by roed

  • summary changed from LaurentPolynomialRing coercion error to [with-patch; needs review] LaurentPolynomialRing coercion error.

04/25/2008 06:50:45 PM changed by mhansen

  • summary changed from [with-patch; needs review] LaurentPolynomialRing coercion error to LaurentPolynomialRing coercion error.

04/25/2008 06:51:10 PM changed by mhansen

The patch doesn't work. We'll wait on this until the new coercion framework goes in.

09/13/2008 07:32:46 PM changed by mabshoff

  • summary changed from LaurentPolynomialRing coercion error to [with patch, needs work] LaurentPolynomialRing coercion error.

This is still broken and the new coercion framework has been merged:

| SAGE Version 3.1.2.rc2, Release Date: 2008-09-12                   |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------

sage: R.<q>=QQ[]
sage: L.<x,y,z> = LaurentPolynomialRing(R)
sage: 
sage: f=(x+y+z^-1)^2
sage: f.substitute(z=1)
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/<ipython console> in <module>()

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/element.pyx in sage.structure.element.Element.substitute (sage/structure/element.c:3756)()

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/laurent_polynomial.pyx in sage.rings.polynomial.laurent_polynomial.LaurentPolynomial_mpair.subs (sage/rings/polynomial/laurent_polynomial.c:6666)()

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/element.pyx in sage.structure.element.RingElement.__imul__ (sage/structure/element.c:9590)()

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/coerce.c:6008)()

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.get_action (sage/structure/coerce.c:9310)()

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.discover_action (sage/structure/coerce.c:10441)()

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/coerce.pyx in sage.structure.coerce.CoercionModel_cache_maps.discover_action (sage/structure/coerce.c:10088)()

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/parent.pyx in sage.structure.parent.Parent.get_action (sage/structure/parent.c:8569)()

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/parent_old.pyx in sage.structure.parent_old.Parent._get_action_ (sage/structure/parent_old.c:5963)()

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/parent_old.pyx in sage.structure.parent_old.Parent.get_action_c (sage/structure/parent_old.c:2264)()

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/parent_old.pyx in sage.structure.parent_old.Parent.get_action_impl (sage/structure/parent_old.c:2481)()

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/parent_old.pyx in sage.structure.parent_old.Parent.get_action_c_impl (sage/structure/parent_old.c:3341)()

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/coerce_actions.pyx in sage.structure.coerce_actions.ModuleAction.__init__ (sage/structure/coerce_actions.c:3706)()

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/local/lib/python2.5/site-packages/sage/categories/pushout.py in pushout(R, S)
    437         if len(Sc) == 0:
    438             c = Rc.pop()
--> 439             Z = c(Z)
    440         elif len(Rc) == 0:
    441             c = Sc.pop()

/scratch/mabshoff/release-cycle/sage-3.1.2.rc3/local/lib/python2.5/site-packages/sage/categories/pushout.py in __call__(self, R)
    136             return LaurentPolynomialRing(R.base_ring(), (list(R.variable_names()) + [self.var]))
    137         else:
--> 138             return PolynomialRing(R, self.var)
    139     def __cmp__(self, other):
    140         c = cmp(type(self), type(other))

NameError: global name 'PolynomialRing' is not defined
sage: 

It seems that David's patch is not the right solution, so can someone come up with a better patch?

Cheers,

Michael