7.9 Solving Systems of Equations
procedure
(matrix-solve M B [fail]) → (U F (Matrix Number))
M : (Matrix Number) B : (Matrix Number) fail : (-> F) = (λ () (error ...))
It is typical for B (and thus X) to be a column matrix, but not required. If B is not a column matrix, matrix-solve solves for all the columns in B simultaneously.
Examples: | |||||||||||||||||||||
|
matrix-solve does not solve overconstrained or underconstrained systems, meaning that M must be invertible. If M is not invertible, the result of applying the failure thunk fail is returned.
matrix-solve is implemented using matrix-gauss-elim to preserve exactness in its output, with partial pivoting for greater numerical stability when M is not exact.
See vandermonde-matrix for an example that uses matrix-solve to compute Legendre polynomials.
procedure
(matrix-inverse M [fail]) → (U F (Matrix Number))
M : (Matrix Number) fail : (-> F) = (λ () (error ...))
Examples: | ||||||||||||||
|
procedure
(matrix-invertible? M) → Boolean
M : (Matrix Number)
procedure
(matrix-determinant M) → Number
M : (Matrix Number)
Examples: | ||||||||||||||
|