\documentclass[11pt]{article} \usepackage{fullpage,amsmath} \newcommand{\T}{^{\mathsf{T}}} % matrix transposition \newcommand{\bfy}{\mathbf{y}} \newcommand{\rmd}{\mathrm{d}} \begin{document} \begin{center} {\Large COMPUTER SCIENCE 614}\\ {\Large Numerical Solution of Ordinary Differential Equations} \\ {\large SPRING 2012} \\ ASSIGNMENT \# 2 (32 points) \\ {\small January 27} \end{center} %\paragraph{Announcement} %\begin{itemize} %\item[] %\end{itemize} \paragraph{Due Friday, February 10 in class} This assignment covers Sections 2.2--4.2 of the class notes, which corresponds to Chapters 3--5 and Sections 2.2, 2.4, 6.1, 6.4, 7.0, 7.2, 12.2 of the textbook. \begin{enumerate} \item (12 points) In this problem, you will solve numerically the initial value problem whose phase portrait is the right half of Figure~1.8 of Griffths \& Higham, {\em except} you will use the range $0\le t\le 20$. Along the way, you will discover a mistake in the textbook. \begin{enumerate} \item Implement the explicit Adams (fixed-stepsize) methods of stepnumber 1, 2, and 3. For the 2-step method, take the 1st step with the 1-step method. For the 3-step method, take the 1st step with the 1-step method and the 2nd with the 2-step method. Normally, when the order is varied, one uses a smaller step size when the order is lower. However, in our case, we are interested primarily in the limit cycle, so the disproportionately large initial error is of no consequence. Include your Matlab (or Octave) code with your submission. \item Let $\mathcal{H} = \{1, 0.5, 0.2, 0.1, 0.05, 0.02, \ldots\}$. Determine the largest stepsize $h\in\mathcal{H}$ for the 1-step method is stable. (Use common sense to decide what is stable!) What is the resulting value? \item Compute numerical solutions using the 1-step method with step size $h$ and with step size $h/2$. Also compute the numerical solution using the 3-step method with stepsize 0.002. We will call this the exact solution. Plot all three as a single figure, so that the three orbits can be distinguished. For example, connect the points with thin lines of different colors (which is the default for Octave). Include your plot with your submission. What do you observe quantitatively? Does it agree with theory? \item Compute numerical solutions using the 1-step method and using the 2-step method, each with step size $h$. Plot the two numerical solutions together with the exact solution as a single figure. Compare the solution of the 2-step method with step size $h$ to that of the 1-step method with step size $h/2$. Which is more accurate? \item Compute the numerical solution using the 3-step method with step size $h$. Plot it together with the exact solution as a single figure. Compare the solution of the 3-step method to that of the 2-step method. Which is more accurate? Which is qualitatively superior? \end{enumerate} \item (4 points) \newcommand{\bff}{\mathbf{f}} \newcommand{\bfw}{\mathbf{w}} \newcommand{\bfx}{\mathbf{x}} Let $\bff(\bfx)$ be a vector of functions of many variables $\bfx$. \begin{enumerate} \item Use the fundamental theorem of calculus to get an expression for the difference $\bff(\bfx +\bfw) -\bff(\bfx)$ solely in terms of values of the Jacobian $\partial\bff/\partial\bfx$. {\em Hint.} Define $\varphi(s) =\bff(\bfx + s\bfw)$. \item Obtain the first two terms in a multivariate Taylor expansion for $\bff(\bfx +\bfw)$ in powers'' of $\bfw$. Do not resort to indexing---stay with the vector notation. \end{enumerate} \newpage \item (8 points) \begin{enumerate} \item Do Exercise~3.8 of the textbook. \item Obtain the first two {\em nonzero} coefficients $c_k(t)$ in an asymptotic expansion $u_n^2 + v_n^2 = c_0(t_n) + h c_1(t_n) + h^2 c_2(t_n) + \cdots$ valid on a fixed finite interval $0\le t_n\le b$. The first nonzero coefficient is $c_0(t)$. Compare the order of accuracy of the preservation of the invariant with that of the numerical solution. \end{enumerate} \item (3 points) Do Exercise~4.3 of the textbook. \item (5 points) Do Exercise~5.12 of the textbook except obtain $A$ and $B$ just for the general case $x_1 = 1 + a h$. Additionally, what value of $a$ corresponds to starting with an Euler step? \end{enumerate} \subsection*{Appendix} Here is an Octave example of a driver for Problem~1: {\small\begin{verbatim} y0 = [1; 5]; tf = 20.; h = whatever; y1 = e_adams(1, h, y0, tf); y1s = e_adams(1, 0.5*h, y0, tf); yx = e_adams(3, 0.002, y0, tf); y2 = e_adams(2, h, y0, tf); y3 = e_adams(3, h, y0, tf); plot(yx(1, :), yx(2, :), y1(1, :), y1(2, :), y1s(1, :), y1s(2, :)) axis([-3 3 -15 15]) print stepsizes.pdf figure() plot(yx(1, :), yx(2, :), y1(1, :), y1(2, :), y2(1, :), y2(2, :)) axis([-3 3 -15 15]) print orders.pdf figure() plot(yx(1, :), yx(2, :), y3(1, :), y3(2, :)) axis([-3 3 -15 15]) print 3rdOrder.pdf \end{verbatim}}\noindent \end{document}