
Calling Sequence


solve(equations, variables)


Parameters


equations



equation or inequality, or set or list of equations or inequalities

variables



(optional) name or set or list of names; unknown(s) for which to solve





Basic Information



Description


•

The solve command solves one or more equations or inequalities for their unknowns.



Output


•

If the second argument is a name or a set of names, then the solutions to a single equation are returned as an expression sequence. If the second argument is a list, then the solutions are returned as a list.

•

If the second argument is a name or a set of names, then the solutions to a set or list of equations are returned as sets of equation sequences. If the second argument is a list, then the solutions are returned as a sorted listlist of equations.

•

If the solve command does not find any solutions, then if the second argument is a name or set of names, then the empty sequence (NULL) is returned; if the second argument is a list, then the empty list is returned. This means that there are no solutions, or the solve command cannot find the solutions. In the second case, a warning is issued, and the global variable _SolutionsMayBeLost is set to true.

•

If the output of the solve command is a piecewisedefined expression, then the assuming command can be used to isolate the desired solution(s). If the output is not piecewisedefined, in particular, if the output is constant, assumptions on the independent variables may be ignored. If there are parameters in the input equations, the solve command will use those assumptions in its computations. See examples below.

•

For higher degree polynomial equations, Maple returns implicit solutions in terms of RootOf.




Examples



Simple Examples


>

$\mathrm{solve}\left(2x=3\,x\right)$

>

$\mathrm{solve}\left(f=ma\,a\right)$



Solve a quadratic equation


>

$\mathrm{solve}\left({x}^{2}3x+2=0\,x\right)$



Specifying variables



To ignore parameters, specify the variables for which to solve.

>

$\mathrm{solve}\left(\left\{\frac{{a}^{2}{c}^{2}4{b}^{2}}{b}={a}^{6}b4{a}^{3}b\right\}\,\left\{c\right\}\right)$

$\left\{{c}{=}{}\frac{{b}{}\left({{a}}^{{3}}{}{2}\right)}{{a}}\right\}{,}\left\{{c}{=}\frac{{b}{}\left({{a}}^{{3}}{}{2}\right)}{{a}}\right\}$
 (4) 


Solving linear systems



The solve command can solve linear systems.

>

$\mathrm{solve}\left(\left\{z=1\,2x+y=3\,x+y+z=2\right\}\,\left\{x\,y\,z\right\}\right)$

$\left\{{x}{=}{2}{\,}{y}{=}{\mathrm{1}}{\,}{z}{=}{1}\right\}$
 (5) 


Solving inequations



The solve command can solve inequations.

>

$\mathrm{solve}\left(\left\{x+y<10\,{x}^{2}=9\right\}\,\left\{x\,y\right\}\right)$

$\left\{{x}{=}{\mathrm{3}}{\,}{y}{<}{13}\right\}{,}\left\{{x}{=}{3}{\,}{y}{<}{7}\right\}$
 (6) 


Using the assuming command to isolate a solution



Assumptions on parameters can be used to get more specific solutions. Note also, the form of the output changes when variables are given in a list.

>

$\mathrm{solve}\left({x}^{2}=a\,\left[x\right]\right)\phantom{\rule[0.0ex]{0.3em}{0.0ex}}\mathbf{assuming}\phantom{\rule[0.0ex]{0.3em}{0.0ex}}a::\mathrm{negative}$

$\left[\left[{x}{=}{\mathrm{I}}{}\sqrt{{}{a}}\right]{\,}\left[{x}{=}{\mathrm{I}}{}\sqrt{{}{a}}\right]\right]$
 (7) 
>

$\mathrm{solve}\left(b<ax\,\left[x\right]\right)\phantom{\rule[0.0ex]{0.3em}{0.0ex}}\mathbf{assuming}\phantom{\rule[0.0ex]{0.3em}{0.0ex}}1<a$

$\left[\left[\frac{{b}}{{a}}{<}{x}\right]\right]$
 (8) 


Using RootOf expressions as placeholders to solutions of highdegree polynomials



The explicit solutions to highdegree polynomials can be very large, so Maple may return a solution using RootOf expressions as placeholders.

>

$\mathrm{solve}\left({x}^{4}{x}^{3}+1\,x\right)$

${\mathrm{RootOf}}{}\left({{\mathrm{\_Z}}}^{{4}}{}{{\mathrm{\_Z}}}^{{3}}{+}{1}{\,}{\mathrm{index}}{=}{1}\right){,}{\mathrm{RootOf}}{}\left({{\mathrm{\_Z}}}^{{4}}{}{{\mathrm{\_Z}}}^{{3}}{+}{1}{\,}{\mathrm{index}}{=}{2}\right){,}{\mathrm{RootOf}}{}\left({{\mathrm{\_Z}}}^{{4}}{}{{\mathrm{\_Z}}}^{{3}}{+}{1}{\,}{\mathrm{index}}{=}{3}\right){,}{\mathrm{RootOf}}{}\left({{\mathrm{\_Z}}}^{{4}}{}{{\mathrm{\_Z}}}^{{3}}{+}{1}{\,}{\mathrm{index}}{=}{4}\right)$
 (9) 

Maple may also use RootOf expressions as placeholders when it cannot find an explicit form for the solution of a nonalgebraic equation in one variable.

>

$\mathrm{solve}\left(\mathrm{cos}\left({x}^{2}\right)=2\mathrm{cos}\left(x\right)+x\,x\right)$

${\mathrm{RootOf}}{}\left({2}{}{\mathrm{cos}}{}\left({\mathrm{\_Z}}\right){}{\mathrm{cos}}{}\left({{\mathrm{\_Z}}}^{{2}}\right){+}{\mathrm{\_Z}}\right)$
 (10) 


No solutions found



In the following example, solve does not find a solution to the set of equations, and as mentioned above in the Description section, if the second argument variables is a set, the empty sequence is returned.

>

$\mathrm{solve}\left(\left\{x+y=1\,2x+2y=4\right\}\,\left\{x\,y\right\}\right)$


Here, solve does not find a solution to the list of equations. Since more than one variable is received in a list, the empty list is returned.

>

$\mathrm{solve}\left(\left[x+y=1\,2x+2y=4\right]\,\left[x\,y\right]\right)$




Details



For detailed information including:

•

A complete description of all calling sequences and resulting output forms

•

How to use units in the input of solve

•

Shortcuts for specifying equations and unknowns

•

Controlling the form and number of solutions returned



