inst/snippet/mat-solve.R

x <- as.matrix(c(3,1))            # vector as column matrix
A <- rbind(c(5,2),c(3,1))
Ainv <- solve(A); Ainv            # solve() computes inverse
A %*% Ainv
Ainv %*% A
Ainv %*% x                        # solution to system

Try the fastR package in your browser

Any scripts or data that you put into this service are public.

fastR documentation built on May 2, 2019, 5:53 p.m.