#10771: gcd and lcm for fraction fields
--------------------------------+-------------------------------------------
   Reporter:  SimonKing         |       Owner:  AlexGhitza             
       Type:  defect            |      Status:  needs_review           
   Priority:  major             |   Milestone:  sage-4.7               
  Component:  basic arithmetic  |    Keywords:  gcd lcm fraction fields
     Author:  Simon King        |    Upstream:  N/A                    
   Reviewer:                    |      Merged:                         
Work_issues:                    |  
--------------------------------+-------------------------------------------
Changes (by newvalueoldvalue):

  * status:  new => needs_review
  * type:  PLEASE CHANGE => defect
  * author:  => Simon King


Comment:

 Without the patch, we had:

 {{{
 sage: gcd(2/1,4)  # does not restrict to ZZ
 1
 sage: lcm(2/1,4)  # Bug
 Traceback (most recent call last):
 ...
 TypeError: Argument 'other' has incorrect type (expected
 sage.rings.rational.Rational, got sage.rings.integer.Integer)
 sage: R.<x> = QQ[]
 sage: lcm(1/(x+1),1/(x+1)^2) # note that the error message names gcd, not
 lcm!
 Traceback (most recent call last):
 ...
 TypeError: unable to find gcd of 1/(x + 1) and 1/(x^2 + 2*x + 1)
 sage: gcd(1/(x+1),1/(x+1)^2)
 Traceback (most recent call last):
 ...
 TypeError: unable to find gcd of 1/(x + 1) and 1/(x^2 + 2*x + 1)
 sage: gcd(int(2),2/1)
 2
 sage: gcd(2,2/1) # gcd of ints and integers are different
 1
 }}}

 With the patch, one has
 {{{
 sage: gcd(2/1,4)
 2
 sage: lcm(2/1,4)
 4
 sage: R.<x> = QQ[]
 sage: lcm(1/(x+1),1/(x+1)^2)
 1/(x + 1)
 sage: gcd(1/(x+1),1/(x+1)^2)
 1/(x^2 + 2*x + 1)
 sage: gcd(int(2),2/1)
 2
 sage: gcd(2,2/1)
 2
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10771#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to