Opened 11 years ago

Closed 11 years ago

incorrect sage exponentiation in interreduced_basis '^' vs '**'

Reported by: Owned by: lftabera AlexGhitza major sage-4.3 algebra interreduced_basis sage-4.3.rc1 Luis Felipe Tabera John Cremona N/A

Description

There is a bug in the code of interreduced_basis in

sage/rings/polynomial/multi_polynomial_ideal.py

```sage: R=QQ['t'].fraction_field()['x,y']
sage: R.inject_variables()
Defining x, y
sage: I=x*R
sage: I.interreduced_basis()
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)

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

/opt/SAGE/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in wrapper(*args, **kwds)
362         """
363         with RedSBContext():
--> 364             return func(*args, **kwds)
365
366     from sage.misc.sageinspect import sage_getsource

/opt/SAGE/sage/local/lib/python2.6/site-packages/sage/rings/polynomial/multi_polynomial_ideal.pyc in interreduced_basis(self)
1542                 for f in self._singular_().interred():
1543                     f = R(f)
-> 1544                     ret.append(f.lc()^(-1)*f) # lead coeffs are not reduced by interred
1545                 s.option("set",o)
1546             except TypeError:

/opt/SAGE/sage/local/lib/python2.6/site-packages/sage/structure/element.so in sage.structure.element.Element.__xor__ (sage/structure/element.c:4469)()

RuntimeError: Use ** for exponentiation, not '^', which means xor
in Python, and has the wrong precedence.

```

Changed 11 years ago by lftabera

Patch to correct the problem and a test case

comment:1 Changed 11 years ago by lftabera

• Status changed from new to needs_review

comment:2 Changed 11 years ago by cremona

• Keywords python removed
• Report Upstream changed from Not yet reported upstream; Will do shortly. to N/A
• Reviewers set to John Cremona
• Status changed from needs_review to positive_review

Looks good, applies to 4.3.rc0, tests pass and it has a relevant doctest.

comment:3 Changed 11 years ago by mhansen

• Merged in set to sage-4.3.rc1
• Resolution set to fixed
• Status changed from positive_review to closed

comment:4 Changed 11 years ago by mvngu

• Summary changed from [with patch] incorrect sage exponentiation in interreduced_basis '^' vs '**' to incorrect sage exponentiation in interreduced_basis '^' vs '**'
Note: See TracTickets for help on using tickets.