math4610

Routine Name: HilbertMatrix

Author: David Merkley

Language: Python

Description/Purpose: Generates a matrix with coefficients a_{i,j} = 1/(i+j-1)

Input: Size of matrix n

Output: Hilbert Matrix n x n

Implementation/Code:

def hilbertMatrix(n):
    return [[1/(i + j + 1) for j in range(n)] for i in range(n)]