## `linalg::hilbert` -- Hilbert matrix

#### Introduction

`linalg::hilbert``(n)` returns the n x n Hilbert matrix H defined by H[i,j]:=1/(i+j-1).

#### Call(s)

`linalg::hilbert(n <, R>)`

#### Parameters

`n` | - | the dimension of the matrix: a positive integer
`R` | - | the component ring: a domain of category `Cat::Rng`; default: `Dom::ExpressionField()`

#### Returns

an n x n matrix of the domain `Dom::Matrix(R)`.

#### Related Functions

`linalg::invhilbert`

#### Details

- Note that the entries of a Hilbert matrix are rational numbers. But the returned matrix is defined over the standard component domain `Dom::ExpressionField()` so that no conversion is necessary when working with other functions that expect or return matrices over that component domain.
- Use `linalg::hilbert``(n, Dom::Rational)` to define the n x n Hilbert matrix over the field of rational numbers.

#### Example 1

We construct the 3 x 3 Hilbert matrix:

    >> H := linalg::hilbert(3)

                                +-               -+
                                |   1,  1/2, 1/3  |
                                |                 |
                                |  1/2, 1/3, 1/4  |
                                |                 |
                                |  1/3, 1/4, 1/5  |
                                +-               -+

This is a matrix of the domain `Dom::Matrix())`.

If you prefer a different component ring, the matrix may be converted into the desired domain afterwards (see `convert`, for example). Alternatively, one can specify the component ring when creating the Hilbert matrix, for example the domain `Dom::Float`:

    >> H := linalg::hilbert(3, Dom::Float)

                  +-                                          -+
                  |       1.0,          0.5,     0.3333333333  |
                  |                                            |
                  |       0.5,     0.3333333333,     0.25      |
                  |                                            |
                  |  0.3333333333,     0.25,          0.2      |
                  +-                                          -+

    >> domtype( H )

                              Dom::Matrix(Dom::Float)

#### Background

- Hilbert matrices are symmetric and positive definite.
- Hilbert matrices of large dimension are notoriously ill-conditioned challenging any numerical inversion scheme. However, their inverse can also be computed by a closed formula (see `linalg::invhilbert`).

#### Changes

- new function

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000