solve one or more equations - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Factorization and Solving Equations : solve : solve/details

solve - solve one or more equations

Calling Sequence

solve(equations, variables, options)

Parameters

equations

-

expression, equation, inequality, or procedure; or set or list of expressions, equations, or inequalities

variables

-

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

options

-

(optional) a sequence of equations option=value.

Basic Information

• 

This help page contains complete information about the solve command. For basic information on the solve command, see the solve help page.

Description

• 

The solve command solves one or more equations or inequalities for the specified unknowns. The unknowns may be names, including indexed names (though for efficiency reasons, indexed names should be avoided when possible), or functions. Both indexed names and functions are considered to be independent of each other and of all other unknowns.

• 

To find parameterized solutions of the equations, specify variables that are functions of a free variable.

• 

If you use the abs command, the solve command assumes that the argument to abs is real-valued.

Calling Sequence Shortcuts

• 

In the equations parameter, if you specify an expression expr, Maple interprets it as the equation expr=0.

• 

If you do not specify the variables parameter, Maple solves for all the variables that appear in equations, that is, indets(equations, name).

Output

• 

The data type of the solution depends on the data type of the first (equations) and second (unknowns for which to solve) arguments.

  

- If the second argument is a name and the first argument is an equation, then the solution is an expression sequence.

  

- If the second argument is a name and the first argument is a set or list of equations, then the solution is comprised of sets.

  

- If the second argument is a list of names, then for any type of first argument,  the solution is a list of lists.

  

- If there is no second argument, then the solution for a single variable equation is an expression sequence, and the solution for a multi variable equation or a set or list of equations is comprised of sets.

• 

If the solve command does not find any solutions, then it returns the empty sequence (NULL) (instead of an expression sequence or sets) or empty list (instead of a list of lists). This means that there are no solutions or the solve command cannot find the solutions.

Missed Solutions

• 

If the solve command cannot confirm that the solution set returned is complete, it sets the global variable _SolutionsMayBeLost to true and issues a warning.

Conditional Solutions

• 

The solve command can return conditional solutions to many types of parametric equations and inequalities. Systems of linear inequalities in one or more variables are fully supported, as well as relations involving some types of simple functions of linear expressions. Conditional solutions are returned in the form of piecewise functions whose conditions depend upon the values of the parameters. Each output of the piecewise function will be a list of lists or sets, identifying all of the solutions that are valid under the corresponding condition. If a branch of the piecewise function contains no solutions, then its output will be an empty list.

• 

To prevent solve from returning conditional solutions, use the solve option conditionalsolutions=false. In this case, if solve encounters a conditional solution, it will be discarded, a warning message will be displayed, and only solutions that hold unconditionally, if any, will be returned.  You can also set the environment variable _EnvConditionalSolutions := false.

Controlling the Form of Solutions

• 

A single quadratic equation with constant coefficients in one variable is solved directly by substitution into the quadratic formula. To attempt to express solutions in the common radical form, which may take a longer time to process use the option tryhard=true. You can also set the environment variable _EnvTryHard := true.

• 

In general, explicit solutions in terms of radicals do not exist for polynomial equations of degree greater than 4. The solve command returns explicit solutions for low degree polynomial equations (by default, degree less than 4). For higher degree equations, implicit solutions are given in terms of RootOf.

  

To control the form of solutions returned, use the option explicit. The behavior is described in the following table.

explicit=Value

Behavior

not given

return explicit solutions for polynomial equations of degree less than or equal to 3

true

return explicit solutions for polynomial equations of degree less than or equal to 4

false

return explicit solutions for polynomial equation solutions that are rational

numeric

return explicit solutions for polynomial equations with a length less than the numeric value specified

 

 

You can also control this by setting the environment variable _EnvExplicit.

Controlling the Number of Solutions

• 

By default, solve may return multiple identical solutions to a polynomial (i.e. the roots of multiplicity greater than one). To have solve return only one of each of these multiple roots use the option dropmultiplicity=true or set the environment variable _EnvDropMultiplicity := true.

• 

To control the total number of solutions returned, use the option maxsols. This integer specifies the maximum number of solutions returned. The default value is 100. You can set the environment variable _MaxSols.

• 

The solve command returns all solutions for polynomial equations. In general for transcendental equations, the solve command returns only one solution, but does not set _SolutionsMayBeLost to true. To force the solve command to return the entire set of solutions for all inverse transcendental functions, provide the solve option allsolutions = true or set the environment variable _EnvAllSolutions := true.

  

In the solution, Maple may generate variables that take numeric values. Normally such variables are named with the prefix _Z for integer values, _NN for non-negative integer values, and _B for binary values (0 and 1).  If other conditions on these values apply, then the conditions will be converted to assumptions and simplified, if possible.  If such conditions are sufficient to allow Maple to determine that the variable may only take on a finite number of values, then the full list of solutions can be requested by using the option explicit=true.

Using Assumptions

  

In most cases, solve ignores assumptions on the variables for which it is solving.  However, the useassumptions option may be supplied to force solve to inspect any assumptions on the variables, and extract inequalities that it will add to the input.  For example:

solve(x^2-1,{x}, useassumptions) assuming x>0;

x=1

(1)

is equivalent to:

solve({x^2-1, x>0},{x});

x=1

(2)

but, in some case, the user may find the former more convenient The useassumptions option will not make use of any assumptions that cannot be rewritten as polynomial inequations.  In particular, it does not process assumptions restricting the domain:

solve(x^2+1,{x}, useassumptions) assuming x::real;

Warning, solve may not respect assumed property 'real' on 'x'.

x=I,x=I

(3)

instead one should use RealDomain[solve] or isolve for solutions over the real numbers or over the integers, respectively.

Additional Information

• 

Further information is available for the subtopics solve/subtopic where subtopic is one of

function

identity

ineq

linear

parametrized

radical

scalar

series

solve/float

solve/parametric

solve/symbolic

system

Examples

Simple Examples

Solving an implicit equation

solve2yx12=2,y

12x2x+32

(4)

Solving a quadratic equation

solvex2x=2025,x

12+128101,12128101

(5)

Specifying variables

  

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

solvea2c24b2b=a6b4a3b,c

c=ba32a,c=ba32a

(6)

Solving a set of equations

  

When the solved for variables are provided as set, the solutions to the set of equations are returned as sets of equation sequences.

solvex&plus;y<10&comma;x2&equals;9&comma;x&comma;y

x&equals;3&comma;y<13&comma;x&equals;3&comma;y<7

(7)

Solving trigonometric equations

solvecosx&plus;y&equals;9&comma;x

&pi;arccosy9

(8)

Solving inequations

solve5<x2&plus;x&comma;x

RealRange&infin;&comma;Open121221&comma;RealRangeOpen12&plus;1221&comma;&infin;

(9)

solvex2y2&equals;0&comma;xy&equals;1

x&equals;0&comma;y&equals;1&comma;x&equals;1&comma;y&equals;0

(10)
  

You can add inequations to filter out unwanted solutions. In this case, the previous call to solve has two solutions. Adding x0 filters out one of these solutions.

solvex2y2&equals;0&comma;xy&equals;1&comma;x0

x&equals;1&comma;y&equals;0

(11)

Ignoring Multiple Identical Solutions

solvex4&comma;x

0&comma;0&comma;0&comma;0

(12)

solvex4&comma;x&comma;dropmultiplicity

0

(13)

Evaluating Solutions to Floating-Point Values and Verifying Solutions

eq:=x45x2&plus;6x&equals;2

eq:=x45x2&plus;6x&equals;2

(14)

solveeq&comma;x

31&comma;13&comma;1&comma;1

(15)

solutions:=solveeq&comma;x

solutions:=31&comma;13&comma;1&comma;1

(16)

solutions1

31

(17)
  

To convert to floating-point values, use the evalf command.

evalfsolutions

0.732050808&comma;2.732050808&comma;1.&comma;1.

(18)

solutions:=solveeq&comma;x

solutions:=1&comma;13&comma;31

(19)

solutions1

1

(20)
  

To verify the solution, use the eval command.

eqx&equals;solutions1|eqx&equals;solutions1

2&equals;2

(21)

Implicit Solutions

solvex4&plus;x&plus;1&comma;x

RootOf_Z4&plus;_Z&plus;1&comma;index&equals;1&comma;RootOf_Z4&plus;_Z&plus;1&comma;index&equals;2&comma;RootOf_Z4&plus;_Z&plus;1&comma;index&equals;3&comma;RootOf_Z4&plus;_Z&plus;1&comma;index&equals;4

(22)
  

To convert to floating-point values, use the evalf command.

evalf

0.72713608450.4300142883I&comma;0.7271360845&plus;0.4300142883I&comma;0.72713608450.9340992895I&comma;0.7271360845&plus;0.9340992895I

(23)
  

To find an explicit symbolic representation for the roots, use map with the allvalues command.  This applies allvalues to each solution and is generally better than applying allvalues directly to all the solutions at once.

solvex42x3&plus;2&comma;x

RootOf_Z42_Z3&plus;2&comma;index&equals;1&comma;RootOf_Z42_Z3&plus;2&comma;index&equals;2&comma;RootOf_Z42_Z3&plus;2&comma;index&equals;3&comma;RootOf_Z42_Z3&plus;2&comma;index&equals;4

(24)

mapallvalues&comma;

1212I124&plus;2I&comma;1212I&plus;124&plus;2I&comma;12&plus;12I1242I&comma;12&plus;12I&plus;1242I

(25)

