### 15.7.4 Solving AX=b

The simult command can solve a linear system of equations or several linear systems of equations with the same matrix of coefficients (see also 15.7.3).

- simult takes two arguments:
  - A, a matrix (the matrix of coefficients of a system).
  - b, a column vector (representing the right hand side of the system) or a matrix (where each column represents the right hand side of an equation).
- simult(A,b) returns a column vector of the solutions (or a matrix where each column is the column vector of a solution).

#### Examples

Solve the system:

⎧
⎨
⎩

3x+y | = | −2,
3x+2y | = | 2.

simult([[3,1],[3,2]],[[-2],[2]])

⎡
⎢
⎣

−2
4

⎤
⎥
⎦

Hence x=−2 and y=4 is the solution.

Solve the systems:

⎧
⎨
⎩

3x+y | = | −2,
3 x+2y | = | 2

and

⎧
⎨
⎩

3x+y | = | 1,
3x+2y | = | 2.

simult([[3,1],[3,2]],[[-2,1],[2,2]])

⎡
⎢
⎣

−2 | 0
4 | 1

⎤
⎥
⎦

Therefore x=−2 and y=4 is the solution of the first system of equations and x=0 and y=1 is the solution of the second system.