Solving AX=b: simult

### 5.56.4 Solving AX=b: simult

The simult command can solve a linear system of equations or several linear systems of equations with the same matrix of coefficients (see also 5.56.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

  ⎧ ⎨ ⎩ |
  3x + y | = | −2
  3x +2y | = | 2

  Input:
  simult([[3,1],[3,2]],[[-2],[2]])
  Output:

  ⎡ ⎢ ⎣ |
  −2
  4
  | ⎤ ⎥ ⎦

  [[-2],[4]]
  Hence x=−2 and y=4 is the solution.
- Solve

  ⎧ ⎨ ⎩ |
  3x + y | = | −2
  3 x +2y | = | 2

  and

  ⎧ ⎨ ⎩ |
  3x + y | = | 1
  3x +2y | = | 2

  Input:
  simult([[3,1],[3,2]],[[-2,1],[2,2]])
  Output:

  ⎡ ⎢ ⎣ |
  −2 | 0
  4 | 1
  | ⎤ ⎥ ⎦

  So 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.