AMa 105B (Numerical Analysis II)

Course Topics: Numerical methods for ODEs and PDEs
Instructors: Dr. M. Holst and Prof. H. Keller
Term: Spring 1996

Homework #1 can be obtained from Prof. Keller.

Homework #2 can be obtained from Prof. Keller.

Homework #3 can be found here (5-21-96).

Homework #4 (the final) can be found here (5-30-96).

Questions/Problems/Remarks regarding Homework #3 (5-29-96).
Remark 0 (5-21-96): Since my dead computer caused a delay of four days, I pushed the due date for Homework #3 back the same amount of time, so that you still have two weeks to complete it.

Remark 1 (5-29-96): There is an inconsistency in the sign in front of the matrix Lh appearing in the two parts (static and dynamic) of the homework.

The routine I provided supplies the discretization of MINUS the Laplacean, so that it is a positive definite matrix and can be used with CG without any modifications. (You can see from the routine that it has a positive diagonal and non-positive off-diagonals.)

This is correct for the static parts of the homework; however, in the part of the homework where the three time-stepping methods are written out (FE, BE, CN), the matrix Lh written there represents a discretization of the PLUS Laplacean. Thus, if you use the matrix Lh from the routine I provided, you MUST toggle the signs in front of terms in the equations I gave you for FE/BE/CN containing Lh.

This is my mistake; several students pointed this out (the methods blow up if you use the equations the way they are written; why?)

Remark 2 (5-29-96): Several of you pointed out to me that the implicit methods take FOREVER to do even the 31 by 31 mesh problem. This is because you have accidently formed a DENSE matrix in MATLAB, even though my routine returns the matrix Lh to you in SPARSE format. This happens when you form:

>> k = 1; n = 31; N = n * n;

>> Lh = laplace(n);

>> I = eye(N);

>> A = I - k * Lh; B = I + k * Lh;

By default, when you add a SPARSE matrix to a DENSE matrix in MATLAB, it stores the result as a DENSE matrix; you have to make sure you form every matrix in SPARSE format from the start. So, in the above, you must instead use the "speye" routine in MATLAB to make sure the identity matrix "I" is stored in MATLAB's sparse format; this will ensure that both "A" and "B" above are stored as SPARSE matrices:

>> I = speye(N);

By the way, you can check whether MATLAB is storing your matrix as a sparse or dense matrix by doing a "whos" and looking at the "DENSITY" column for the matrix you are concerned about. If it is stored full, it will say so; if it is stored sparse, it will print out a number representing the percentage of entries which are nonzero (and hence actually stored).

If you make this change, the implicit methods for the 31 by 31 mesh should be very fast; just a manner of seconds, NOT an hour!

Remark 3 (5-30-96): EXTRA CREDIT Part of Homework #3: The MATLAB finite element routines that you can use for the extra credit parts of Homework #3 can be found found here. This is a gzipped "SHAR" file; you unpack it on a UNIX machine by typing:

gzip -dv fempkg.shar.gz # This produces "fempkg.shar"

/bin/sh fempkg.shar

If you have questions about how to generate the finite element equivalent of the matrix Lh using this package, come see me. The routines are pretty well-documented. Look first at the "0readme" file and then the main driver file "go.m".

Questions/Problems/Remarks regarding Homework #4 (5-30-96).
Remark 0 (5-30-96): Nothing yet...