linalg::hilbert -- Hilbert
matrix
Introductionlinalg::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>)
Parametersn |
- | the dimension of the matrix: a positive integer |
R |
- | the component ring: a domain of category Cat::Rng; default: Dom::ExpressionField() |
Returnsan n x n matrix of the domain Dom::Matrix(R).
Related
Functions
DetailsDom::ExpressionField() so that no conversion is necessary
when working with other functions that expect or return matrices over
that component domain.linalg::hilbert(n, Dom::Rational) to
define the n x n Hilbert matrix over the field of rational
numbers.
Example
1We 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)
Backgroundlinalg::invhilbert).