MATH4602 Scientific Computing
Computer programming project
Please select Four from the following Six problems. Scripts should be run-able on their
own: after running the code, indicated input and output will be printed in Command
Window. Functions should be detailed illustrated with ’scripts’ showing each feature.
Each problem will have 25% credits. If you finish more than four problems, you will get
extra credits. Please try your best.
Due Date: 30 April 2019 (Tue.)
1. (Gaussian elimination method)
(a) Write function x = gauss(A,b) that uses Gaussian elimination without pivoting
to solve the n×n system Ax = b. Note that the function does not perform the
LU decomposition but just applies straightforward row operations. If a pivot
element is zero, print an error message and exit.
(b) Use your function to solve three random systems of size 3 × 3, 4 × 4, and
10 × 10. For example, you can use A = rand(10, 10) to generate matrix A
and b = rand(10, 1) to generate vector b, which have uniformly distributed
random numbers. You can also try A = randn(10, 10) to generate matrix
A and b = randn(10, 1) to generate vector b, which have normal distributed
random numbers.
2. (Gram-Schmidt Process) Classical Gram-Schmidt method may be error-prone. De-