procedure
( matrix-solve MB[fail])→(U F(Matrix Number ))
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.
- : (Array Real)
(array #[#[4] #[-5]])
- : (Array Integer)
(array #[#[3] #[22]])
- : (Array Real)
(array #[#[2] #[1]])
- : (Listof (Array Real))
(list (array #[#[4] #[-5]]) (array #[#[2] #[1]]))
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 ))
- : (Array Real)
(array #[#[1 0 0] #[0 1 0] #[0 0 1]])
- : (Array Real)
(array #[#[2/29 5/29] #[3/29 -7/29]])
matrix-inverse: contract violation
expected: matrix-invertible?
given: (array #[#[1 2] #[10 20]])
- : (U (Array Real) False)
#f
procedure
procedure
( matrix-determinant M)→Number
- : Real
24
- : Integer [more precisely: Positive-Integer]
24
- : Real
0
square-matrix-size: contract violation
expected: square-matrix?
given: (array #[#[1] #[2]])