** DATA_605_Discussion_3__C12_p388_Thonn **
** Problem C10 pg388 **
1-1). Find characterisic polynomial
\(A = \left[\begin{array}{rrrr} 1 & 2 & 1 & 0 \\ 1 & 0 & 1 & 0 \\ 2 & 1 & 1 & 0 \\ 3 & 1 & 0 & 1 \end{array} \right]\)
\(det (A - \lambda I) = 0\)
** Problem C10 pg 388 in R **
Note: the syntax for polyroot is polyroot(c(C, B, A)) gives the roots of Ax^2 + Bx + C.
#install.packages("pracma")
library(pracma)
## Warning: package 'pracma' was built under R version 3.3.3
A <- matrix (c (1,2,1,0, 1,0,1,0, 2,1,1,0, 3,1,0,1), nrow = 4, ncol=4 , byrow = TRUE)
A
## [,1] [,2] [,3] [,4]
## [1,] 1 2 1 0
## [2,] 1 0 1 0
## [3,] 2 1 1 0
## [4,] 3 1 0 1
#characteristic polynomial - R
charpoly(A, info=FALSE)
## [1] 1 -3 -2 2 2
# [1] 1 -3 -2 2 2
\(1\lambda^4 -3\lambda^3 -2\lambda^2 + 2\lambda^2 + 2 = 0\)
# Roots - R
a = round(polyroot(c ( 1, -3, -2, 2, 2)),2)
a
## [1] 0.30+0.0i -1.15+0.6i -1.15-0.6i 1.00+0.0i
# roots of characteristic equation
#[1] 0.30+0.0i -1.15+0.6i -1.15-0.6i 1.00+0.0i
END