Main Content

invhilb

Inverse of Hilbert matrix

Description

H = invhilb(n) generates the exact inverse of the exact Hilbert matrix for n less than about 15. For larger n, the invhilb function generates an approximation to the inverse Hilbert matrix.

example

H = invhilb(n,classname) returns a matrix of class classname, which can be either 'single' or 'double'.

Examples

collapse all

Compute the fourth-order inverse Hilbert matrix.

invhilb(4)
ans = 4×4

          16        -120         240        -140
        -120        1200       -2700        1680
         240       -2700        6480       -4200
        -140        1680       -4200        2800

Input Arguments

collapse all

Matrix order, specified as a scalar, nonnegative integer.

Example: invhilb(10)

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

Matrix class, specified as either 'double' or 'single'.

Example: invhilb(10,'single')

Data Types: char

Limitations

The exact inverse of the exact Hilbert matrix is a matrix whose elements are large integers. As long as the order of the matrix n is less than 15, these integers can be represented as floating-point numbers without roundoff error.

Comparing invhilb(n) with inv(hilb(n)) involves the effects of two or three sets of roundoff errors:

  • Errors caused by representing hilb(n)

  • Errors in the matrix inversion process

  • Errors, if any, in representing invhilb(n)

The first of these roundoff errors involves representing fractions like 1/3 and 1/5 in floating-point representation and is the most significant.

References

[1] Forsythe, G. E. and C. B. Moler. Computer Solution of Linear Algebraic Systems. Englewood Cliffs, NJ: Prentice-Hall, 1967.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a

See Also