The solver accepts both equations and expressions. If you call `solve`

for an expression,
the command assumes the right side to be 0:

S1 := solve(x^3 - 1, x); S2 := solve(x^3 = 8, x); S3 := solve(x^3 - 3*x^2 = 1 - 3*x, x)

Assign individual solutions to variables by indexing into the result:

sol := S1[3]

Specifying the variable that you want to solve an equation for
is optional. If you specify a variable, the `solve`

command returns solutions as a
set of numbers. Otherwise, the command returns a set of lists as a
solution:

solve(x^2 - 3*x + 2 = 0, x); solve(x^2 - 3*x + 2 = 0)

If your equation contains symbolic parameters, specify the variable for which you want to solve the equation:

solve(a*x^2 + b*x + c, x)

If you solve an equation with symbolic parameters and do not
specify the variable, `solve`

uses
all parameters as variables and returns a set of all possible solutions.
For example, solving the following equation the solver assumes that
both `x`

and `y`

are free variables.
when returning all possible solutions for this equation, the solver
uses an arbitrary parameter `z`

:

solve(x^3 + y^3)

To specify more than one variable, provide a list of variables as a second argument:

solve(a*x^2 + b*x + c, [a, b, c])

`solve`

also
can return an expression as `x in S`

, where `x`

is
a list of variables for which you solve an equation, and `S`

is
a set of the solution vectors:

solve(a*x + 1/x)

When you solve a higher-order polynomial equation, the solver
sometimes uses `RootOf`

to return the results:

solve(x^3 + 2*x + 1 = 0, x)

To get an explicit solution for such equations, try calling
the solver with the option `MaxDegree`

. The option
specifies the maximal degree of polynomials for which the solver tries
to return explicit solutions. By default, `MaxDegree=2`

.
Increasing this value, you can get explicit solutions for higher-order
polynomials. For example, specify `MaxDegree=3`

and
get explicit solutions instead of `RootOf`

for the third-order polynomial:

solve(x^3 + 2*x + 1 = 0, x, MaxDegree = 3)

When you solve a fifth- or higher-order polynomial equation,
the solver might be unable to return the solution explicitly, even
with the option `MaxDegree`

:

solve(x^5 + 2*x + 1 = 0, x); solve(x^5 + 2*x + 1 = 0, x, MaxDegree = 5)

In general, there are no explicit expressions for the roots
of polynomials of degrees higher than 4. Setting the option `MaxDegree`

to
4 or a higher value makes no difference.

`RootOf`

symbolically
represents the set of the roots of a polynomial. You can use the expressions
containing `RootOf`

in
your further computations. For example, find the sum over all roots
of the polynomial:

sum(S^2 + S + 2, S in RootOf(X^5 + 2*X + 1, X));

To get the numeric approximation of the roots, use the `float`

command:

float(RootOf(X^4 + X + 1, X))

For more details on numeric approximations, see Solving Equations Numerically.

For univariate polynomial equations, MuPAD^{®} also can compute
intervals containing the real roots. See Isolating Real Roots
of Polynomial Equations.

By default, the `solve`

command
does not return the multiplicity of the roots. When the solution of
an equation contains multiple roots, MuPAD removes duplicates:

solve(x^2 - 6*x + 9 = 0, x)

The solver does not display multiple roots because it returns
results as a set. A set
in MuPAD cannot contain duplicate elements. To obtain polynomial
roots with their multiplicities, use the option `Multiple`

:

solve(x^2 - 6*x + 9 = 0, x, Multiple); solve((x - 1)^3*(x - 2)^7, x, Multiple)

For some polynomial equations, the solver cannot return the explicit symbolic solutions.

p:= x^5 - 31*x^4/32 + 32*x^3/33 - 33*x^2/34 - 34*x/35 + 35/36: solve(p, x)

If you prefer a solution in a form other than `RootOf`

and want to avoid
numeric methods, use `polylib::realroots`

to
find all intervals containing real solutions:

p:= x^5 - 31*x^4/32 + 32*x^3/33 - 33*x^2/34 - 34*x/35 + 35/36: polylib::realroots(p)

`solve`

can solve inequalities. Typically,
the solution set of an inequality is `interval`

or a union of
intervals:

solve(x^2 > 5, x)

Use `solve`

to solve the following inequality.
The solution includes the set of all complex numbers, excluding
and
:

solve(x^2 <> 7, x)

Was this topic helpful?