[racket-dev] feature request: gcd, lcm for rationals
2011/12/10 Stephen Bloch <sbloch at adelphi.edu>
>
> On Dec 9, 2011, at 3:31 PM, Daniel King wrote:
>
> > On Fri, Dec 9, 2011 at 15:27, Carl Eastlund <cce at ccs.neu.edu> wrote:
> >> What does "divides" even mean in Q? I think we need David to explain
> >> what his extension of GCD and LCM means here, in that "divisors" and
> >> "multiples" are fairly trivial things in Q.
> >
> > I don't suppose to understand all the math on this page, but I think
> > it uses the same definition that dvh is using.
> >
> > http://mathworld.wolfram.com/GreatestCommonDivisor.html
>
> Interesting: the Mathematica people have extended the gcd function from
> the integers to the rationals, not by applying the usual definition of gcd
> to Q (which would indeed be silly, as everything except 0 divides
> everything else), but by coming up with a different definition which, when
> restricted to integers, happens to coincide with the usual definition of
> gcd.
>
If we for rational numbers x and y define "x divides y" to mean "y/x is an
integer",
then I believe the definition
d is a gcd of x and y
<=> i) d divides a and y
ii) e divides x and y => d divides e
coincides with the MathWorld definition.
> I would wonder: is this the ONLY "reasonable" function on rationals which,
> when restricted to integers, coincides with the usual definition of gcd?
>
Not sure, but this seems relevant.
http://trac.sagemath.org/sage_trac/ticket/10771
--
Jens Axel Søgaard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/dev/archive/attachments/20111210/75333269/attachment.html>