Hi Andrey,

On 11 Feb., 15:59, Andrey Novoseltsev <novos...@gmail.com> wrote:
> > sage: (1/4).content(1/6)
> > 1/12
>
> Which agrees with what I have suggested before - gcd "analog" for
> fields should have some other name. After all, since any rational
> number is divisible by any non-zero, how can we pick "the greatest" of
> them all? For ZZ the notion of greatness agrees with the usual
> understanding of greater...

The term "greatest" may be in the background of the original
definition for the gcd in ZZ, but it is quite common in math that the
generalisation of a notion (like "gcd(a,b) in a PID is defined to be a
generator of the principal ideal generated by a and b") has not much
to do with the original formulation (like "gcd(a,b) in ZZ is the
greatest integer that divides both a and b").

> How about such an approach:
> 1) if gcd got elements of a fraction field, e.g. (2/1, 4), it tries to
> convert them to the ring of intergers and compute the gcd there (and
> lcm too)

The suggestion is to define gcd in QQ (and, more general, in fraction
fields of a PID) such that it is not needed to try and convert 2/1 to
an integer. I gave a possible approach in a previous post.

> 2) if it fails, raise an exception

Why an exception? If the elements are in a field that is not the
fraction field of a PID, it is totally fine that gcd(a,b) returns 0 if
one of a,b is zero, and returns 1 otherwise.

I hope the whole discussion is not "painting a bike shed"...

Cheers,
Simon

-- 
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