Fernando Guevara Vasquez's homepage

**Class meets:** MTWF 8:35am - 9:25am

**Where:** MWF: LCB 323, T: LCB 322

**Textbook:** Burden and Faires, Numerical Analysis, Thomson Brooks/Cole, eighth edition.

**Prerequisites:** Math 5610 or instructor's permission. Basic
Matlab programming.

**Instructor:** Fernando Guevara Vasquez

**Office:** LCB 212

**Office hours:** MTW 9:30am-10:30am or by appointment

**Phone number:** +1 801-581-7467

**Email:** fguevara(AT)math.utah.edu

(replace (AT) by @)

**Homeworks** 40%, **Project** 15%, **Midterm** 15%, **Final** 30%. Expect between 4 and 6 homeworks during the semester. Projects will be announced in class.

- Kincaid and Cheney, Numerical Analysis: Mathematics of Scientific Computing, Brooks/Cole 2001
- Stoer and Burlisch, Introduction to Numerical Analysis, Springer 1992
- Trefethen and Bau, Numerical Linear Algebra, SIAM 1997
- Golub and Van Loan, Matrix Computations, John Hopkins 1996
- Brenner and Scott, The Mathematical Theory of Finite Elements, Springer 2002
- Ciarlet, Finite Element Methods for Elliptic Problems,SIAM 2002
- LeVeque, Finite Difference Methods for Ordinary and Partial Differential Equations,SIAM 2007

- Here are the practice final and solutions: final_practice.pdf and final_practice_sol.pdf.
- The
**Final Exam**is*Wednesday May 6 2009*from**8am to 10am**.- Please plan to be there 10min before.
- Two one sided, letter sized, handwritten cheat sheets are allowed.
- No notes or books are allowed. Calculators are allowed but are not needed.

- For the three of you who will take the
**Early Final Exam**on*Monday May 4 2009*from**12:30pm to 2:30pm**I will contact you soon with exact room. - Thank you all for the excellent project presentations!

- Class notes for today are available here: na017.pdf.
- The solutions for
**HW5**are here: hw5sol.pdf.

Lecture notes for the past week and today are here: na016.pdf. They are concerned with parabolic PDEs (heat equation).

**HW6**is due the last day of classes and is available here: hw6.pdf. Since I will drop the lowest HW grade you can consider this assignment optional if you have done all the other assignments.

Here is a recap of what we have seen in finite elements: na015.pdf.

- Lecture notes for Wed and Friday are here: na014.pdf.

There is a typo in p103, in the expression for B, B_{2,1}should be y_{2}-y_{1}. **HW5**has been**extended**to next*Friday 04/10*. This is because there were many misunderstandings about what was asked in the homework.

**Please see this addendum**: hw5add.pdf, it should clarify what exactly I am expecting in your solutions.**HW6**will be given sometime next week.

- Here are solutions for
**HW4**: hw4sol.pdf - For
**HW5**:- P1 is the space of polynomials with degree less than
**or equal to**1. - Please do use sparse matrices for the calculations (the command
`sparse(n,n)`

gives a matrix that can be used as`zeros(n,n)`

but that stores only the non-zero components). - An essential aspect of FEM is that the stiffness matrix is sparse, making linear system solves much faster. For sparse systems an iterative method like CG would work well. However Matlab’s
`backslash`

uses an LU factorization that knows how to take advantage of sparsity. If you want to know what is under the hood check this links: book and talk. - The indices in the local to global map
`i(e,j)`

may be different than what we saw in the notes because in Matlab it is more convenient to number the nodes and local degrees of freedom starting with one.

- P1 is the space of polynomials with degree less than
- Lecture notes for Monday are here: na013.pdf

Here are some reference numbers for HW4: hw4ref.txt.

- Lecture notes covering the FEM for 1D are here: na011.pdf.
- Please remember to pick a project during the spring break. I will be around during the break if you need help with your HW or your project.

- Your
**midterm exam**has been graded. The solutions that we saw together in class are here: exam001.pdf. Here is a histogram of the exam grades:

`>=50:*`

`>=60:`

`>=70:****`

`>=80:`

`>=90:*****`

- You should receive an email Friday (today) morning with your grade and a partial grade computed with
`0.45*(hw average) + 0.55*midterm`

