Simultaneous Equations

You can give (RefLink[Solve, paclet:ref/Solve]) a list of simultaneous equations to solve. (RefLink[Solve, paclet:ref/Solve]) can find explicit solutions for a large class of simultaneous polynomial equations.

Here is a simple linear equation with two unknowns:

Solve[{a x+b y==1,x-y==2},{x,y}]

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:

Solve[{x^2+y^2==1,x+y==a},{x,y}]

You can use the list of solutions with the /. operator:

x^3+y^4/.%/.a->0.7

Even when (RefLink[Solve, paclet:ref/Solve]) cannot find explicit solutions, it often can "unwind" simultaneous equations to produce a symbolic result in terms of (RefLink[Root, paclet:ref/Root]) objects:

First[Solve[{x^2+y^3==x y,x+y+x y==1},{x,y}]]

You can then use (RefLink[N, paclet:ref/N]) to get a numerical result:

N[%]

The variables that you use in (RefLink[Solve, paclet:ref/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]:

Table[2 a[i]+a[i-1]==a[i+1],{i,3}]

This solves for some of the a[i]:

Solve[%,{a[1],a[2],a[3]}]

Solving simultaneous equations.

If you do not explicitly specify objects to solve for, (RefLink[Solve, paclet:ref/Solve]) will try to solve for all the variables:

Solve[{x+y==1,x-3 y==2}]

Ways to present simultaneous equations to (RefLink[Solve, paclet:ref/Solve]).

If you construct simultaneous equations from matrices, you typically get equations between lists of expressions:

{{3,1},{2,-5}}.{x,y}=={7,8}

(RefLink[Solve, paclet:ref/Solve]) converts equations involving lists to lists of equations:

Solve[%,{x,y}]

You can use (RefLink[LogicalExpand, paclet:ref/LogicalExpand]) to do the conversion explicitly:

LogicalExpand[%%]

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 (RefLink[CoefficientArrays, paclet:ref/CoefficientArrays]).