> Well, I used to use gcd for obtaining the primitive integral vector
> with a specified rational direction. My concern on Trac 3214 was that
> gcd(a1, ..., ak) depended on the order of arguments and I wanted it to
> be fixed. The eventual solution was to agree that gcd as the "greatest
> common divisor" does not really make much sense for fields, but
> instead of raising an exception it can just return 1. This meant that
> I cannot use it for my original purpose (not a big deal - it is easy
> to do more directly), but I think that it was quite a sensible
> decision:
> 1) I don't recall seeing gcd of rational numbers in any book or paper
> 2) there is clearly no natural extension of this notion from ZZ to QQ
> 3) the name itself indeed is very strange applied to fields.
>
> So I personally think that any kind of gcd/lcm combinations of
> numerators/denominators of rational numbers should have some other
> more appropriate names, since making up some conventions for gcd is
> potentially dangerous and may make code using it harder to understand
> if a reader thinks of gcd differently than the original author...
>

I agree that it's a little bit awkward, but I think that we should go with
the maxima/pari/mathematica convention.
* The issue the OP brought up, where gcd silently gave nonsensical issues
when one of the "integers" accidentally got divided by 1 (or you used /
instead of // in a case where you know one is divisible by the other) is
compelling.
* The gcd should be a generator of the fractional ideal generated by the
inputs; the lcm of the intersection as long as that fractional ideal is
principal (if we're in a non-PID or fraction field of a non-PID I think we
should raise an error).  There's an ambiguity about units; we should make a
consistent choice between the PID and its fraction field.  In the case of
integers and rationals, this means we choose the results to be positive and
have the relation
gcd(x,y)*lcm(x,y) = abs(x,y)
as John pointed out.
David

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to