pgcd ( p q -- a d )
Polynomials

Prev:p/mod ( p q -- z w )
Next:polyval ( x p -- p[x] )


Vocabulary
math.polynomials

Inputs
pa polynomial
qa polynomial


Outputs
aa polynomial
da polynomial


Word description
Computes the greatest common divisor d of p and q, and another value a satisfying:
a*q = d mod p


Notes
GCD in the case of polynomials is a monic polynomial of the highest possible degree that divides into both p and q.

Examples
USING: kernel math.polynomials prettyprint ; { 1 1 1 1 } { 1 1 } pgcd [ . ] bi@
{ 0 0 } { 1 1 }


Definition