login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

fricas
R := Integer

\label{eq1}\hbox{\axiomType{Integer}\ }(1)
Type: Type
fricas
Q := Fraction R

\label{eq2}\hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Integer}\ })(2)
Type: Type
fricas
gcd(8,4) = retract gcd(8::Q, 4::Q)

\label{eq3}4 = 1(3)
Type: Equation(PositiveInteger)

fricas
a:=13/6

\label{eq4}{13}\over 6(4)
Type: Fraction(Integer)
fricas
b:=3/4

\label{eq5}3 \over 4(5)
Type: Fraction(Integer)

fricas
g:=gcd(a,b)

\label{eq6}1(6)
Type: Fraction(Integer)
fricas
l:=lcm(a,b)

\label{eq7}{13}\over 8(7)
Type: Fraction(Integer)
fricas
g*l = a*b

\label{eq8}{{13}\over 8}={{13}\over 8}(8)
Type: Equation(Fraction(Integer))

fricas
gcd2(x:Q,y:Q):Q == gcd(retract numerator x, retract numerator y)$R / lcm(retract denominator x, retract denominator y)$R
Function declaration gcd2 : (Fraction(Integer),Fraction(Integer)) -> Fraction(Integer) has been added to workspace.
Type: Void
fricas
lcm2(x:Q,y:Q):Q == lcm(retract numerator x, retract numerator y)$R / gcd(retract denominator x, retract denominator y)$R
Function declaration lcm2 : (Fraction(Integer),Fraction(Integer)) -> Fraction(Integer) has been added to workspace.
Type: Void

fricas
g:=gcd2(a,b)
fricas
Compiling function gcd2 with type (Fraction(Integer),Fraction(
      Integer)) -> Fraction(Integer)

\label{eq9}1 \over{12}(9)
Type: Fraction(Integer)
fricas
l:=lcm2(a,b)
fricas
Compiling function lcm2 with type (Fraction(Integer),Fraction(
      Integer)) -> Fraction(Integer)

\label{eq10}{39}\over 2(10)
Type: Fraction(Integer)
fricas
g*l = a*b

\label{eq11}{{13}\over 8}={{13}\over 8}(11)
Type: Equation(Fraction(Integer))

fricas
gcd3(x:Q,y:Q):Q == gcd(retract numerator x * retract denominator y, retract numerator y * retract denominator x)$R / (retract denominator x * retract denominator y)$R
Function declaration gcd3 : (Fraction(Integer),Fraction(Integer)) -> Fraction(Integer) has been added to workspace.
Type: Void
fricas
lcm3(x:Q,y:Q):Q == lcm(retract numerator x * retract denominator y, retract numerator y * retract denominator x)$R / (retract denominator x * retract denominator y)$R
Function declaration lcm3 : (Fraction(Integer),Fraction(Integer)) -> Fraction(Integer) has been added to workspace.
Type: Void

fricas
g:=gcd3(a,b)
fricas
Compiling function gcd3 with type (Fraction(Integer),Fraction(
      Integer)) -> Fraction(Integer)

\label{eq12}1 \over{12}(12)
Type: Fraction(Integer)
fricas
l:=lcm3(a,b)
fricas
Compiling function lcm3 with type (Fraction(Integer),Fraction(
      Integer)) -> Fraction(Integer)

\label{eq13}{39}\over 2(13)
Type: Fraction(Integer)
fricas
g*l = a*b

\label{eq14}{{13}\over 8}={{13}\over 8}(14)
Type: Equation(Fraction(Integer))

fricas
gcd2(0,0)

\label{eq15}0(15)
Type: Fraction(Integer)
fricas
lcm2(0,0)

\label{eq16}0(16)
Type: Fraction(Integer)

gcd in fraction fields thread --Bill Page, Tue, 23 May 2017 20:22:26 +0000 reply
Ralf suggested this version:

fricas
fractionGcd(x,y) == gcd(numer x, numer y) / lcm(denom x, denom y)
Type: Void
fricas
a:=13/6

\label{eq1}{13}\over 6(1)
Type: Fraction(Integer)
fricas
b:=3/4

\label{eq2}3 \over 4(2)
Type: Fraction(Integer)
fricas
fractionGcd(a,b)
fricas
Compiling function fractionGcd with type (Fraction(Integer),Fraction
      (Integer)) -> Fraction(Integer)

\label{eq3}1 \over{12}(3)
Type: Fraction(Integer)




  Subject:   Be Bold !!
  ( 13 subscribers )  
Please rate this page: