wilkinson.RdGenerate the Wilkinson matrix of size n x n.The Wilkinson matrix for
testing eigenvalue computations
wilkinson(n)The Wilkinson matrix for testing eigenvalue computations is a symmetric matrix with three non-zero diagonals and with several pairs of nearly equal eigenvalues.
matrix of size n x n
The two largest eigenvalues of wilkinson(21) agree to 14, but not 15
decimal places.
(a <- wilkinson(7))
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7]
#> [1,] 3 1 0 0 0 0 0
#> [2,] 1 2 1 0 0 0 0
#> [3,] 0 1 1 1 0 0 0
#> [4,] 0 0 1 0 1 0 0
#> [5,] 0 0 0 1 1 1 0
#> [6,] 0 0 0 0 1 2 1
#> [7,] 0 0 0 0 0 1 3
eig(a)
#> [1] 3.7615572 3.7320508 2.3633282 2.0000000 1.0000000 0.2679492 -1.1248854