Introduction to Scientific Computing

Assignment 3

Note: Please use Matlab, or a public domain approximation to it in this assignment. The

code must compile on one of the lab machines with your instructions. Document your code

thoroughly!

Instructions

1. Complete the LU decomposition of the matrix A where the * entries are the unknowns.

.A =

41 2 100 41 2

44 3 *10 0* *

84 0 **1 00 *

− −

− =

2. Using this decomposition determine the solution of

0

3

16

Ax

=

3. The two matrices B and C are superficially “similar” to matrix A above.

41 2 21 2

4 4 3 and 4 4 3

84 2 84 4

B C

− −

=− =−

are their LU decompositions

similar too?

2

4. This is practical example of a small but real-life-type ill-conditioned problem The flow

of water through two very different materials gives this system of linear equations :

⎣

⎢

⎢

⎢

⎢

⎢

⎢

⎢

⎡

−𝐻𝐻1

0

0

⋮

0

⋮

0

0

−𝑎𝑎𝑎𝑎𝑟𝑟⎦

⎥

⎥

⎥

⎥

⎥

⎥

⎥

⎤

= 1

∆𝑥𝑥2

⎣

⎢

⎢

⎢

⎢

⎢

⎢

⎢

⎡

−2 1

1 −2 1

1 −2 1

⋱ ⋱ ⋱

1 −(1 + 𝑎𝑎) 𝑎𝑎

⋱ ⋱ ⋱

𝑎𝑎 −2𝑎𝑎 𝑎𝑎

𝑎𝑎 −2𝑎𝑎 𝑎𝑎

𝑎𝑎 −2𝑎𝑎⎦

⎥

⎥

⎥

⎥

⎥

⎥

⎥

⎤

⎣

⎢

⎢

⎢

⎢

⎢

⎢

⎢

⎡ ℎ1

ℎ2

ℎ3

⋮

ℎ𝑖𝑖

⋮

ℎ𝑛𝑛−2

ℎ𝑛𝑛−1

ℎ𝑛𝑛 ⎦

⎥

⎥

⎥

⎥

⎥

⎥

⎥

⎤

The coefficient a can be very small indeed a = 1.0e-7 giving an ill-conditioned matrix.

Use ∆𝑥𝑥 = 1 𝑎𝑎𝑎𝑎𝑎𝑎 𝑛𝑛 = 21, 41, 81, 161 .

For values of a = 1.0, 1.0e-1,1.0e-3, 1.0e-5, 1.0e-7 and 1.0e-9, 1.0e-11,

1.0e-13, 1.0e-15 compute the estimated condition number using the matlab

condition number estimator. How does the condition number vary with the

value of a . Explain by using graphs.

If 𝐻𝐻1 = 8 𝑎𝑎𝑎𝑎𝑎𝑎 𝐻𝐻𝑟𝑟 = 4 Solve the system of equations for n= 161, where a =

1.0, a = 1.0e-5 and a = 1.0e-15. Use iterative refinement to check and

improve your answer if possible.

What to turn in

For these assignments, we expect both SOURCE CODE and a written REPORT be

uploaded as a zip or tarball file to Canvas.

• Source code for all programs that you write, thoroughly documented.

o Include a README file describing how to compile and run your code.

• Your report should be in PDF format and should stand on its own.

o It should describe the methods used, explain your results and contain figures.

o It should also answer any questions asked above.

o It should cite any sources used for information, including source code.

o It should list all of your collaborators.

This homework is due on March 11 by 11:59 pm. If you don’t understand these directions,

please send questions to the TAs or come to see one of the TAs or the instructor during

office hours well in advance of the due date.

Sale!