| > | restart; |
L-10 MCS 320 Wednesday 14 September 2005
1 Univariate Polynomials
| > | p := sum('c||i*x^i','i'=0..5); # general quintic |
| > | degree(p,x); # do not forget to specify the variable |
| > | coeff(p,x,3); # the coefficient with x^3 |
| > | coeffs(sort(p,x),x); |
| > | randomize(2): # initializes the seed |
| > | r := randpoly(x,degree=5); |
| > | d := x+1; |
| > | r1:= rem(r,d,x); |
| > | q := quo(r,d,x,'rest'); |
| > | rest; |
To verify our calculations, we can compute q*d + r1 = r
| > | q*d + r1 = r; |
By default, Maple does not expand, we have to ask it:
| > | expand(lhs(%)) = r; |
The opposite command to the expand, is the factor:
| > | factor(r); |
Over the rational numbers, Maple does not find a factorization.
| > | Factor(r) mod 2; |
If we change our field, say, here to the binary numbers {0,1}, then r factors.
| > | factor(r,complex); |
This is the numerical factorization over the field of complex numbers. According to the fundamental theorem of algebra, every polynomial of degree d has d complex roots.
| > | fsolve(r,x,complex); |
The numerical factorization corresponds to the numerical root finding problem, the f in the fsolve stands for floating-point arithmetic.
Let us do it by hand:
| > | alias(alpha=RootOf(r)); |
| > | d := x - alpha; |
| > | q := quo(r,d,x,'rest'); |
| > | evala(q*d + rest) = r; |
| > | factor(q); |
| > | alias(beta=RootOf(q)); |
| > | d1 := x - beta; |
| > | q1 := quo(q,d1,x,'rest'); |
![]()
| > | evala(q1*d1 + rest) = q; |
![]()
| > | f := d*d1*q1; |
![]()
The symbolic factorization of a polynomial consists in adding sufficiently many formal roots to the number field. What is nice is that Maple can switch to the numerical factorization:
| > | a := evalf(alpha); b := evalf(beta); |
| > | subs(x=a,r); subs(x=b,r); |
The symbolic factorization in a more common form:
| > | p := x^2 - 2; |
| > | factor(p); |
| > | evala(AFactor(p)); |
| > | convert(%,radical); |
The third factorization is the exact factorization
| > | factor(x^2 - 1); |
For this simple example, the numeric, symbolic factorization coincide.
2 Multivariate Polynomials
The absolute factorization extends to the multivariate polynomials:
| > | p := x^2 - 2*y^2; |
| > | factor(p); |
| > | evala(AFactor(p)); |
An absolute factorization means: factoring over the complex numbers.
| > | convert(%,radical); |
This is the more common symbolic form of the factorization.
The plot below shows the geometric meaning of the absolute factorization: if it factors over the complex numbers, then the curve defined by the polynomial consists of several pieces. In this case, the curve defined by p(x,y) = 0 degenerates in two lines.
| > | plots[implicitplot](p,x=-2..2,y=-2..2,numpoints=1000); |
![[Plot]](images/lec10_42.gif)
We may see multivariate polynomials as polynomials in one variable:
| > | r := randpoly([x,y,z],degree=3,dense); |
![]()
| > | collect(r,x); |
![]()
| > | collect(r,[x,z]); |
![]()
The output of the last command shows our multivariate polynomial as a polynomial in x,
with coefficients as polynomials in y and z. The coefficient are polynomials in z, with coefficients as polynomials in y.
| > |