Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#7735 closed defect (fixed)

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

Reported by: lftabera Owned by: AlexGhitza
Priority: major Milestone: sage-4.3
Component: algebra Keywords: interreduced_basis
Cc: Merged in: sage-4.3.rc1
Authors: Luis Felipe Tabera Reviewers: John Cremona
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

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.

Attachments (1)

interreduced.patch (1.4 KB) - added by lftabera 10 years ago.
Patch to correct the problem and a test case

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by lftabera

Patch to correct the problem and a test case

comment:1 Changed 10 years ago by lftabera

  • Status changed from new to needs_review

comment:2 Changed 10 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 10 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 10 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.