]>
Book Contents Previous Section 8.2 Polynomial Factorization Next Section 8.4 Computation of Eigenvalues and Eigenvectors Book Index

## 8.3 Manipulating Symbolic Roots of a Polynomial

In this section we show you how to work with one root or all roots root:symbolic of a polynomial. These roots are represented symbolically (as opposed to being numeric approximations). See ugxProblemOnePol and ugxProblemPolSys for information about solving for the roots of one or more polynomials.

### 8.3.1 Using a Single Root of a Polynomial

Use rootOf to get a symbolic root of a polynomial: rootOf(p,x) returns a root of p(x).

This creates an algebraic number a. algebraic number number:algebraic

a := rootOf(a**4+1,a)

a

Type: Expression Integer

To find the algebraic relation that defines a, use definingPolynomial.

definingPolynomial a

a 4+1

Type: Expression Integer

You can use a in any further expression, including a nested rootOf.

b := rootOf(b**2-a-1,b)

b

Type: Expression Integer

Higher powers of the roots are automatically reduced during calculations.

a + b

b+a

Type: Expression Integer
% ** 5

(10 a 3+11 a 2+2 a-4)b+15 a 3+10 a 2+4 a-10

Type: Expression Integer

The operation zeroOf is similar to rootOf, except that it may express the root using radicals in some cases. radical

rootOf(c**2+c+1,c)

c

Type: Expression Integer
zeroOf(d**2+d+1,d)

-3-1 2

Type: Expression Integer
rootOf(e**5-2,e)

e

Type: Expression Integer
zeroOf(f**5-2,f)

2 5

Type: Expression Integer

### 8.3.2 Using All Roots of a Polynomial

Use rootsOf to get all symbolic roots of a polynomial: rootsOf(p,x) returns a list of all the roots of p(x). If p(x) has a multiple root of order n, then that root root:multiple appears n times in the list. Make sure these variables are x0 etc.

Compute all the roots of x**4+1.

l := rootsOf(x**4+1,x)

[ % x0 , % x0 % x1 , - % x0 , - % x0 % x1 ]

Type: List Expression Integer

As a side effect, the variables % x0 and % x1 are bound to the first two roots of x * * 4 + 1 .

%x0**5

- % x0

Type: Expression Integer

Although they all satisfy x * * 4 + 1 = 0 , % x0 and % x1 are different algebraic numbers. To find the algebraic relation that defines each of them, use definingPolynomial.

definingPolynomial %x0

% x0 4 + 1

Type: Expression Integer
definingPolynomial %x1

% x1 2 + 1

Type: Expression Integer
[t1:=l.1, t2:=l.2, t3:=l.3, t4:=l.4]

[ % x0 , % x0 % x1 , - % x0 , - % x0 % x1 ]

Type: List Expression Integer

We can check that the sum and product of the roots of x * * 4 + 1 are its trace and norm.

t1+t2+t3+t4
0
Type: Expression Integer
t1*t2*t3*t4
1
Type: Expression Integer

Corresponding to the pair of operations rootOf/ zeroOf in ugxProblemOnePol , there is an operation zerosOf that, like rootsOf, computes all the roots of a given polynomial, but which expresses some of them in terms of radicals.

zerosOf(y**4+1,y)

[-1+1 2,-1-1 2,--1-1 2,--1+1 2]

Type: List Expression Integer

As you see, only one implicit algebraic number was created ( %y1), and its defining equation is this. The other three roots are expressed in radicals.

definingPolynomial %y1

%%var 2+1

Type: Expression Integer
Book Contents Previous Section 8.2 Polynomial Factorization Next Section 8.4 Computation of Eigenvalues and Eigenvectors Book Index