http://www.digistats.net/z/index.php?%C5%FD%B7%D7%B3%D8 http://www.digistats.net/z/index.php?%C5%FD%B7%D7%B3%D8

行列演算

行列の作成

 > M=matrix(c(2,3,5,1,2,3,5,3,4),nrow=3,ncol=3)
 > M
     [,1] [,2] [,3]
 [1,]    2    1    5
 [2,]    3    2    3
 [3,]    5    3    4
 > (N=matrix(1:6,nrow=3,ncol=2))
      [,1] [,2]
 [1,]    1    4
 [2,]    2    5
 [3,]    3    6

行列の積

 > M%*%N
      [,1] [,2]
 [1,]   19   43
 [2,]   16   40
 [3,]   23   59

行列の固有値

 > eigen(M)
 $values
 [1]  9.7085895 -1.9228572  0.2142678
 
 $vectors
            [,1]       [,2]        [,3]
 [1,] -0.5207997 -0.7920917  0.52368032
 [2,] -0.4779605  0.1540594 -0.85175154
 [3,] -0.7073341  0.5906407 -0.01668026

逆行列

 > solve(M)
       [,1]  [,2]  [,3]
 [1,]  0.25 -2.75  1.75
 [2,] -0.75  4.25 -2.25
 [3,]  0.25  0.25 -0.25

単位行列

 > solve(M)%*%(M)
              [,1]          [,2]          [,3]
 [1,] 1.000000e+00 -4.440892e-16 -8.881784e-16
 [2,] 4.440892e-16  1.000000e+00  1.776357e-15
 [3,] 0.000000e+00  1.110223e-16  1.000000e+00


トップ   差分 バックアップ リロード   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2010-02-20 (土) 00:27:33 (4474d)