れ螻 螳 .
(A <- matrix(c(1,6,5,2), nrow=2, byrow=T))
(u <- matrix(c(6,-5), nrow=2, byrow=T))
(v <- matrix(c(3,-1), nrow=2, byrow=T))
蟆郁骸
> (A <- matrix(c(1,6,5,2), nrow=2, byrow=T))
[,1] [,2]
[1,] 1 6
[2,] 5 2
> (u <- matrix(c(6,-5), nrow=2, byrow=T))
[,1]
[1,] 6
[2,] -5
> (v <- matrix(c(3,-1), nrow=2, byrow=T))
[,1]
[1,] 3
[2,] -1
A 螻螳螻 螻覯″磯 れ螻 螳.
> eigen(A)
$values
[1] 7 -4
$vectors
[,1] [,2]
[1,] -0.7071068 -0.7682213
[2,] -0.7071068 0.6401844
u, v螳 A 螻螳 螻覯″一語 覲 覲伎. 襾殊 襯 襷れ. 螻覯″一企 螻螳 覓伎語 print螻, T襯 覦. 螻覯″郁 覃 F襯 覦.
udf_is_eigenvector <- function(A, u){
is_eigenvector <- F
for (eval in eigen(A)$values){
if (identical(A%*%u, u*eval) == T){
is_eigenvector <- T
print(paste0("eigen value = ", eval))
break
}
}
return(is_eigenvector)
}
覲蟆郁骸
> udf_is_eigenvector(A, u)
[1] "eigen value = -4"
[1] TRUE
> udf_is_eigenvector(A, v)
[1] FALSE
- u A 螻螳 -4 螻覯″磯.
- v A 螻螳 螻覯″郁 .