Question: Problem 1 : ( 6 0 p ) Solve a system of linear equations A x = b using Gaussian elimination with and without partial

Problem 1: (60p)
Solve a system of linear equations Ax=b using Gaussian elimination with and without partial pivoting.
Use a matrix size of 10001000 initialized with random numbers in the interval -0.5,0.5. Initialize the
right hand side by computing b=Az with all z values =1.(Thus, the solution is in fact known.).
Write your own MATLAB function that performs the initialization of A,b and z. The matrix size is chosen
with the intent to make the running time long enough for a reasonably good time measurement, but not
excessively long. Use tic and toc to measure execution time.
i) Write your own MATLAB function in the spirit of the pseudocode in the lecture slides (from the
book) that performs Gaussian Elimination without partial pivoting and apply it to solve for x in
Ax=b with A and b generated by your code as described above. Then compute the mean squared
error (MSE)(x-1)2,1N, and the square root thereof (SMSE). Measure the time to compute x.
Do not include the time to initialize A,b and z, and the time to compute the average mean
squared error , and the square root thereof. Thus, only measure the time to compute
x once A and b are known. (20p)
a. Carry this out in single precision. Report SMSE and time. Note that by default all variables are
represented in double precision. Single precision must be specified explicitly (20p)
b. Carry this out in double precision. Report SMSE and time. (20p)
ii) Write your own MATLAB function that performs Gaussian Elimination with partial pivoting. The
coding should be at a comparable level as in a)(i.e., not by using high level MATLAB function
calls). Then carry out the same set of computations and measurements as in a) for the same A
and b(Do not reinitialize A and b).
iii) Solve Ax=b using the MATLAB built in function Linsolve for the same A and b as in a) and b) using
double precision, compute MSE and SMSE and measure the time. Report SMSE and time.
Problem 2(40p):
Write a MATLAB function that initializes the matrix such that a(i,j)=1i+j-1 for i,j=1,2,dots,1000.
Initialize the vector z with all values 1 as in Problem 1 and compute b=Az as in Problem 1.
a) Use your MATLAB function for Gaussian Elimination with partial pivoting to compute x in Ax=b,
the MSE and SMSE and measure the time. (20p)
i. Carry this out in single-precision and report SMSE and time.
ii. Carry this out in double precision and report SMSE and time.
b) Use the MATLAB Linsolve function to compute x, then compute MSE and SMSE and measure the
time. Report SMSE and time. (20p)
The matrix A is known as the Hilbert matrix, which is ill-conditioned.
 Problem 1: (60p) Solve a system of linear equations Ax=b using

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!