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 1, 2019, 11:18 p.m.