. The HW average being computed by removing the lowest HW grade. The final grade will take this into account as well. A rough letter grade would be: A=90+, B=80+, C=70+.

**Homework 4**is due*Monday March 23 2009*and is here: hw4.pdf.- The last class notes for eigenvalue algorithms are here: na009.pdf.
- Today we started the Finite Element Method. Class notes are here: na010.pdf. Our goal will be to understand the FEM in 2D and to implement P1 triangular finite elements. We will see enough theory to derive simple error estimates.

Here is the solution to **HW3**: hw003.pdf.

- The practice midterm is here: exam1_practice.pdf and the solution we did together is here: exam1_practice_sol.pdf.
- The class notes covering Householder reflectors and reduction to Hessenberg form are here: na008.pdf.

- Here is a (detailed) review sheet of what I expect you to know for the exam that we have this coming
*Fri 02/27*in class: exam1_rev.pdf.**Reminder**: A practice exam will be solved on Tuesday’s lecture.- A calculator is not needed for the exam, but it is allowed.
- A one-sided, letter sized, handwritten cheat sheet is allowed.
- No books or other notes are allowed.

**HW3**solutions will be posted on Monday at about 8pm. I will not accept any**HW3**after the solutions are posted.

- Here are some numbers for
**HW3**. I asked to use a slightly different method than that of the book for Problems 2 and 3. So here are some numbers for comparison: drva.m, res_drva.txt (for 11.1.3 a,b) and res_drvb.txt (for 11.2.3 a,b,c). These numerical solutions have the same number of accurate digits as the book’s solutions. - The behavior of
`spdiags`

can be tricky if your sub/super diagonals vary. This matlab code:

Computes the matrix with entries:Q = [ 1 3 0 2 3 -1 3 3 -2 0 3 -3 ]; A = spdiags(Q,-1:1,4,4);

So3 -1 0 0 1 3 -2 0 0 2 3 -3 0 0 3 3

`spdiags`

uses only the upper part of subdiagonals and the lower part of superdiagonals. - If you don’t want to use
`spdiags`

you can create an n by n all zeros sparse matrix with`A=sparse(n,n);`

and then fill it entry by entry.

- Class notes on Eigenvalues are here: na007.pdf. Today we finished the theory part (9.1).
- The references I am using for eigenvalues are
- Trefethen and Bau,
*Numerical Linear Algebra*, SIAM 1997 - Golub and Van Loan,
*Matrix Computations*, 3rd edition, John Hopkins, 1996

- Trefethen and Bau,
- The material we will cover is somewhere between Chapter 9 in your book and Part V of Trefthen and Bau.

**HW3**is here: hw3.pdf and is due*Fri 02/20*. Please read the hints I wrote, they should make the implementation simpler than in the book.- The
**Midterm exam**will be on*Fri 02/27*and will cover Chapters 5 and 11 (Initial value problems and Boundary value problems). On*Tue 02/24*we will do a practice exam. The exam will be closed book and notes. - Today we started Chapter 9 on Eigenvalues.

- Lecture notes for today are here: na005.pdf, we covered the key notions of A-stability and the region of absolute stability.
- We finished with Initial Value Problems (Chap 5) and on Friday we start Boundary Value Problems (Chap 11).
- Here is a Matlab program that displays the absolute stability region for a multistep method: absstab.m.

**Projects**: The project calendar and some project suggestions are here: projects.pdf. Please do not be thrown off by the names of the methods, they are usually simple to understand and implement.- Solutions to
**HW1**are here: hwsol001.pdf. **HW2**has been extended to*Fri 02/06*. Charlie found a typo in exercise 5.6.2 a (part of problem 4): The true solution should be`y(t) = (2*t+1)/(t^2+1)`

(the denominator in the book has a 2).- There will be no homework posted this week
- Class notes are here: na004.pdf (covers stability, consistency, systems and higher order equations)

Lecture notes for last week and Monday are here: na002.pdf. They cover 5.6-5.8 (Multistep methods).

**HW1**is due*Tue 01/27*and is available here: hw1.pdf.**Note**: No computer is needed for Problem 2, the solution should be very simple.- Please contact me as soon as possible if you need access to the Math Computer Lab for Matlab or if you would like to use Octave (the open source alternative).
**Homework policy**- The preferred method to turn in your HW is in class. You can also send it by email (see below for guidelines), leave it under my office door or in my mailbox. Please email me every time you use any of this alternatives.
- Typed solutions are not required.
- You may work in pairs, in that case turn in only one writeup.

