On 26 July 2011 15:00, Cliff Reiter <[email protected]> wrote:
> Consider the Euclidean model for gcd. It appears to model +.
> reasonably for (positive) nice numbers. It nears comparison tolerance
> for naughty numbers.
> Best, Cliff
>
>    gcd=:4 : 0
> r0=.x
> r1=.y
> ......................

As the use of <. is incorporated in | (residue), a somewhat simpler definition
of the Euclidean gcd suffices:

gcd=. 4 : 0
  while. 0~:y do.  'x y'=. y,y|x end.
  x
)

However, there are more interesting points to consider.

-- What is the meaning (in GCD) of the word `greatest' when the
   arguments are complex numbers? (Perhaps `greatest' then is
   related to the magnitude of the complex number, but then there
   may not be a unique `greatest' number.)

-- Is the above model of GCD the one implemented in +.?  Is this
   the only reasonable model?  In particular, what if the notions of
   `integer quotient' and `residue' -- and therefore of GCD -- are
   based not on <. but something else?

-- What properties does +. exhibit for complex (even integer or rational)
   and floating-point arguments? (And through this, what are the valuable
   uses of GCD with such arguments?)

The article of Eugene McDonnell that Roger referred to only considers
part of these questions.  A more detailed study of the field is:

http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.47.1389
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to