Numerical roots of a system of polynomial equations

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.


numeric::polysysroots(eqs, <NoWarning>)
numeric::polysysroots(eqs, vars, <NoWarning>)


numeric::polysysroots(eqs, ...) returns numerical approximations of all real and complex roots of the polynomial system of equations eqs.

The coefficients of the polynomials may contain symbolic parameters.

If no unknowns are specified by vars, thennumeric::indets(eqs) is used in place of vars.

In most cases, the solution is returned as a set of lists of solved equations of the form


where x1, x2, … are the unknowns. These simplified equations should be regarded as constraints on the unknowns. E.g., if an unknown x1, say, does not turn up in the form x1 = … in the solution, then there is no constraint on this unknown and it is an arbitrary parameter. This holds true in general for all unknowns that do not turn up on the left hand side of the solved equations. Cf. Example 2.

If no explicit solutions can be computed, expressions of the form (x1,x2,)S may be returned, where S is the solution set.

The ordering of the unknowns in vars determines the ordering of the solved equations. If a setvars is used, then an internal ordering is used.


If the solution set of eqs is not finite, then numeric::polysysroots may return solutions with some of the unknowns remaining as free parameters. In this case the representation of the solution depends on the ordering of the unknowns! Cf. Example 3. Further, if higher degree polynomials are involved, then numeric::polysysroots may fail to compute roots. Cf. Example 5. The same may happen, when eqs contains symbolic parameters.

You may try numeric::fsolve to compute a single numerical root, if numeric::polysysroots cannot compute all roots of the system. Note, however, that numeric::fsolve does not accept symbolic parameters in the equations.

We recommend to use numeric::polyroots to compute all roots of a single univariate polynomial with numerical coefficients.

numeric::polysysroots is a hybrid routine: it calls the symbolic solver solve(eqs, vars, BackSubstitution = FALSE) and processes its symbolic result numerically. Cf. Example 4.

Environment Interactions

The function is sensitive to the environment variable DIGITS, which determines the numerical working precision.


Example 1

Equations, expressions as well as DOM_POLY objects may be used to specify the polynomials:

numeric::polysysroots(x^2 = PI^2, x)

numeric::polysysroots({x^2 + y^2 - 1, x^2 - y^2 = 1/2}, [x, y])

numeric::polysysroots({poly(x^2 + y + 1), y^2 + x = 1}, [x, y])

Symbolic parameters are accepted:

numeric::polysysroots(x^2 + y + exp(z), [x, y])

Example 2

The returned solutions may contain some of the unknowns remaining as free parameters:

numeric::polysysroots({x^2 + y^2 = z}, [x, y, z])

Example 3

The ordering of the unknowns determines the representation of the solution, if the solution set is not finite. First, the following equation is solved for x leaving y as a free parameter:

numeric::polysysroots({x^3 = y^2}, [x, y])

Reordering the unknowns leads to a representation with x as a free parameter:

numeric::polysysroots({x^3 = y^2}, [y, x])

Example 4

The symbolic solver produces a RootOf solution of the following system:

eqs := {y^2 - y = x, x^3 = y^3 + x}:
solve(eqs, BackSubstitution = FALSE)

Internally, numeric::polysysroots calls solve and processes this result numerically:

numeric::polysysroots(eqs, [x, y])

delete eqs:

Example 5

The following equation is solved for the first of the specified unknowns:

eqs := y^5 - PI*y = x:
solve(eqs, [x, y])

numeric::polysysroots processes this output numerically:

numeric::polysysroots(eqs, [x, y])

The equation is solved for y when the unknowns are reordered. However, no simple representation of the solution exists, so a RootOf object is returned:

solve(eqs, [y, x])

The roots represented by the RootOf expression cannot be computed numerically, because the symbolic parameter x is involved:

numeric::polysysroots(eqs, [y, x])

delete eqs:



A polynomial equation or a list, set, array, or matrix (Cat::Matrix) of such equations. Also expressions and polynomials of domain type DOM_POLY are accepted wherever an equation is expected. They are interpreted as homogeneous equations.


An unknown or a list or set of unknowns. Unknowns may be identifiers or indexed identifiers.



By default, the roots are double-checked, automatically. Warnings are issued if a solution seems to be marred by some numerical instability. With this option, this check is suppressed and no warnings will be issued.

Return Values

A set of lists of equations or an expression of the form (x1,x2,)S, where x1, x2, … are the unknowns and S is the solution set.

The set {[]} containing an empty list is returned, if no solutions can be computed.