Skip to contents

Package description

matlib-package matlib
matlib: Matrix Functions for Teaching and Learning Linear Algebra and Multivariate Statistics.

Convenience functions

Simple functions for matrix algebra oparations

J()
Create a vector, matrix or array of constants
len()
Length of a Vector or Column Lengths of a Matrix
mpower()
Matrix Power
Proj()
Projection of Vector y on columns of X
R()
Rank of a Matrix
symMat()
Create a Symmetric Matrix from a Vector
tr()
Trace of a Matrix
vec()
Vectorize a Matrix
xprod()
Generalized Vector Cross Product

Determinants

Functions for calculating determinants by cofactor expansion

adjoint()
Calculate the Adjoint of a matrix
cofactor()
Cofactor of A[i,j]
Det()
Determinant of a Square Matrix
minor()
Minor of A[i,j]
rowCofactors()
Row Cofactors of A[i,]
rowMinors()
Row Minors of A[i,]

Elementary row operations

Functions for solving linear equations “manually” by the steps used in row echelon form and Gaussian elimination

rowadd()
Elementary Row Operations
rowmult()
Multiply Rows by Constants
rowswap()
Interchange two rows of a matrix
buildTmat() as.matrix(<trace>) print(<trace>)
Build/Get transformation matrices

Linear equations

Functions to illustrate linear equations of the form 𝐀𝐱=𝐛\mathbf{A x = b}

showEqn()
Show Matrices (A, b) as Linear Equations
plotEqn()
Plot Linear Equations
plotEqn3d()
Plot Linear Equations in 3D
Solve()
Solve and Display Solutions for Systems of Linear Simultaneous Equations
printMatEqn()
Print Matrices or Matrix Operations Side by Side
printMatrix()
(Deprecated) Print a matrix, allowing fractions or LaTeX output

LaTeX matrices

Create and manipulate LaTeX repesentations of matrices and matrix equations

Gaussian elimination

Functions for illustrating Gaussian elimination

cholesky()
Cholesky Square Root of a Matrix
echelon()
Echelon Form of a Matrix
gaussianElimination() print(<enhancedMatrix>)
Gaussian Elimination
Ginv()
Generalized Inverse of a Matrix
Inverse()
Inverse of a Matrix
LU()
LU Decomposition
MoorePenrose()
Moore-Penrose inverse of a matrix
QR()
QR Decomposition by Graham-Schmidt Orthonormalization
swp()
The Matrix Sweep Operator

Eigenvalues

Functions to illustrate the algorithms for calculating eigenvalues and eigenvectors

Eigen()
Eigen Decomposition of a Square Symmetric Matrix
powerMethod()
Power Method for Eigenvectors
showEig()
Show the eigenvectors associated with a covariance matrix
SVD()
Singular Value Decomposition of a Matrix

Vector diagrams

Functions for drawing vector diagrams in 2D and 3D

angle()
Angle between two vectors
arc()
Draw an arc showing the angle between vectors
arrows3d()
Draw 3D arrows
circle()
Draw circles on an existing plot.
circle3d()
Draw a horizontal circle
cone3d()
Draw a 3D cone
corner()
Draw a corner showing the angle between two vectors
getYmult()
Correct for aspect and coordinate ratio
pointOnLine()
Position of a point along a line
regvec3d()
Vector space representation of a two-variable regression model
plot(<regvec3d>) summary(<regvec3d>) print(<regvec3d>)
Plot method for regvec3d objects
vectors()
Draw geometric vectors in 2D
vectors3d()
Draw 3D vectors

Other

Other functions in the package, unclassified

matrix2latex()
(Deprecated) Convert matrix to LaTeX equation
GramSchmidt()
Gram-Schmidt Orthogonalization of a Matrix
gsorth()
Gram-Schmidt Orthogonalization of a Matrix
svdDemo()
Demonstrate the SVD for a 3 x 3 matrix
vandermode()
Vandermode Matrix

Data

Some small data sets used in examples

class
Class Data Set
therapy
Therapy Data
workers
Workers Data