Matlab

profilejon371449
Project-1-Gaussian-Elimination1.docx

The purpose of this program is to test Gaussian Elimination (without pivoting) on Hilbert's Matrix which is known to be very ill-conditioned. We will also do an operation count and compute the errors in our solution.

DEFINITION : Hilbert Matrix, H, has each of its elements given by: a = 1/(i + j -1) where i,j go from 1 to n.

MATLAB command >> hilb(4) will create a Hilbert Matrix of order 4x4. For example, in FORMAT RAT, if H denotes the 4x4 Hilbert Matrix, then its first row is 1 1/2 1/3 1/4 and second row is 1/2 1/3 1/4 1/5 RAT is for Rational. We will do calculations in “format short”, so our answers will have 4 decimal digits only.

PROBLEM

Consider three systems of equations defined by: H x = b, n = size of H. We will take n = 11,12 and 13, where b is a vector chosen in such a way that the exact solution of our system is [1 1 1 1 .... 1].

(a) Write a program or use the one from our book’s website( https://sites.google.com/site/numericalanalysis1burden/home ), that performs Gaussian Elimination (without pivoting) to compute the solution for each n (3 solution vectors in all). Your program should also keep track of the number of multiplications (divisions). The OUTPUT should consist of the solution vector x, and the norm of the error vector, as shown in the example below:

· for n = 5, the exact solution is = Transpose of [1.0 1.0 1.0 ……… ……]

· computed solution = Transpose of [0.9937 0.999 1.0001 ......]

· error = exact solution minus computed solution = Transpose of [0.0063 0.001 0.0001 ......]

· infinity norm of the error vector is = 0.0063

· Euclidean norm of the error vector is = 0.0235

· Number of multiplications in my computer program = yyyy

· Number of multiplications for n=5, using the formula in our book, my answer should have been: __________

As shown above, write the seven bullet items for each case, n=11, case n=12 and case n=13. Put the answers here and proceed to part (b)

(b) Comment on the sources of error for parts (a). Type your answer here:

(c) Over here, copy the Gaussian Elimination computer program that you used in part (a).