Linear mappings: Linear mappings in R
Kernel and image
The R package pracma
provides the functions null
and nullspace
to compute to vectors spanning the kernel of a matrix mapping. Its name comes from the alternative name "null space" for "kernel". For the computation of the image of a linear mapping you can use the function orth
.
> library(pracma)
> A <- matrix(c(1, 0, 1, 2, 1, 1, -1, 1, -2), nrow=3, byrow=TRUE); A
[,1] [,2] [,3]
[1,] 1 0 1
[2,] 2 1 1
[3,] -1 1 -2
> null(A) # kernel of A
[,1]
[1,] -0.5773503
[2,] 0.5773503
[3,] 0.5773503
> Rank(A) # rank of A
[1] 2
> orth(A) # spanning vectors of the image of A
[,1] [,2]
[1,] -0.4264014 3.330669e-16
[2,] -0.6396021 -7.071068e-01
[3,] 0.6396021 -7.071068e-01
> round(.Last.value, 4)
[,1] [,2]
[1,] -0.4264 0.0000
[2,] -0.6396 -0.7071
[3,] 0.6396 -0.7071
Unlock full access