On 05/14/2017 07:22 PM, Bill Page wrote:
> 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.
Why? As a mathematician, I wouldn't expect that. And as a computer
scientist, keeping that relation in general, just means overhead in
computation time. So I don't see why your suggestion would be a good
choice. Note that (in contrast to SAGE) FriCAS has no duck typing.
> 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 (*)
But relation (*) is exactly what is implemented in Fraction(R).
Ralf
=========================================================
(1) -> Z==>Integer
(2) -> Q==>Fraction Z
(3) -> q1:Q := 3/4
3
(3) -
4
Type: Fraction(Integer)
(4) -> q2:Q := 7/5
7
(4) -
5
Type: Fraction(Integer)
(5) -> gcd(q1,q2)
(5) 1
Type: Fraction(Integer)
(6) -> lcm(q1,q2)
21
(6) --
20
Type: Fraction(Integer)
(7) -> gcd(q1,q2)*lcm(q1,q2) - q1*q2
(7) 0
--
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.