#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:  Marco Streng      |      Merged:                         
Work_issues:                    |  
--------------------------------+-------------------------------------------
Changes (by SimonKing):

 * cc: burcin (added)
  * status:  needs_work => needs_review


Comment:

 With the new patch, all tests pass for me. The behaviour is now (mutatis
 mutandis for lcm):

  * If `ZZ` is a subring of a field F that is not a fraction field then
 `a.gcd(b)` first tests if a and b can be converted into `ZZ`. If it is the
 case, their gcd in `ZZ` ''as element of `ZZ`'' is returned. This is not
 nice, but it is compatible with the "unpatched" behaviour of Sage and is
 assumed in some other parts of Sage:
  {{{
 # unpatched!
 sage: gcd(RR(1),RR(1))
 1
 sage: _.parent()
 Integer Ring
  }}}

  * If `ZZ` is no subring of F or conversion fails then `a.gcd(b)` returns
 `F(0)` or `F(1)`. This is, e.g., the case for `gcd(CC(2),CC(2))`, since
 `CC(2)` can not be converted into `ZZ`.

  * a.gcd(b) only raises an error if `b` can not be converted into
 `a.parent()`.

  * gcd and lcm in fraction fields of a unique factorization domain R
 restrict to R, and moreover they satisfy `gcd(a,b)*lcm(a,b)==a*b` up to
 multiplication with a unit of R.

 There is a price to pay, and that's why I put Burcin on Cc:

 The distribution of minus signs in symbolic expression changes, apparently
 since now gcd raises no errors in examples like the following:
 {{{
 sage: (I - 1/3*sqrt(2))^2
 1/9*(-sqrt(2) + 3*I)^2
 # Without patch, we would get
 # 1/9*(sqrt(2) - 3*I)^2
 }}}

 The question is whether a changed minus sign distribution is such a
 serious thing.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10771#comment:21>
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