Find x in Ax = b. If b not supplied, the inverse of A is returned.

solve_lin(A, b)

Arguments

A

matrix

b

vector

Examples

if (has_sympy()) {
  A <- matrix_sym(2, 2, "a")
  b <- vector_sym(2, "b")
  # Inverse of A:
  solve_lin(A) %*% A |> simplify()
  # Find x in Ax = b
  x <- solve_lin(A, b)
  A %*% x |> simplify()
}
#> c: [b₁  b₂]ᵀ