Generate the n by n symmetric Hilbert matrix. Because these matrices are ill-conditioned for moderate to large n, they are often used for testing numerical linear algebra code.

Hilbert(n)

Arguments

n

a non-negative integer.

Value

the n by n symmetric Hilbert matrix as a "dpoMatrix" object.

See also

the class dpoMatrix

Examples

Hilbert(6)
#> 6 x 6 Matrix of class "dpoMatrix"
#>           [,1]      [,2]      [,3]      [,4]      [,5]       [,6]
#> [1,] 1.0000000 0.5000000 0.3333333 0.2500000 0.2000000 0.16666667
#> [2,] 0.5000000 0.3333333 0.2500000 0.2000000 0.1666667 0.14285714
#> [3,] 0.3333333 0.2500000 0.2000000 0.1666667 0.1428571 0.12500000
#> [4,] 0.2500000 0.2000000 0.1666667 0.1428571 0.1250000 0.11111111
#> [5,] 0.2000000 0.1666667 0.1428571 0.1250000 0.1111111 0.10000000
#> [6,] 0.1666667 0.1428571 0.1250000 0.1111111 0.1000000 0.09090909