#10771: gcd and lcm for fraction fields
--------------------------------+-------------------------------------------
Reporter: SimonKing | Owner: AlexGhitza
Type: defect | Status: needs_work
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: |
--------------------------------+-------------------------------------------
Comment(by lftabera):
Replying to [comment:7 SimonKing]:
> I just updated my patch, and I hope it addresses all your remarks. The
typos are fixed, the old gcd of the rational field is now removed, and: I
also added gcd/lcm for general fields. I am sorry that this makes #9819 a
duplicate.
Please.
> And I hope that I did not confuse gcd and lcm in the following setting:
> {{{
> sage: GF(2)(1).gcd(GF(2)(1))
> 1
> sage: GF(2)(1).gcd(GF(2)(0))
> 1
> sage: GF(2)(0).gcd(GF(2)(0))
> 0
> sage: GF(2)(1).lcm(GF(2)(0))
> 0
> sage: GF(2)(1).lcm(GF(2)(1))
> 1
> }}}
> That's implemented as element methods for the category of `Fields()`.
Somehow, the category framework is cool, isn't it?
I do not full understand this, but I am happy that works.
Some thoughts:
For QQ and the like, could it be that gcd and lcm should only take care of
coercing to a good setting and then the real algorithm should be in _lcm,
_gcd? Note that QQ already has ._gcd and ._lcm so these methods has to be
taken into account.
For generic Fields, It should appear in the documentation that the methods
return 0 if both arguments are zero and a non-zero element otherwise. The
user should not suppose that the non-zero element is actually one, since
this is changed by subclasses.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10771#comment:11>
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.