gcd - Maple Help

MTM

 gcd
 greatest common divisor of polynomials

 Calling Sequence gcd(A, B) gcd(A, B, x) [g, s, t] = gcd(A, B) [g, s, t] = gcd(A, B, x)

Parameters

 A - array or expression B - array or expression x - variable

Description

 • The gcd function computes the greatest common divisor of two polynomials A and B.
 • The optional argument x specifies the dependant variable.  If unspecified, findsym(A,1) or findsym(B,1) is used (whichever returns a non-NULL result first).  Note that if the input polynomials are multivariate then, in general, s and t will be rational functions in variables other than x.
 • The extended Euclidean algorithm is applied by gcd to compute unique polynomials s, t and g in x such that s*A + t*B = g where g is the monic greatest common divisor of A and B. The results computed satisfy degree(s) < degree(B/g) and degree(t) < degree(A/g). The greatest common divisor g is returned as the function value.
 • If A and B are arrays, the gcd(A,B) function computes the element-wise greatest common divisor of A and B.
 • If A is a scalar and B is an array then gcd computes the greatest common divisor of A and each element of B.
 • Arrays A and B must be the same size.

Examples

 > $\mathrm{with}\left(\mathrm{MTM}\right):$
 > $A≔\mathrm{Matrix}\left(2,3,'\mathrm{fill}'=12x\right):$
 > $B≔\mathrm{Matrix}\left(2,3,'\mathrm{fill}'=27xy\right):$
 > $\mathrm{gcd}\left(A,B\right)$
 $\left[\begin{array}{ccc}{x}& {x}& {x}\\ {x}& {x}& {x}\end{array}\right]$ (1)
 > $g,c,d≔\mathrm{gcd}\left(⟨{x}^{3}-10{x}^{2}+31x-30,{x}^{2}-1⟩,⟨{x}^{3}-12{x}^{2}+41x-42,{x}^{2}+2x+1⟩\right)$
 ${g}{,}{c}{,}{d}{≔}\left[\begin{array}{c}{{x}}^{{2}}{-}{5}{}{x}{+}{6}\\ {x}{+}{1}\end{array}\right]{,}\left[\begin{array}{c}\frac{{1}}{{2}}\\ {-}\frac{{1}}{{2}}\end{array}\right]{,}\left[\begin{array}{c}{-}\frac{{1}}{{2}}\\ \frac{{1}}{{2}}\end{array}\right]$ (2)