\documentclass[11pt]{article} \usepackage{fullpage,amsmath,amssymb} \usepackage[pdftex]{graphicx} \usepackage[pdftex,colorlinks=true,plainpages=false]{hyperref} \newcommand{\T}{^\mathsf{T}} \newcommand{\rmd}{\mathrm{d}} \begin{document} \begin{center} {\Large COMPUTER SCIENCE 314}\\ {\Large Numerical Methods} \\ {\large SPRING 2013} \\ ASSIGNMENT \# 7 (25 points) \\ {\small April 11} \end{center} \subsection*{Announcements} \begin{itemize} \item The Final Exam is Saturday, May 4, 1:00--3:00 pm in Grissom Hall 180. {\em Please inform the instructor as soon as possible if you must write the exam at a different time.} The exam is comprehensive, yet heavily weighted toward material covered at the end of the course. In terms of covered sections of the textbook, about 32\% is from Chapters~1--5, 26\% from Chapter~6 and 42\% from Chapter~10. Some questions will be related to Assignment~\#7. You can use only pens, pencils, and erasers; in particular, no written material nor electronic devices is permitted. \item Office hours during Finals Week: \begin{tabbing} mmmmmmmmmmmmm\=mmmmmmmmmmmmmmmmm\=mmmmmmmmmmmmmmmmm \kill \> {\bf Instructor} \> {\bf Teaching Assistant} \\ Tuesday \> 2:30--3:00 \\ %\> 4:00--5:00 \\ Wednesday \> 2:30--3:00 \> 4:00--4:30 \end{tabbing} Graded Assignment \#7's can be picked up, as well as previous assignments and exams. \end{itemize} \subsection*{Due Thursday, April 25 at noon.} \begin{enumerate} \item[0.] Read Sections 6.1--6.3, 6.6 of the textbook. % Sec 7.1 \item (6 points) Do Exercise 6.2 from the textbook. \item (4 points) Do Exercise 6.17(a) from the textbook. \item (15 points) \begin{enumerate} \item (3 points) Write a function M-file for evaluating the function whose value is $x\sin(1/x)$ at $x\ne 0$ and 0 at $x = 0$. It must accept a vector argument and return a vector result, the function evaluated at each element of the vector argument. \item[] Also write a script M-file that does the following: \item (2 points) Calculate a very accurate value of $\int_0^1 x\sin(1/x)\rmd x$, using {\tt integral} from MATLAB or {\tt quad} from Octave with an absolute error tolerance of $10^{-15}$ and a relative error tolerance of $0$. The calculation of this value will produce a warning. The value thus obtained will be regarded as the exact value of the integral. \item (4 points) For (absolute) error tolerances of 1, $\frac12$, \ldots, $2^{-30}$, use {\tt quadtx} to approximate this same integral, and for each tolerance, print the number of function evaluations and the error. Use \verb|disp(sprintf('%4d %13.10f', ...))| for printing. \item (3 points) Create a log-log plot of accuracy vs.\ number of function evaluations, with accuracy defined to be the reciprocal of the magnitude of the error. \item (3 points) The slope of the plot is the order of accuracy. Estimate this. For full credit, do this by means of a linear fit using the backslash operator. \end{enumerate} {\it Hand in} your code, your exact value, your list of error vs.\ number of function evaluations, your log-log plot, and your estimate of the order of accuracy. \newcounter{myenumi}\setcounter{myenumi}{\value{enumi}} \end{enumerate} \subsection*{Problems not to hand in} However, solutions will be provided. \begin{enumerate} \setcounter{enumi}{\value{myenumi}} % Sec 7.1 \item Find an approximation for $$\int_1^{2.2} \frac{dx}{x}$$ using the two-fold (composite) trapezoid rule, Your answer should be wholly numeric but need not be simplified. \item Consider the simple quadrature rule $$\int_a^{a+h} f(x)\,dx \approx h\left(-\frac1{12}f(a-h) + \frac2{3}f(a) +\frac5{12}f(a+h) \right).$$ If we were to apply this (on the interval $[0, 1]$, say) as an $N$-fold composite rule (meaning that the interval of integration is partitioned into $N$ subintervals of equal length), how many evaluations of the integrand $f$ would be necessary? \item \begin{itemize} \item [(a)] What is the order of accuracy of the composite Simpson rule? \item [(b)] If {\it error} is the error in a 6-fold Simpson rule approximation to an integral, approximately what is the error in a 3-fold Simpson approximation to the same integral? \item [(c)] If {\it error} is the same error, approximately what is the error in a 2-fold Simpson approximation to the same integral? \item [(d)] Let 4.27 be a 6-fold Simpson approximation and 3.97 a 3-fold Simpson approximation to the same integral. Estimate the error in the more accurate result. \end{itemize} % Sec 7.2 \item Do Exercise 6.9 from the textbook. % Sec 8.1 \item This question is based on Section~3.1.2 of the class notes. \begin{enumerate} \item Show that $\exp(A)$ has same eigenvectors as $A$. Recall that $\exp(A)$ is defined by a power series. \item Determine the eigenvalue of $\exp(A)$ that corresponds to an eigenvalue $\lambda$ of $A$. \item What are the eigenvalues of $[v]_\times$? Note that this is well defined for any vector of dimension~3. \item Use your answer to the preceding question to determine the eigenvalues of the rotation matrix for a counterclockwise rotation of $\theta$ radians about an axis $a$. Express your answer using sines and cosines. \item What are the eigenvectors of $[v]_\times$ for $v =\theta\hat{k}$. Use this to determine the eigenvectors of the rotation matrix for a counterclockwise rotation of $\theta$ radians about an axis $\hat{k}$. \end{enumerate} % Sec 8.3 \item Do Exercise 10.16 from the textbook. % Sec 8.4 \item Determine an eigenvalue of {\tt magic(n)}. \end{enumerate} \subsection*{Learning objectives} For quadrature \begin{itemize} \item Apply some simple and useful numerical quadrature rules. \item Define order of accuracy. \item Estimate errors in numerical quadrature. \item Do a linear change of variables in an integral. \item Use the method of undetermined coefficients to construct numerical quadrature rules. \item Determine order of accuracy experimentally. \item Explain why numerical software might fail without informing the user. \item To teach the use of polynomial interpolation to construct numerical quadrature rules. \end{itemize} For eigenvalues and singular values of a real matrix \begin{itemize} \item Define/describe eigenvalue, left and right eigenvector, characteristic polynomial, diagonalizable, eigenvalue decomposition, similarity transformation. \item Calculate by hand the eigenvalue decomposition of a simple matrix. \item Describe the eigenvalue decomposition of a symmetric matrix. \item Define a singular value decomposition. \item Describe how to determine the closest rank $r$ approximation to a matrix. \end{itemize} \end{document}