wilkinson: wilkinson Matrix

Description Usage Arguments Details Value Note See Also Examples

View source: R/wilkinson.R

Description

Generate the Wilkinson matrix of size n x n.The Wilkinson matrix for testing eigenvalue computations

Usage

1

Arguments

n

integer

Details

The Wilkinson matrix for testing eigenvalue computations is a symmetric matrix with three non-zero diagonals and with several pairs of nearly equal eigenvalues.

Value

matrix of size n x n

Note

The two largest eigenvalues of wilkinson(21) agree to 14, but not 15 decimal places.

See Also

Toeplitz

Examples

1
2
(a <- wilkinson(7))
eig(a)

Example output

     [,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
[1]  3.7615572  3.7320508  2.3633282  2.0000000  1.0000000  0.2679492 -1.1248854

pracma documentation built on Dec. 11, 2021, 9:57 a.m.