matlib (version 0.9.2)

Inverse: Inverse of a Matrix

Description

Uses gaussianElimination to find the inverse of a square, non-singular matrix, \(X\).

Usage

Inverse(X, tol = sqrt(.Machine$double.eps), ...)

Arguments

X

a square numeric matrix

tol

tolerance for checking for 0 pivot

...

other arguments passed on

Value

the inverse of X

Details

The method is purely didactic: The identity matrix, \(I\), is appended to \(X\), giving \(X | I\). Applying Gaussian elimination gives \(I | X^{-1}\), and the portion corresponding to \(X^{-1}\) is returned.

Examples

Run this code
# NOT RUN {
  A <- matrix(c(2, 1, -1,
               -3, -1, 2,
               -2,  1, 2), 3, 3, byrow=TRUE)
  Inverse(A)
  Inverse(A, verbose=TRUE, fractions=TRUE)
# }

Run the code above in your browser using DataLab