Docsity

MATH 640 Homework 2: Iterative Techniques in Numerical Analysis - Prof. Erin K. Mcnelis, Assignments of Mathematical Methods for Numerical Analysis and Optimization

Toggle sidebar
bg1
MATH 640 – Numerical Analysis
Homework # 2: Iterative Techniques
DUE: Friday, March 5th, 2004
1. For each of the iterative methods we’ve discussed:
(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.
2. Use the first three (not including Conjugate Gradient) MATLAB functions to approximate the
solution to our room temperature problem from Homework #1
Amat ∗u=bvec
using the upwinding scheme for m=n= 4,8,16,32, a tolerance of 10−4and 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.
3. Solve
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 =25
ln((x−0)2+ (y−7.5)2+e)−22
ln((x−25)2+e), vy =25
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.
pf2

Partial preview of the text

Download MATH 640 Homework 2: Iterative Techniques in Numerical Analysis - Prof. Erin K. Mcnelis and more Assignments Mathematical Methods for Numerical Analysis and Optimization in PDF only on Docsity!

MATH 640 – Numerical Analysis Homework # 2: Iterative Techniques DUE: Friday, March 5th, 2004

  1. For each of the iterative methods we’ve discussed:

(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.

  1. Use the first three (not including Conjugate Gradient) MATLAB functions to approximate the solution to our room temperature problem from Homework #

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.

  1. Solve

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.

  1. Explain why we can not use Conjugate Gradient Method with our room temperature problem.
  2. Do problem #9 (b) in Section 7.5 page 479 from the text. Put together a file called Asm A.m that constructs the A matrix described, in which you adjust a 25 × 25 matrix of zeros. Create another table, as you did in problem 2.
  3. Let g(x) = xT^ Ax − 2 xT^ b =< x, Ax > − 2 < x, b > We have shown in class that if A is a symmetric positive definite matrix then the vector x that solves Ax = b also minimizes g(x).

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^.