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
\[\]
a4+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
\[\]
(10a3+11a2+2a-4)b+15a3+10a2+4a-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-12

Type: Expression Integer

rootOf(e^5-2,e)
\[\]
e

Type: Expression Integer

zeroOf(f^5-2,f)
\[\]
25

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,%x1 and %x2 are bound to the first three roots of x**4+1.

%x0^5
\[\]
-%x0

Type: Expression Integer

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

definingPolynomial %x0
\[\]
%x04+1

Type: Expression Integer

definingPolynomial %x1
\[\]
%x12+1

Type: Expression Integer

definingPolynomial %x2
\[\]
-%x2+%%var

Type: Expression Integer

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

x3 := last l
\[\]
-%x0%x1

Type: Expression Integer

%x0 + %x1 + %x2 + x3
\[\]
(-%x0+1)%x1+%x0+%x2

Type: Expression Integer

%x0 * %x1 * %x2 * x3
\[\]
%x2%x02

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+12,-1-12,–1-12,–1+12]

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
\[\]
%%var2+1

Type: Expression Integer