% This is a LaTeX file describing numerical methods for 
% second-order ode
%

\documentstyle[11pt]{article}

\setlength{\textwidth}{6.5in}
\setlength{\oddsidemargin}{0in}
\setlength{\topmargin}{-.2in}
\setlength{\textheight}{9.5in}
\setlength{\headheight}{0in}
\setlength{\headsep}{0in}
\setlength{\parindent}{0pt}
\setlength{\parskip}{5pt}

\begin{document}
\pagestyle{empty}

{\Large\bf Numerical Methods for Second-Order ODE}

\vspace{.3in}

Most ordinary differential equations arising in
real-world applications cannot be solved exactly.
These ode can be analyized qualitatively. However,
qualitative analysis may not be able to give accurate
answers. A {\it numerical method} can be used to get
an accurate approximate solution to a differential
equation. There are many programs and packages
for solving differential equations. With today's
computer, an accurate solution can be obtained 
rapidly. In this section we focus on Euler's method,
a basic numerical method for solving initial
value problems.

Consider the differential equation:

$$
y''=-y'+\sin (ty) \hspace{.2in} y(0)=1, y'(0)=2
$$

The first step is to convert the above second-order
ode into two first-order ode. This is a
standard operation. Let v(t)=y'(t). Then v'(t)=y''(t).
We then get two differential equations. The first
is easy

$$
y'=v
$$

The second is obtained by rewriting the original
ode. Using the fact that y''=v' and y'=v, 

$$
v'=-v+\sin(ty)
$$

The initial conditions are y(0)=1 and y'(0)=v(0)=2. 

We are now ready to approximate the two first-order
ode by Euler's method. A derivation of Euler's method
is given the numerical methods section for first-order
ode. We first discretize the time interval. Let
0=t_0. Let t_1<t_2<t_3< ...  be other points.
We approximate the solution at these gridpoints. 
For simplicity we will assume that the points are
equispaced. In general they need not be.
Let us define z_k be the approximation to y(t) at t_k
and let w_k be the approximation to w(t) at t_k. For
our example we get the following recursion formulas for
z_k and w_k:

$$
z_{k+1}=z_k+\Delta tw_k
$$

$$
w_{k+1}=w_k+\Delta t\{-w_k+\sin(t_kz_k)\}
$$

The initial conditions are z_0=y(0)=1 and w_0=v(0)=2.

Suppose our goal is to compute the solution to the model
differential equation at time t=1. The exact solution,
obtained using an advanced algorithm, is 4.1278. The
following summarizes the results obtained using 
Euler's method. Note that the error decreases as
the number of gridpoints N increases. Here
the stepsize is 1/N. 

\vspace{.3in}

{\bf Summary}

\vspace{.2in}

Consider the second-order ode:

$$
y''=f(t,y,y') \hspace{.2in}y(t_0)=y_0, y'(t_0)=y'_0.
$$

Suppose the goal is solve the problem on the interval
[t_0,T]. The following list summarizes the steps in
solving the problem by Euler's method.

\begin{itemize}
\item Convert the second-order ode into two first-order
ode. Let v=y'. Then the two odes are
$$
y'=v \hspace{.2in} y(t_0)=y_0
$$

$$
v'=f(t,y,v) \hspace{.2in} y(t_0)=y'_0
$$

\item Discretize the interval [t_0,T]. Pick a bunch of points
t_0<t_1<t_2<...<t_N=T. The points need not be equispaced.

\item Let z_k denote the approximation to y(t_k) and let
w_k denote the approximation to v(t_k).

\item Use the formulas 

$$
z_{k+1}=z_k+(t_{k+1}-t_k)v_k \hspace{.2in} z_0=y_0
$$

$$
v_{k+1}=v_k+(t_{k+1}-t_k)f(t,z_k,v_k) \hspace{.2in} v_0=y'_0
$$
to compute the approximate solution for k=0,1,2,...

\end{document}
