### Navigation

- index
- modules |
- modules |
- next |
- previous |
- SciPy v0.12 Reference Guide (DRAFT) »
- Linear algebra (`scipy.linalg`) »

# scipy.linalg.solve

`scipy.linalg.``solve`(a, b, sym_pos=False, lower=False, overwrite_a=False, overwrite_b=False, debug=False, check_finite=True)

  Solve the equation `a x = b` for `x`.

  Parameters : | a : (M, M) array_like A square matrix. b : (M,) or (M, N) array_like Right-hand side matrix in `a x = b`. sym_pos : bool Assume a is symmetric and positive definite. lower : boolean Use only data contained in the lower triangle of a, if sym_pos is true. Default is to use upper triangle. overwrite_a : bool Allow overwriting data in a (may enhance performance). Default is False. overwrite_b : bool Allow overwriting data in b (may enhance performance). Default is False. check_finite : boolean, optional Whether to check the input matrixes contain only finite numbers. Disabling may give a performance gain, but may result to problems (crashes, non-termination) if the inputs do contain infinities or NaNs.
  Returns : | x : (M,) or (M, N) ndarray Solution to the system `a x = b`. Shape of the return matches the shape of b.
  Raises : | LinAlgError : If a is singular.

  Examples

  Given a and b, solve for x:

      >>> a = np.array([[3,2,0],[1,-1,0],[0,5,1]])
      >>> b = np.array([2,4,-1])
      >>> x = linalg.solve(a,b)
      >>> x
      array([ 2., -2.,  9.])
      >>> np.dot(a, x) == b
      array([ True,  True,  True], dtype=bool)

### Navigation

- index
- modules |
- modules |
- next |
- previous |
- SciPy v0.12 Reference Guide (DRAFT) »
- Linear algebra (`scipy.linalg`) »