Originally Posted by

**CaptainBlack** As:

$\displaystyle

H_n = \begin{bmatrix}

1 & \frac{1}{2} & ... & \frac{1}{n} \\

\frac{1}{2} & \frac{1}{3} & ... & \frac{1}{n+1} \\

: & : & \ddots & : \\

\frac{1}{n} & \frac{1}{n+1} & ... & \frac{1}{2n-1} \\

\end{bmatrix}

$

You want the solution of:

$\displaystyle

H_nx=c

$

to be:

$\displaystyle

x=\begin{bmatrix}1 \\ 1 \\ \vdots \\ 1 \end{bmatrix}

$

in which case we want:

$\displaystyle

c=\begin{bmatrix}\sum_{r=1}^n \frac{1}{r} \\ \\ \sum_{r=2}^{n+1} \frac{1}{r} \\ \\ \vdots \\ \\ \sum_{r=n}^{2n-1} \frac{1}{r}\end{bmatrix}

$

CB

Untested:

Code:

Hn=hilb(n);
x=ones(n,1);
c=(sum(Hn))'; % or Hn*x
x1=Hn\c;
err=sqrt((x1-x)'*(x1-x));
cn=cond(Hn);

CB