You can also use the commands described above to solve systems of simultaneous equations. Just create a vector of equations, then specify a vector of variables for which to solve. (You can omit the surrounding brackets when entering the vector of variables at the prompt.)

For example, putting ``[x + y = a, x - y = b]'` on the stack
and typing `a S x,y RET` produces the vector of solutions

Calc's algorithm works by trying to eliminate one variable at a time by solving one of the equations for that variable and then substituting into the other equations. Calc will try all the possibilities, but you can speed things up by noting that Calc first tries to eliminate the first variable with the first equation, then the second variable with the second equation, and so on. It also helps to put the simpler (e.g., more linear) equations toward the front of the list. Calc's algorithm will solve any system of linear equations, and also many kinds of nonlinear systems.

Normally there will be as many variables as equations. If you
give fewer variables than equations (an "over-determined" system
of equations), Calc will find a partial solution. For example,
typing `a S y RET` with the above system of equations
would produce

If the variables list contains only `elim`

specifiers,
Calc simply eliminates those variables from the equations
and then returns the resulting set of equations. For example,
`a S elim(x)` produces ``[a - 2 y = b]'`. Every variable
eliminated will reduce the number of equations in the system
by one.

Again, `a S` gives you one solution to the system of
equations. If there are several solutions, you can use `H a S`
to get a general family of solutions, or, if there is a finite
number of solutions, you can use `a P` to get a list. (In
the latter case, the result will take the form of a matrix where
the rows are different solutions and the columns correspond to the
variables you requested.)

Another way to deal with certain kinds of overdetermined systems of
equations is the `a F` command, which does least-squares fitting
to satisfy the equations. See section Curve Fitting.

Go to the first, previous, next, last section, table of contents.