Set of roots of a polynomial

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


RootOf(f, x)


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

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. If f has multiple roots, RootOf represents each of the roots with its multiplicity.

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 x3 - x2 with respect to x, i.e., the set {0, 1}:

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

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

RootOf(poly(x^3 - x^2, [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)

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)

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)

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


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))

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

Example 5

A RootOf object represents the set of all roots. One can address the individual roots via indexed calls:

RootOf(z^3 - 1, z)[i] $ i = 1..3

float(RootOf(z^3 - 1, z)[i]) $ i = 1..3



A polynomial, an arithmetical expression representing a polynomial in x, or a polynomial equation in x


The indeterminate: typically, an identifier or indexed identifier

Return Values

Symbolic RootOf call, i.e., an expression of type "RootOf".

See Also

MuPAD Functions