6.28.10 Solving au+bv=c over polynomials: abcuv
A consequence of Bézout’s identity is that given polynomials
A(x), B(x) and C(x), there exist polynomials U(x) and V(x)
such that
C(x)=U(x)· A(x)+V(x)· B(x)
|
exactly when C(x) is a multiple of the greatest common divisor of
A(x) and B(x). The abcuv command solves this polynomial
equation.
-
abcuv takes three mandatory and one optional
argument:
-
A, B and C, three polynomials given as expressions or
lists of coefficients in decreasing order, where C is a multiple
of the greatest common divisor of A and B.
- Optionally if the polynomials are expressions, x, the
variable (which defaults to x).
- abcuv(A,B,C ⟨ ,x⟩) returns a list of two expressions
[U,V] such that C = U· A + V· B.
Examples.
-
Input:
abcuv(x^2+2*x+1 ,x^2-1,x+1)
Output:
- Input:
abcuv(x^2+2*x+1 ,x^2-1,x^3+1)
Output:
- Input:
abcuv([1,2,1],[1,0,-1],[1,0,0,1])
Output: