Simultaneous Equations
You can give
Solve a list of simultaneous equations to solve.
Solve can find explicit solutions for a large class of simultaneous polynomial equations.
Here is a simple linear equation with two unknowns.
| Out[1]= |  |
|
Here is a more complicated example. The result is a list of solutions, with each solution consisting of a list of transformation rules for the variables.
| Out[2]= |  |
|
You can use the list of solutions with the /. operator.
| Out[3]= |  |
|
Even when Solve cannot find explicit solutions, it often can "unwind" simultaneous equations to produce a symbolic result in terms of Root objects.
| Out[4]= |  |
|
You can then use N to get a numerical result.
| Out[5]= |  |
|
The variables that you use in
Solve do not need to be single symbols. Often when you set up large collections of simultaneous equations, you will want to use expressions like
a[i] as variables.
Here is a list of three equations for the a[i].
| Out[6]= |  |
|
This solves for some of the a[i].
| Out[7]= |  |
|
| Solve[eqns,{x1,x2,...}] | solve eqns for the specific objects xi |
| Solve[eqns] | try to solve eqns for all the objects that appear in them |
Solving simultaneous equations.
If you do not explicitly specify objects to solve for, Solve will try to solve for all the variables.
| Out[8]= |  |
|
• Solve[{lhs1 rhs1,lhs2 rhs2,...},vars] |
• Solve[lhs1 rhs1&&lhs2 rhs2&&...,vars] |
• Solve[{lhs1,lhs2,...} {rhs1,rhs2,...},vars] |
Ways to present simultaneous equations to Solve.
If you construct simultaneous equations from matrices, you typically get equations between lists of expressions.
| Out[9]= |  |
|
Solve converts equations involving lists to lists of equations.
| Out[10]= |  |
|
| Out[11]= |  |
|
In some kinds of computations, it is convenient to work with arrays of coefficients instead of explicit equations. You can construct such arrays from equations by using
CoefficientArrays.