

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


MATH 640 – Numerical Analysis Homework # 2: Iterative Techniques DUE: Friday, March 5th, 2004
(a) Jacobi, (b) Gauss-Seidel, (c) SOR, (d) Conjugate Gradient Method
create an m-file (function) that, given the input of
(a) a matrix, A, (b) a vector, b, (c) an initial guess vector, x(0) (d) an ω value (for SOR only) (e) a tolerance, tol, and (f) a maximum number of iterations,
will output two things if sucessful:
(a) the approximate solution, ˆx, to the problem Ax = b, and (b) the number of iterations used to find ˆx
else the appropriate error statement if it is not successful. Turn in a copy of these documented m-files.
Amat ∗ u = bvec
using the upwinding scheme for m = n = 4, 8 , 16 , 32, a tolerance of 10−^4 and a maximum of 15 iterations. For the SOR method, use at least two different values of ω. Create a table comparing the methods used (specify ω values with the SOR), and the number of iterations required to solve each size problem.
Amat ∗ u = bvec
from Homework #1 again, using the SOR method, but with each of the following sets of velocity values:
(a) Case 1: vx = 3, vy = 3 (see above)
(b) Case 2: vx =
ln((x − 0)^2 + (y − 7 .5)^2 + e)
ln((x − 25)^2 + e) , vy =
ln((y − 12)^2 + e) (c) Case 3: vx = y − 12. 5 , vy = −(x − 12) (d) Case 4: vx = 3 cos(xy), vy = 3 sin(xy)
Give the graphs for m = n = 8, 16 for each case.
Suppose that A is not symmetric positive definite, and the conjugate gradient method applied to the linear system with coefficient matrix A converges. Show that it converges to x that solves
(Ax + AT^ x) = 2b
Hints, use the fact that x minimizes g(x). (What does that mean about ∇g?) Also use the fact that xT^ Aei is a scalar, thus xT^ Aei = (xT^ Aei)T^.