Opened 10 years ago

Closed 10 years ago

# [with patch, with positive review] error in polynomial ideal membership testing

Reported by: Owned by: mhansen mhansen major sage-2.8.15 commutative algebra

### Description

```sage: x^2 in I
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'>        Traceback (most recent call last)

/opt/maple11/lib/<ipython console> in <module>()

/opt/sage/local/lib/python2.5/site-packages/sage/rings/ideal.py in __contains__(self, x)
315         if self.gen().is_zero():
316             return x.is_zero()
--> 317         return self.gen().divides(x)
318
319     def __cmp__(self, other):

<type 'exceptions.AttributeError'>: 'Polynomial_rational_dense' object has no attribute 'divides'
```

### comment:1 Changed 10 years ago by mhansen

```sage: P.<x> = PolynomialRing(QQ)
sage: I = P.ideal(x^2-2)
sage: x^2 in I
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'>        Traceback (most recent call last)

/opt/maple11/lib/<ipython console> in <module>()

/opt/sage/local/lib/python2.5/site-packages/sage/rings/ideal.py in __contains__(self, x)
315         if self.gen().is_zero():
316             return x.is_zero()
--> 317         return self.gen().divides(x)
318
319     def __cmp__(self, other):

<type 'exceptions.AttributeError'>: 'Polynomial_rational_dense' object has no attribute 'divides'
sage: P.<x> = PolynomialRing(ZZ)
sage: I = P.ideal(x^2-2)
sage: x^2 in I
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'>        Traceback (most recent call last)

/opt/maple11/lib/<ipython console> in <module>()

/opt/sage/local/lib/python2.5/site-packages/sage/rings/ideal.py in __contains__(self, x)
315         if self.gen().is_zero():
316             return x.is_zero()
--> 317         return self.gen().divides(x)
318
319     def __cmp__(self, other):

<type 'exceptions.AttributeError'>: 'sage.rings.polynomial.polynomial_integer_dense_ntl' object has no attribute 'divides'
```

### comment:2 Changed 10 years ago by mhansen

• Milestone changed from sage-2.9 to sage-2.8.13
• Owner changed from malb to mhansen
• Status changed from new to assigned
• Summary changed from error in polynomial ideal membership testing to [with patch] error in polynomial ideal membership testing

### comment:3 Changed 10 years ago by ncalexan

• Summary changed from [with patch] error in polynomial ideal membership testing to [with patch, with positive review] error in polynomial ideal membership testing

This patch should be applied -- doctests are excellent and I think the divides() function is good.

There is a typo:

``` 	1624	    def divides(self, x):
1625	        """
1626	        Return True if self divides n.
```

\$n\$ should be \$x\$.

### comment:4 Changed 10 years ago by mabshoff

• Resolution set to fixed
• Status changed from assigned to closed

Merged in 2.8.15.alpha1 - I corrected the documentation as Nick suggested.

Note: See TracTickets for help on using tickets.