Starting from:

$30

5DV005-Lab 9 Solved

Problem 1 Copy the function forward.m into work/MyForward.m

1.    Extend MyForward to the point where it also returns the exact flop count in a variable count.

2.    Derive and verify a formula for the exact flop count.

3.    Extend MyForward to the point where it can solve a lower unit triangular linear system LX = F where F is an m by n matrix.

4.    Construct a minimal working example work/MyForwardMWE.m which verifies that MyForward is working as advertised. For each column, the script must compute and display the normwise relative error given by

 

as well as the normwise relative residual given by

 

Naturally, large values of the normwise relative error are unfortunate, but the normwise relative residual should be small for forward substitution.

Problem 2 Copy the function backward.m into work/MyBackward.m

1.    Extend MyBackward to the point where it also returns the exact flop count in a variable count.

2.    Derive and verify a formula for the exact flop count.

3.    Extend MyBackward to the point where it can solve a non-singular upper triangular linear system UX = F where F is an m by n matrix.

4.    Construct a minimal working example work/MyBackward MWE.m which verifies that MyBackward is working as advertised. For each column, the script must compute and display the normwise relative error given by

 

as well as the normwise relative residual given by

 

Naturally, large values of the normwise relative error are unfortunate, but the normwise relative residual should be small for backward substitution.

Problem 3 Copy the function factor.m into work/MyFactor.m

1.    Extend MyFactor to the point where it also returns the exact flop count in a variable count.

2.    Derive and verify a formula for the exact flop count[1].

3.    Develop a minimal working example MyFactorMWE which computes an LU factorization PA = LU of a random matrix A. The script must compute and display the normwise relative residual given by

 

In exact arithmetic, this number should be zero. In floating point arithmetic, we can expect a small value, and large values will almost certainly be caused by programming errors.

Remark 1 MyFactor will not return the matrix P explicitly. However, the array sigma contains the necessary information. Specifically, if B = PA, then MATLAB can construct B using B=A(sigma,:).

Problem 4 Develop a function work/MyGauss.m which uses the functions MyFactor, MyForward, MyBackward to solve a linear system AX = F where A is a non-singular m by m matrix and F is an m by n. Develop a minimal working example work/MyGaussMWE.m which verifies that MyGauss is working as advertised. In particular, the script must compute the normwise relative error and the normwise relative residual for each column. Large normwise relative errors are possible, but large normwise relative residuals strongly suggest programming errors.


 
[1] It is possible that this question and answer can be helpful: http://math.stackexchange.com/ questions/1640730/order-of-lu-factorisation/1641606#1641606

More products