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.
Lecture notes for the past week and today are here: na016.pdf. They are concerned with parabolic PDEs (heat equation).
Here is a recap of what we have seen in finite elements: na015.pdf.
sparse(n,n)
gives a matrix that can be used as zeros(n,n)
but that stores only the non-zero components).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.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.Here are some reference numbers for HW4: hw4ref.txt.
>=50:*
>=60:
>=70:****
>=80:
>=90:*****
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+.Here is the solution to HW3: hw003.pdf.
spdiags
can be tricky if your sub/super diagonals vary. This matlab code:Q = [ 1 3 0 2 3 -1 3 3 -2 0 3 -3 ]; A = spdiags(Q,-1:1,4,4);
3 -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.spdiags
you can create an n by n all zeros sparse matrix with A=sparse(n,n);
and then fill it entry by entry.y(t) = (2*t+1)/(t^2+1)
(the denominator in the book has a 2).Lecture notes for last week and Monday are here: na002.pdf. They cover 5.6-5.8 (Multistep methods).
semilogy
, semilogx
, loglog
) often make it easier to interpret convergence curves.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
help fprintf
or doc fprintf
for more details.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.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.a2ps
a2ps -o outfile.ps -2 -A virtual -g -Ematlab4 file1.m file2.m file3.m
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}
a2ps
is available on this platform via macports and Latex via MacTeX . Here is an application for combining PDFs: PDFLabLecture notes for the week are available here: na001.pdf, we have covered sections 5.1-5.5.
Class announcements will be posted here.