Section8.2

]>
Book Contents Previous Section 8.1 Numeric Functions Next Section 8.3 Manipulating Symbolic Roots of a Polynomial Book Index

## 8.2 Polynomial Factorization

The Axiom polynomial factorization polynomial:factorization facilities are available for all polynomial types and a wide variety of coefficient domains. factorization Here are some examples.

### 8.2.1 Integer and Rational Number Coefficients

Polynomials with integer polynomial:factorization:integer coefficients coefficients can be be factored.

v := (4*x**3+2*y**2+1)*(12*x**5-x**3*y+12)

-2 x 3 y 3+(24 x 5+24)y 2+(-4 x 6-x 3)y+48 x 8+12 x 5+48 x 3+12

Type: Polynomial Integer
factor v

-(x 3 y-12 x 5-12)(2 y 2+4 x 3+1)

Type: Factored Polynomial Integer

Also, Axiom can factor polynomials with polynomial:factorization:rational number coefficients rational number coefficients.

w := (4*x**3+(2/3)*x**2+1)*(12*x**5-(1/2)*x**3+12)

48 x 8+8 x 7-2 x 6+35 3 x 5+95 2 x 3+8 x 2+12

Type: Polynomial Fraction Integer
factor w

48(x 3+1 6 x 2+1 4)(x 5-1 24 x 3+1)

Type: Factored Polynomial Fraction Integer

### 8.2.2 Finite Field Coefficients

Polynomials with coefficients in a finite field polynomial:factorization:finite field coefficients can be also be factored. finite field:factoring polynomial with coefficients in

u : POLY(PF(19)) :=3*x**4+2*x**2+15*x+18

3 x 4+2 x 2+15 x+18

Type: Polynomial PrimeField 19

These include the integers mod p, where p is prime, and extensions of these fields.

factor u

3(x+18)(x 3+x 2+8 x+13)

Type: Factored Polynomial PrimeField 19

Convert this to have coefficients in the finite field with 19 3 elements. See ugProblemFinite for more information about finite fields.

factor(u :: POLY FFX(PF 19,3))

3(x+18)(x+5%I 2+3%I+13)(x+16%I 2+14%I+13)(x+17%I 2+2%I+13)

Type: Factored Polynomial FiniteFieldExtension(PrimeField 19,3)

### 8.2.3 Simple Algebraic Extension Field Coefficients

Polynomials with coefficients in simple algebraic extensions polynomial:factorization:algebraic extension field coefficients of the rational numbers can be factored. algebraic number number:algebraic

Here, aa and bb are symbolic roots of polynomials.

aa := rootOf(aa**2+aa+1)

aa

Type: AlgebraicNumber
p:=(x**3+aa**2*x+y)*(aa*x**2+aa*x+aa*y**2)**2

(-aa-1)y 5+((-aa-1)x 3+aa x)y 4+((-2 aa-2)x 2+(-2 aa-2)x)y 3+((-2 aa-2)x 5+(-2 aa-2)x 4+2 aa x 3+2 aa x 2)y 2+((-aa-1)x 4+(-2 aa-2)x 3+(-aa-1)x 2)y+(-aa-1)x 7+(-2 aa-2)x 6-x 5+2 aa x 4+aa x 3

Type: Polynomial AlgebraicNumber

Note that the second argument to factor can be a list of algebraic extensions to factor over.

factor(p,[aa])

(-aa-1)(y+x 3+(-aa-1)x)(y 2+x 2+x)2

Type: Factored Polynomial AlgebraicNumber

This factors x**2+3 over the integers.

factor(x**2+3)

x 2+3

Type: Factored Polynomial Integer

Factor the same polynomial over the field obtained by adjoining aa to the rational numbers.

factor(x**2+3,[aa])

(x-2 aa-1)(x+2 aa+1)

Type: Factored Polynomial AlgebraicNumber

Factor x**6+108 over the same field.

factor(x**6+108,[aa])

(x 3-12 aa-6)(x 3+12 aa+6)

Type: Factored Polynomial AlgebraicNumber
bb:=rootOf(bb**3-2)

bb

Type: AlgebraicNumber
factor(x**6+108,[bb])

(x 2-3 bb x+3 bb 2)(x 2+3 bb 2)(x 2+3 bb x+3 bb 2)

Type: Factored Polynomial AlgebraicNumber

Factor again over the field obtained by adjoining both aa and bb to the rational numbers.

factor(x**6+108,[aa,bb])

(x+(-2 aa-1)bb)(x+(-aa-2)bb)(x+(-aa+1)bb)(x+(aa-1)bb)(x+(aa+2)bb)(x+(2 aa+1)bb)

Type: Factored Polynomial AlgebraicNumber

### 8.2.4 Factoring Rational Functions

Since fractions of polynomials form a field, every element (other than zero) rational function:factoring divides any other, so there is no useful notion of irreducible factors. Thus the factor operation is not very useful for fractions of polynomials.

There is, instead, a specific operation factorFraction that separately factors the numerator and denominator and returns a fraction of the factored results.

factorFraction((x**2-4)/(y**2-4))

(x-2)(x+2)(y-2)(y+2)

Type: Fraction Factored Polynomial Integer

You can also use map. This expression applies the factor operation to the numerator and denominator.

map(factor,(x**2-4)/(y**2-4))

(x-2)(x+2)(y-2)(y+2)

Type: Fraction Factored Polynomial Integer
Book Contents Previous Section 8.1 Numeric Functions Next Section 8.3 Manipulating Symbolic Roots of a Polynomial Book Index