Programming Assignment Four


\def\R{{\bf R}}
\hangindent\parindent
\item{6a.}
Solve the initial value problem
$$
    y'=y\sin x\qquad\hbox{where}\qquad y(0)=1$$
exactly by multiplying through by the integrating factor
$$
    \mu=\exp\Big\{\int-\sin x \,dx\Big\}=e^{\displaystyle \cos x}$$
to obtain the equation $(\mu y)'=0$ and then integrating.
Find $y(10)$ exactly.
\medskip
\item{6b.}
Write a program that uses Euler's method
to calculate approximate solutions $\tilde y$
for the above system.
Use your program to find $\tilde y(10)$
using step sizes of
$h=10/n$ where $n$ is $16, 32, 64, 128, \ldots, 1048576$.
\medskip
\item{6c.}
Let ${\it E}=|y(10)-\tilde y(10)|$.
Graph $\log E$ versus $\log h$ to verify
the order of convergence for Euler's method numerically.
\medskip
\item{6d.}
Use Runge-Kutta methods of order 2, 3 and 4
to calculate $\tilde y$.
Graph $\log E$ versus $\log h$ to
verify the order of convergence for each method.
\medskip
\item{6e.}
Extra Credit: Repeat for the initial value problem
$$
    y'-y\sin x=1-x\sin x\qquad\hbox{where}\qquad y(0)=1.$$
Are the results the same?


Last Updated: Thu Apr 19 17:53:44 PDT 2001