Previous: , Up: Mathematical Packages   [Contents][Index]

5.18 Matrix Algebra

(require 'determinant)

A Matrix can be either a list of lists (rows) or an array. Unlike linear-algebra texts, this package uses 0-based coordinates.

Function: matrix->lists matrix

Returns the list-of-lists form of matrix.

Function: matrix->array matrix

Returns the array form of matrix.

Function: determinant matrix

matrix must be a square matrix. determinant returns the determinant of matrix.

(require 'determinant)
(determinant '((1 2) (3 4))) ⇒ -2
(determinant '((1 2 3) (4 5 6) (7 8 9))) ⇒ 0
Function: transpose matrix

Returns a copy of matrix flipped over the diagonal containing the 1,1 element.

Function: matrix:sum m1 m2

Returns the element-wise sum of matricies m1 and m2.

Function: matrix:difference m1 m2

Returns the element-wise difference of matricies m1 and m2.

Function: matrix:product m1 m2

Returns the product of matrices m1 and m2.

Function: matrix:product m1 z

Returns matrix m1 times scalar z.

Function: matrix:product z m1

Returns matrix m1 times scalar z.

Function: matrix:inverse matrix

matrix must be a square matrix. If matrix is singular, then matrix:inverse returns #f; otherwise matrix:inverse returns the matrix:product inverse of matrix.


Previous: , Up: Mathematical Packages   [Contents][Index]