On 14 May 2017 at 09:25, Ralf Hemmecke <[email protected]> wrote:
> On 05/13/2017 07:13 PM, Bill Page wrote:
>> By default Fraction always returns a gcd of 1.
>>
>> (1) -> gcd(1/3,1/4)
>>
>>    (1)  1
>>                                                       Type: Fraction(Integer)
>>
>> But gcd is well defined provided that the underlying domain has GcdDomain.
>
>> +        gcd(x:%,y:%):% == gcd(x.num,y.num)/lcm(x.den,y.den)
>
> Mathematically, if the arguments ar non-zero, any non-zero value will do
> as gcd, but 1 seems a canonical choice in case of a field. Why would you
> want do waste time with computation (in the general case) if just
> returning a constant is as good as any other value?
>

Algebraically some choices are better than others.  In particular it
seems desirable that

  Q := Fraction R
  gcd(n,m) = retract gcd(n::Q, m::Q)

for all n and m in R.

BTW, I neglected to include a revised definition of 'lcm' in my patch

  lcm(x:%,y:%):% == lcm(x.num,y.num)/gcd(x.den,y.den)

since obviously we also need

  gcd(x,y)*lcm(x,y) = x*y

See ref. for example in Sage https://trac.sagemath.org/ticket/10771

Bill Page.

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to