Floating point and LU decomposition

324 Views Asked by At

So in a numerical linear algebra book I'm studying (Matrix Computations 4th edition) there is this example on floating points and LU decomposition:

Suppose 3-digit floating point arithmetic is used to solve (with gaussian elimination without pivoting):

$\begin{pmatrix} .001 & 1\\ 1 & 2 \end{pmatrix}$ $\begin{pmatrix} x_{1} \\ x_{2} \end{pmatrix}=\begin{pmatrix} 1 \\ 3 \end{pmatrix}$

Applying Gaussian elimination we get:

$L=\begin{pmatrix} 1 & 0\\ 1000 & 1 \end{pmatrix}$ and $U=\begin{pmatrix} .001 & 1\\ 0 & 1000 \end{pmatrix}$

Here's what I don't get.

I calculated $U$ as such:

$m=(0,\frac{a_{21}}{a_{11}})^T=(0,1000)^T$

$M=I_2-m*e_1^T=\begin{pmatrix} 1 & 0\\ 0 & 1 \end{pmatrix}-\begin{pmatrix} 0\\ 1000 \end{pmatrix}\begin{pmatrix} 0 & 1 \end{pmatrix}=\begin{pmatrix} 1 & 0\\ -1000 & 1 \end{pmatrix}$

Now $U=MA=\begin{pmatrix} 1 & 0\\ -1000 & 1 \end{pmatrix}\begin{pmatrix} .001 & 1\\ 1 & 2 \end{pmatrix}$

$\Leftrightarrow U=\begin{pmatrix} .001 & 1\\ 0 & 2-10^3 \end{pmatrix}$

So now I have to calculate $fl(2-10^3)$ in the 3-digit floating arithmetic

$2-10^3=0.002*10^3-1.000*10^3=-0.998*10^3$

But since it's 3-digit floating arithmetic there is no reason for rounding the number. So U is $$\begin{pmatrix} .001 & 1\\ 0 & 998 \end{pmatrix}$$

The way I see it for $U$ to be as given by the example the floating arithmetic should either be 2-digit or the number should be somethin like $0.9998$

What I'm I doing wrong?