## `RootOf` -- the set of roots of a polynomial

#### Introduction

`RootOf(`f, x`)` represents the symbolic set of roots of the polynomial f(x) with respect to the indeterminate x.

#### Call(s)

`RootOf(f, x)`
`RootOf(f)`

#### Parameters

`f` | - | a polynomial, an arithmetical expression representing a polynomial in `x`, or a polynomial equation in `x`
`x` | - | the indeterminate: typically, an identifier or indexed identifier

#### Returns

a symbolic `RootOf` call, i.e., an expression of type `"RootOf"`.

#### Related Functions

`numeric::polyroots`, `poly`, `solve`

#### Details

- `RootOf` serves as a symbolic representation of the zero set of a polynomial. Since it is generally impossible to represent the roots of a polynomial in terms of radicals, `RootOf` is often the only possible way to represent the roots symbolically. `RootOf` mainly occurs in the output of `solve` or related functions; see example 3.
- The parameter `f` must be either a polynomial, or an arithmetical expression representing a polynomial in `x`, or an equation `p=q`, where `p` and `q` are arithmetical expressions representing polynomials in `x`. In the latter case, `RootOf` represents the roots of `p-q` with respect to `x`.
- The polynomial `f` need not be irreducible or even square-free. Even if `f` has multiple roots, `RootOf` represents each of the roots only with multiplicity one.
- If `x` is omitted, then `f` must be an arithmetical expression or polynomial equation containing exactly one indeterminate, and `RootOf` represents the roots with respect to this indeterminate.
- `x` need not be an identifier or indexed identifier: it may be any expression that is neither rational nor constant.
- If `f` contains only one indeterminate, then you can apply `float` to the `RootOf` object to obtain a set of floating-point approximations for all roots; see example 3.

#### Example 1

Each of the following calls represents the roots of the polynomial x^3-x^2 with respect to x, i.e., the set {0, 1}:

    >> RootOf(x^3 - x^2, x), RootOf(x^3 = x^2, x)

                              3    2              3    2
                      RootOf(x  - x , x), RootOf(x  = x , x)

    >> RootOf(x^3 - x^2), RootOf(x^3 = x^2)

                              3    2              3    2
                      RootOf(x  - x , x), RootOf(x  = x , x)

    >> RootOf(poly(x^3 - x^2, [x]), x)

                                        3    2
                                RootOf(x  - x , x)

In general, however, `RootOf` is only used when no explicit symbolic representation of the roots is possible.

#### Example 2

The first argument of `RootOf` may contain parameters:

    >> RootOf(y*x^2 - x + y^2, x)

                                     2        2
                             RootOf(y  - x + x  y, x)

The set of roots of a polynomial is treated like an expression. For example, it may be differentiated with respect to a free parameter. The result is the set of derivatives of the roots; it is expressed in terms of `RootOf`, by giving a minimal polynomial:

    >> diff(%, y)

                                 4      3       2   2      5   2
              RootOf(2 y - x1 + y  + 4 y  x1 - y  x1  + 4 y  x1 , x1)

For reducible polynomials, the result may be a multiple of the correct minimal polynomial.

#### Example 3

`solve` returns `RootOf` objects when the roots of a polynomial cannot be expressed in terms of radicals:

    >> solve(x^5 + x + 7, x)

                                           5
                             RootOf(X1 + X1  + 7, X1)

You can apply the function `float` to obtain floating-point approximations of all roots:

    >> float(%)

          {-1.410813851, - 0.5084694089 + 1.368616488 I,

             - 0.5084694089 - 1.368616488 I,

             1.213876335 + 0.9241881109 I, 1.213876335 - 0.9241881108 I}

#### Example 4

The function `sum` is able to compute sums over all roots of a given polynomial:

    >> sum(i^2, i = RootOf(x^3 + a*x^2 + b*x + c, x))

                                      2
                                     a  - 2 b

    >> sum(1/(z + i), i = RootOf(x^4 - y*x + 1, x))

                                            3
                                     y + 4 z
                                   ------------
                                          4
                                   y z + z  + 1

#### Changes

- `RootOf` used to be a domain; a call to it created a domain element in former MuPAD versions. It is now a function environment returning an unevaluated call.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000