COMPUTER PROBLEMS 2.3

1 (a) Since the answers depend on rounding errors, they will vary slightly with the exact sequence of operations used. For example, using the naive Gaussian elimination code of Computer Problem 2.1.1 gives the forward error \(||x-x_c||_\infty\approx 6.6\times 10^{-10}\) and error magnification factor \(\approx 4.6\times 10^6\), while numpy.linalg.solve, a more sophisticated algorithm, returns forward error \(\approx 5.4\times 10^{-10}\) and error magnification factor \(\approx 3.7\times 10^6\). The condition number of \(A\) is approximately \(7\times 10^7\).

1 (b) The code of Computer Problem 2.1.1 gives forward error \(||x-x_c||_\infty \approx 1.5\times 10^{-3}\) and error magnification factor \(\approx 6.2\times 10^{12}\), while numpy.linalg.solve returns forward error \(\approx 1.1\times 10^{-3}\) and error magnification factor \(\approx 9.1\times 10^{12}\). The condition number of \(A\) is approximately \(1.3\times 10^{14}\).


3 Using naive Gaussian elimination as in Computer Problem 2.1.1, the results are:

\(n\) FE EMF cond(A)
\(100\)\(5.3\times 10^{-11}\)\(1.2\times 10^3\)\(1.0\times 10^4\)
\(200\)\(5.8\times 10^{-10}\)\(6.3\times 10^3\)\(4.0\times 10^4\)
\(300\)\(3.0\times 10^{-9}\)\(8.7\times 10^3\)\(9.0\times 10^4\)
\(400\)\(4.5\times 10^{-9}\)\(7.0\times 10^3\)\(1.6\times 10^5\)
\(500\)\(9.6\times 10^{-9}\)\(4.8\times 10^4\)\(2.5\times 10^5\)
The numpy.linalg.solve command is slightly more efficient, yielding the results:

\(n\) FE EMF cond(A)
\(100\)\(5.7\times 10^{-12}\)\(6.3\times 10^3\)\(1.0\times 10^4\)
\(200\)\(3.4\times 10^{-11}\)\(1.9\times 10^4\)\(4.0\times 10^4\)
\(300\)\(6.2\times 10^{-11}\)\(3.2\times 10^4\)\(9.0\times 10^4\)
\(400\)\(1.8\times 10^{-10}\)\(9.6\times 10^4\)\(1.6\times 10^5\)
\(500\)\(2.6\times 10^{-10}\)\(1.1\times 10^5\)\(2.5\times 10^5\)

5 The exact \(n\) depends slightly on the code, as in Computer Problem 1. Using the naive Gaussian elimination code of Computer Problem 2.1.1, the solution for \(n=11\) rounds to the correct solution \(x=[1.0,\ldots,1.0]\) within one correct decimal place, while the solution for \(n=12\) does not. If numpy.linalg.solve is used, the \(n=12\) solution rounds correctly to one decimal place and \(n=13\) does not.