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

GCD and types

Types help to make it clear where the computation happens.

Let's first start with a few abbreviations.

fricas
(1) -> P(R,x)==>UnivariatePolynomial(x,R);
Type: Void
fricas
Z==>Integer;
Type: Void
fricas
Q==>Fraction Z;
Type: Void

Now we compute the gcd in

Z[x][y] 

fricas
p11: P(P(Z, x), y) := 12*x^2*y;
fricas
p12: P(P(Z, x), y) := 18*x*y^2;
fricas
gcd(p11, p12)

\label{eq1}6 \  x \  y(1)

Now in

Q[x][y] 

fricas
p21: P(P(Q, x), y) := 12*x^2*y;
Type: UnivariatePolynomial(y,UnivariatePolynomial(x,Fraction(Integer)))
fricas
p22: P(P(Q, x), y) := 18*x*y^2;
Type: UnivariatePolynomial(y,UnivariatePolynomial(x,Fraction(Integer)))
fricas
gcd(p21, p22)

\label{eq2}x \  y(2)
Type: UnivariatePolynomial(y,UnivariatePolynomial(x,Fraction(Integer)))

In

Q(x)[y] 

fricas
p31: P(Fraction P(Q, x), y) := 12*x^2*y;
Type: UnivariatePolynomial(y,Fraction(UnivariatePolynomial(x,Fraction(Integer))))
fricas
p32: P(Fraction P(Q, x), y) := 18*x*y^2;
Type: UnivariatePolynomial(y,Fraction(UnivariatePolynomial(x,Fraction(Integer))))
fricas
gcd(p31, p32)

\label{eq3}y(3)
Type: UnivariatePolynomial(y,Fraction(UnivariatePolynomial(x,Fraction(Integer))))

And finally in the field

Q(x)(y) 

fricas
p41: Fraction P(P(Q, x), y) := 12*x^2*y;
Type: Fraction(UnivariatePolynomial(y,UnivariatePolynomial(x,Fraction(Integer))))
fricas
p42: Fraction P(P(Q, x), y) := 18*x*y^2;
Type: Fraction(UnivariatePolynomial(y,UnivariatePolynomial(x,Fraction(Integer))))
fricas
gcd(p41, p42)

\label{eq4}1(4)
Type: Fraction(UnivariatePolynomial(y,UnivariatePolynomial(x,Fraction(Integer))))




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