MCS 471 Project Three Solution

Below is an outline for the solution of project three.

1. the data

The data was generated by the script proj3_sol.m (available below):
generating data to solve project three...
+----------------------------------------------+
| assignment one: simple lu (without pivoting) |
+----------------------------------------------+
>> assignment_one

table_for_assignment_one =

  Columns 1 through 6 

   2.0411e-15   1.0580e-14   5.5833e-13   1.3265e-12   4.5564e-11   5.0639e-11
   2.6512e-14   1.1605e-13   2.1898e-12   1.3842e-11   4.5721e-11   2.0824e-09
   3.4684e-15   4.8648e-14   4.8626e-13   2.1376e-12   7.0977e-11   1.0225e-09
   6.0569e-14   6.1725e-14   3.6814e-13   4.3040e-12   6.3481e-11   7.1758e-10
   4.2145e-15   3.7862e-13   3.8564e-13   1.5167e-11   1.1226e-10   2.3968e-09
   6.0657e-15   3.2753e-14   4.5373e-13   6.0092e-12   2.1260e-11   5.4116e-10
   2.7252e-14   8.8564e-14   3.8005e-12   1.9424e-11   6.1313e-11   1.0714e-09
   3.2415e-14   6.8006e-14   1.6873e-12   7.8973e-12   4.8655e-11   9.0955e-10

  Columns 7 through 10 

   2.2109e-09   1.3904e-08   1.4167e-07   4.5533e-06
   2.3000e-08   3.6343e-07   2.1659e-06   1.9831e-05
   5.8402e-09   1.7409e-07   4.0445e-07   2.2727e-06
   5.7118e-09   9.1663e-09   6.5786e-07   8.0472e-06
   1.0905e-08   6.6508e-08   1.0750e-06   2.5080e-05
   1.8331e-09   6.1057e-08   1.6365e-07   4.8444e-06
   1.3715e-08   1.0531e-07   5.2496e-06   3.7992e-06
   1.3158e-08   1.4421e-07   2.0580e-06   5.2410e-06

errors for solution of simple_lu
rows increase with dimension n, columns increase with k

+---------------------------------------------+
| assignment two: built in lu (with pivoting) |
+---------------------------------------------+
>> assignment_two

table_for_assignment_two =

  Columns 1 through 6 

   3.1402e-16   3.1402e-16   2.4825e-16   1.5701e-16   3.1402e-16   2.2204e-16
   2.4825e-16   9.4206e-16   3.5108e-16   5.2074e-16   1.1102e-15   3.3307e-16
   3.1402e-16   2.2204e-16   6.9333e-16   5.4390e-16   1.1322e-15   8.9509e-16
   3.9127e-15   3.0546e-15   1.0878e-15   4.3906e-15   5.8168e-15   3.8459e-16
   1.3552e-15   1.0474e-15   5.8747e-16   4.8393e-16   3.1402e-16   8.5998e-16
   1.5583e-15   8.3820e-16   2.8131e-15   1.5622e-15   8.8121e-16   1.1957e-15
   2.1211e-15   2.1953e-15   4.8470e-15   2.0562e-15   6.8231e-15   1.1158e-15
   3.0079e-15   3.0667e-15   1.4978e-15   3.0506e-15   1.0533e-15   7.1089e-16

  Columns 7 through 10 

   3.8459e-16   3.1402e-16   2.4825e-16   2.7195e-16
   6.0809e-16   5.6610e-16   7.6919e-16   5.8747e-16
   5.9787e-16   1.5701e-16   4.5776e-16   4.4409e-16
   4.6840e-15   2.6202e-15   2.9645e-15   4.7103e-16
   1.5303e-15   1.8444e-15   1.6983e-15   6.6613e-16
   1.5223e-15   1.1749e-15   8.0825e-16   1.0296e-15
   1.8611e-15   1.5263e-15   3.0587e-15   1.4687e-15
   3.5769e-15   3.0324e-15   1.4645e-15   1.6203e-15

errors for solution of built in lu
rows increase with dimension n, columns increase with k

+-------------------------------------+
| assignment three: condition numbers |
+-------------------------------------+
>> assignment_three

table_for_assignment_three =

   2.1764e-14   1.0000e+03   2.2204e-13
   1.5280e-13   1.0000e+04   2.2204e-12
   4.7332e-13   1.0000e+05   2.2204e-11
   4.8353e-12   1.0000e+06   2.2204e-10
   5.5051e-11   1.0000e+07   2.2204e-09
   6.0263e-10   1.0000e+08   2.2204e-08
   8.6138e-09   1.0000e+09   2.2204e-07
   4.0774e-08   1.0000e+10   2.2204e-06
   2.6805e-06   1.0000e+11   2.2204e-05
   7.8834e-06   1.0000e+12   2.2205e-04

relative error on the solution is bounded by cond(a)*eps
legend: 1st column is relative error on the solution
        2nd column is condition number of the matrix
        3rd column is condition number times eps

>> diary off

2. the answers

Answer to Assignment One: From the table of errors, we see that as k rises (i.e., magnitude of the diagonal gets smaller), the errors increase significantly. The dimension has not so much an influence on the errors.

Answer to Assignment Two: For all values of k and for all dimensions, we obtain the solution with an accuracy close to machine precision. This is thanks to the pivoting of the built in LU command of MATLAB, which avoids the small diagonal elements as pivots and thus reduces numerical round off.

Answer to Assignment Three: We see that the condition number is not only a good upper bound, but also a very good predictor for the relative error on the solution of the linear system. We conclude: if the condition number is 10^k, then we can lose no more than k decimal places in the solution.

3. the scripts