solvex2y2b&comma;x2y2a&comma;x&comma;y

x&equals;RootOf_Z2RootOf_Z4&plus;_Z2ab2a&comma;y&equals;RootOf_Z4&plus;_Z2ab

(26)

mapallvalues&comma;

x&equals;12a&plus;12a2&plus;4b&comma;y&equals;122a2&plus;4b2a&comma;x&equals;12a&plus;12a2&plus;4b&comma;y&equals;122a2&plus;4b2a&comma;x&equals;12a&plus;12a2&plus;4b&comma;y&equals;122a2&plus;4b2a&comma;x&equals;12a&plus;12a2&plus;4b&comma;y&equals;122a2&plus;4b2a&comma;x&equals;12a12a2&plus;4b&comma;y&equals;122a2&plus;4b2a&comma;x&equals;12a12a2&plus;4b&comma;y&equals;122a2&plus;4b2a&comma;x&equals;12a12a2&plus;4b&comma;y&equals;122a2&plus;4b2a&comma;x&equals;12a12a2&plus;4b&comma;y&equals;122a2&plus;4b2a

(27)

Assigning Solutions to Corresponding Names

equations:=u&plus;v&plus;w&equals;1&comma;3u&plus;v&equals;3&comma;u2vw&equals;0

equations:=3u&plus;v&equals;3&comma;u2vw&equals;0&comma;u&plus;v&plus;w&equals;1

(28)

solutions:=solveequations

solutions:=u&equals;45&comma;v&equals;35&comma;w&equals;25

(29)
  

Check solutions.

evalequations&comma;solutions

0&equals;0&comma;1&equals;1&comma;3&equals;3

(30)
  

Select one solution.

evalu&comma;solutions

45

(31)
  

Assign all solutions.

assignsolutions

u

45

(32)

Finding All Solutions

solvesinx&equals;cosx1&comma;x&comma;allsolutions

2&pi;_Z2~&comma;12&pi;&plus;2&pi;_Z1~

(33)

r:=solvecosx&comma;x&comma;allsolutions

r:=12&pi;&plus;&pi;_Z3~

(34)
  

Substitute 3 for _Z3~ in r.

ropindetsr&equals;3|ropindetsr&equals;3

72&pi;

(35)

Finding All Solutions with Restrictions

solvesinxcosx&equals;0&comma;0<x&comma;x<10&comma;x&comma;allsolutions

x&equals;&pi;_Z5~&comma;x&equals;12&pi;&plus;&pi;_Z4~

(36)

about_Z4

Originally _Z4, renamed _Z4~:

  is assumed to be: AndProp(integer,RealRange(0,2))

about_Z5

Originally _Z5, renamed _Z5~:

  is assumed to be: AndProp(integer,RealRange(1,3))

solvesinxcosx&equals;0&comma;0<x&comma;x<10&comma;x&comma;allsolutions&comma;explicit

x&equals;&pi;&comma;x&equals;2&pi;&comma;x&equals;3&pi;&comma;x&equals;12&pi;&comma;x&equals;32&pi;&comma;x&equals;52&pi;

(37)

Conditional Solutions

restart

solveb<ax&comma;x

&lcub;x&equals;xa=0Andb<0ba<x0<ax<baa<0otherwise

(38)

solve2<x&plus;a&plus;x&plus;b&comma;x

&lcub;112a12b<x&comma;x<12a12b12+ba2+bbx&comma;x<a&comma;ax&comma;x<ba<2&plus;bax&comma;x<b&comma;bx&comma;x<a2&plus;b<aotherwise

(39)

solvex1x2x3&equals;0&comma;ax1<2&plus;bx1&comma;x

&lcub;x&equals;3&comma;x&equals;2&comma;x&equals;1a<1&plus;bx&equals;2&comma;x&equals;11+ba<2+bx&equals;1otherwise

(40)

solvex1x2x3&equals;0&comma;ax1<2&plus;bx1&comma;x&comma;conditionalsolutions&equals;false

Warning, one or more conditional solutions have been discarded

x&equals;1

(41)

Other Maple solvers

  

dsolve - solve an ordinary differential equation (ODE) or system of ODEs

  

fsolve - solve equations and inequalities using numeric methods

  

intsolve - solve a linear integral equation

  

isolve - solve equations for integer solutions

  

Groebner[Solve] - preprocess an algebraic system before solving with the solve command (to solve using Groebner methods)

  

LinearAlgebra[LinearSolve] - solve a linear system A . x = b

  

msolve - solve equations in Z mod m

  

pdsolve - solve a partial differential equation (PDE) or system of PDEs

  

rsolve - solve a recurrence equation

  

SolveTools - solve a system of algebraic equations using low-level commands

See Also

allvalues, assign, eval, evalf, Groebner, indets, invfunc, isolate, match, op, RootOf, simplex


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam