ASSIGNMENT 3 IS 605 FUNDAMENTALS OF COMPUTATIONAL MATHEMATICS - 2014
library(pracma)
A <- matrix(
c(
1,2,3,4,
-1,0,1,3,
0,1,-2,1,
5,4,-2,-3
)
,
4,4,
byrow = TRUE
)
A
## [,1] [,2] [,3] [,4]
## [1,] 1 2 3 4
## [2,] -1 0 1 3
## [3,] 0 1 -2 1
## [4,] 5 4 -2 -3
Rank(A)
## [1] 4
Answer: Rank of matrix A is 4.
B <- matrix(
c(1,2,1,
3,6,3,
2,4,2),
3,3,
byrow = TRUE
)
B
## [,1] [,2] [,3]
## [1,] 1 2 1
## [2,] 3 6 3
## [3,] 2 4 2
Rank(B)
## [1] 1
Answer: Rank of B is 1.
Compute the eigenvalues and eigenvectors of the matrix A. Youâll need to show your work. Youâll need to write out the characteristic polynomial and show your solution. Answer:
A <- matrix(c(
1,2,3,
0,4,5,
0,0,6
), 3, 3 , byrow = TRUE)
A
## [,1] [,2] [,3]
## [1,] 1 2 3
## [2,] 0 4 5
## [3,] 0 0 6
# install.packages("matlib")
library(matlib)
##
## Attaching package: 'matlib'
## The following objects are masked from 'package:pracma':
##
## angle, inv
ev <- eigen(A)
ev$values
## [1] 6 4 1
ev$vectors
## [,1] [,2] [,3]
## [1,] 0.5108407 0.5547002 1
## [2,] 0.7981886 0.8320503 0
## [3,] 0.3192754 0.0000000 0
Ap <- charpoly(A, info = TRUE)
## Error term: 0
Ap$cp
## [1] 1 -11 34 -24