**Guidelines for numerical experiments**- Always
**include your code and some runs**of your program(s). You have to include enough information to convince me that your code is doing what is supposed to be doing. You will be penalized if you don’t, and it makes it harder for me to find potential mistakes. - Please present your numerical results in a way that
**highlights the intended results**.- For example if you are asked to compare several methods, you could do this with a plot of the actual vs computed values if their discrepancies are large enough. If the errors are too small, then plotting the error (or a table) is probably more meaningful.
- Keep in mind that semi-log or log-log scales (in Matlab:
`semilogy`

,`semilogx`

,`loglog`

) often make it easier to interpret convergence curves. - Your program output should include relevant information. For example if you have a method with adaptive time step, then it is good to know what the time step is at each iteration.
- The Matlab routine
`fprintf`

is very handy. It allows to use C style format strings for your program’s output. It works by first specifying what is to be printed and how. For floating point numbers there are 3 possible formats (in Matlab):**%f**(floating point as in 1.234 or 0.221),**%e**(exponent notation as in 1.234e+00 or 2.221e-01) or**%g**(which lets`fprintf`

choose between**%f**and**%e**). One can also specify: the minimum number of characters to be printed and the number of digits after the period (the radix). For example`%10.3f`

tells`fprintf`

to format a floating point number as a float, using 10 characters and with 3 digits after the period. The line feed character is**\n**. Here is an example:

>> a=pi; b=pi/10000; c=pi*100000; >> fprintf('%10.3f %10.3f %10.3f\n',a,b,c) 3.142 0.000 314159.265 >> fprintf('%10.3g %10.3g %10.3g\n',a,b,c) 3.14 0.000314 3.14e+05 >> fprintf('%10.3e %10.3e %10.3e\n',a,b,c) 3.142e+00 3.142e-04 3.142e+05 >> fprintf('a=%10.3e, b=%10.3e c=%10.3e\n',a,b,c) a= 3.142e+00, b= 3.142e-04 c= 3.142e+05

See`help fprintf`

or`doc fprintf`

for more details.

- Always

- I may present algorithms in a slightly different way than in the textbook. Unless specified, use the book’s algorithm because it will make it easier for you to test your code against the examples given in your book.

- Send your HW by email. If you have a handwritten part, you can send a scan (the Math department has a scanner).
- I will confirm receipt of your HW within 24 hours. If you don’t hear back from me during that time, please send it again.
- Put together your
`m-`

files in PS or PDF file (that I will print) as specified below. If possible submit a**single**PS or PDF file with the code listings. - Keep your
`m-`

files around. In very rare occasions I could ask you to send them to me for verification. Also later HW may reuse code from previous ones.

- On
**unix**using the command`a2ps`

a2ps -o outfile.ps -2 -A virtual -g -Ematlab4 file1.m file2.m file3.m

- In
**Latex**with the package`listings`

, create a document containing essentially the following. (you could add headers to indicate which file you are listing etc…)

\documentclass{article} \usepackage{listings} \begin{document} \lstset{language=Matlab,basicstyle=\small,breaklines=true} \lstinputlisting{file1.m} \lstinputlisting{file2.m} \lstinputlisting{file3.m} % etc ... \end{document}

- On
**Windows**you can create a PDF from any application by using the free, open source PDFCreator. It works by adding a software printer that prints to a PDF file from any application (say Matlab’s GUI). It has a “Wait-Collect” button that allows to collect several files before printing. The documents can be selected in the PDFCreator application and combined with the Documents > Combine menu item. - On
**Mac OS X**you can print from any application to a PDF by choosing the “Save as PDF” option in the drop down PDF menu that appears in the print popup window.`a2ps`

is available on this platform via macports and Latex via MacTeX . Here is an application for combining PDFs: PDFLab

Lecture notes for the week are available here: na001.pdf, we have covered sections 5.1-5.5.

**Room Change**: As of today the classroom changes to:- MWF: LCB 323 (across the hall from the fish bowl)
- T: LCB 322 (the fish bowl)

- Tuesdays will be mostly Q&A sessions, homework (or exam) solutions, demos, etc… If we need time to catch up with the material, a regular lecture will be held.

Class announcements will be posted here.