Next: Resultants and Discriminants. Up: AM 511b Notes Previous: Polynomials

# Polynomial Algebra and Roots of Polynomials

What follows is a list of Maple routines for manipulation of polynomials.

1. `collect` --- collect like terms of polynomials.
2. `factor` --- factor polynomials over the rationals or certain extension fields.
3. `coeff,coeffs` --- pick off the coefficients of a collected polynomial.
4. `sort` --- sort a polynomial in increasing or decreasing order.
5. `rem,quo` --- compute the remainder and quotient of two polynomials.
6. `discrim` --- compute the discriminant[3] of a polynomial.
7. `resultant` --- compute the resultant of two polynomials.
8. `gcd` --- find the Greatest Common Divisor of two polynomials.
9. `expand` --- expand products of polynomials.

The following session illustrates the usage of these.

```>
> p := randpoly(x);

5       4       3       2
p := - 85 x  - 55 x  - 37 x  - 35 x  + 97 x + 50

> q := randpoly(x);
5       4       3       2
q := 79 x  + 56 x  + 49 x  + 63 x  + 57 x - 59

> p + q;
5    4       3       2
- 6 x  + x  + 12 x  + 28 x  + 154 x - 9

> p*q;
5       4       3       2
(- 85 x  - 55 x  - 37 x  - 35 x  + 97 x + 50)

5       4       3       2
(79 x  + 56 x  + 49 x  + 63 x  + 57 x - 59)

> expand(");
10         9          8         4         5         3
- 2873 x - 6715 x   - 9105 x  - 10168 x  + 6484 x  + 7216 x  + 8749 x

2         6          7
+ 10744 x  - 4420 x  - 12887 x  - 2950

> sort(");
10         9          8          7         6         5         4
- 6715 x   - 9105 x  - 10168 x  - 12887 x  - 4420 x  + 7216 x  + 6484 x

3          2
+ 8749 x  + 10744 x  - 2873 x - 2950

> factor(");
5       4       3       2
- (79 x  + 56 x  + 49 x  + 63 x  + 57 x - 59)

5       4       3       2
(85 x  + 55 x  + 37 x  + 35 x  - 97 x - 50)

> rem(p,q,x,'quotient');
415  4   1242  3   2590  2   12508     1065
--- x  + ---- x  + ---- x  + ----- x - ----
79       79        79         79       79

> quotient;
85
- ----
79

> quo(p,q,x,'remainder');
85
- ----
79

> remainder;
415  4   1242  3   2590  2   12508     1065
--- x  + ---- x  + ---- x  + ----- x - ----
79       79        79         79       79

> gcd(p,q);
1

>
> r := randpoly([x,a]);
5       3       2         3
r := 54 - 5 a + 99 x  - 61 x  - 50 x  a - 12 x  a

> collect(r,x);
5                  3       2
99 x  + (- 61 - 12 a) x  - 50 x  a + 54 - 5 a

> coeff(",x,3);  # Pick off the coefficient of x^3.
- 61 - 12 a

> collect(r,a);
2       3               5       3
(- 5 - 50 x  - 12 x ) a + 54 + 99 x  - 61 x

> coeff(",x,3);  # POLYNOMIALS MUST BE COLLECTED IN THE COEFF VARIABLE
Error, unable to compute coeff
> d := discrim(r,x);   # The discriminant is the resultant of r and r'.
6                  5                 4
d := - 99 (- 54 + 5 a) (3590369280 a  - 3433596969024 a  - 192447722160 a

3                   2
+ 21325528435565 a  + 48080023745670 a  - 463897100992680 a

+ 472534194797568)
```

Robert Corless
Wed Feb 28 18:25:56 EST 1996