%*******************************************************************************%*
%*   SET-UP
%*
%*******************************************************************************
\documentstyle[fancyheadings, titlepage, fleqn, art12]{article}

%\documentstyle[12pt,titlepage]{article}

\setlength{\topmargin}{-0.6in}          %for dvi-imagen
\setlength{\oddsidemargin}{0.1in}       %prev:-0.1 for dvi-imagen, -ve needed.
\setlength{\headheight}{.3in}
\setlength{\headsep}{.3in}
\setlength{\textheight}{9.0in}
\setlength{\textwidth}{6.6in} 
\setlength{\marginparwidth}{0in}
\setlength{\marginparsep}{0in}
\setlength{\marginparpush}{0in}
\setcounter{secnumdepth}{2}     %to get numbers on subsubsection in text
                                %d\setlength{\topmargin}{-0.6in}                for dvi-imagen
\setlength{\oddsidemargin}{0.1in}       %prev:-0.1 for dvi-imagen, -ve needed.
\setlength{\headheight}{.3in}
\setlength{\headsep}{.3in}
\setlength{\textheight}{8.8in}
\setlength{\textwidth}{6.4in} 
\setlength{\marginparwidth}{0in}
\setlength{\marginparsep}{0in}
\setlength{\marginparpush}{0in}
\setcounter{secnumdepth}{2}     %to get numbers on subsubsection in text
                                %default is 2.
\setcounter{tocdepth}{2}        %to get numbers on subsubsection in toc
                                %default is 2.
\setlength{\unitlength}{1mm}
\renewcommand{\baselinestretch}{1.2}  % 1.6 for kind of double spacing
                                      % 1.2 for normal


%\setlength{\parskip}{.3in}
\setlength{\parindent}{0.2in} %JUST CHANGED FROM 0.2
\input{psfig}
\begin{document}
\bibliographystyle{plain}

\pagestyle{fancyplain}
\rhead{\rm\thepage}
\headrulewidth1.5pt
%\footrulewidth0.9pt
\footrulewidth1.5pt
\cfoot{\scriptsize }

\include{epsf}
\input{psfig}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\normalsize



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%                   NEW COMMAND FOR ALGORITHMS
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\newenvironment{code}
   { \begin{scriptsize} \begin{tabbing}    }{ \end{tabbing} \end{scriptsize} }

\newenvironment{Table}
   { \begin{scriptsize} \begin{table}[htb]    }{ \end{table} \end{scriptsize} }

\newcommand{\ttl}{\footnotesize\it}  % title font
\newcommand{\Settab}
   {***\=***\=***\=***\=***\=***\=***\=***\=***\=***\=***\=***\= \kill}

\newcommand{\Line}{
   \noindent \mbox{}\hrulefill\mbox{} }

\newcommand{\LF}{\mbox{} \\}

\newcommand{\1}{{\/\em [}}
\newcommand{\2}{{\/\em ]}}
\newcommand{\3}{{\/\em (}}
\newcommand{\4}{{\/\em )}}solution|
\newcommand{\For}{{\bf for \/}}
\newcommand{\Endfor}{{\bf endfor \/}}
\newcommand{\To}{{\/ \bf to \/}}
\newcommand{\Downto}{{\/ \bf downto \/}}
\newcommand{\If}{{\bf if \/}}
\newcommand{\Endif}{{\bf endif \/}}
\newcommand{\Then}{{\bf then \/}}
\newcommand{\Else}{{\bf else \/}}
\newcommand{\Do}{{\/ \bf do \/}}
\newcommand{\Repeat}{{\bf repeat \/}}
\newcommand{\Until}{{\bf until \/}}
\newcommand{\While}{{\bf while \/}}
\newcommand{\Endwhile}{{\bf endwhile \/}}
\newcommand{\End}{{\bf end \/}}
\newcommand{\Begin}{{\bf begin \/}}
\newcommand{\Procedure}{{\bf procedure \/}}
\newcommand{\Function}{{\bf function \/}}
\newcommand{\HFunction}{{\bf handler--function \/}}
\newcommand{\Arrow}{$\leftarrow$ \/}
\newcommand{\Case}{{\bf case \/}}
\newcommand{\Of}{{\/ \bf of \/}}
\newcommand{\Call}{{\bf call \/}}
\newcommand{\Return}{{\bf return \/}}
\newcommand{\Not}{{\bf not \/}}
\newcommand{\Asynrec}{{\bf asynchronous receive \/}}
\newcommand{\Xor}{{\bf XOR \/}}
\newcommand{\Send}{{\bf send \/}}
\newcommand{\Receive}{{\bf receive \/}}


\section{Results}
\begin{verbatim}


=============================
N=2000, h=0.001
=============================
t(time point)   w(approximation)
--------------------------------
0.000     0.500000000000000000    0.500000000000000000
0.200     0.829298620919911911    0.829298620919911911
0.400     1.214087651179356353    1.214087651179356353
0.600     1.648940599804728624    1.648940599804728624
0.800     2.127229535753742962    2.127229535753742962
1.000     2.640859085770443926    2.640859085770443926
1.200     3.179941538631678277    3.179941538631678277
1.400     3.732400016577594570    3.732400016577594570
1.600     4.283483787802350840    4.283483787802350840
1.800     4.815176267793400910    4.815176267793400910
2.000     5.305471950534498937    5.305471950534498937
Cumulative Error: 5.9608e-13
|Yn - correct_value| : 0.000000000000000000
|Yn - correct_value|/h^4 : 0.000000000000000000

=============================
N=400, h=0.005
=============================
t(time point)   w(approximation)
--------------------------------
0.000     0.500000000000000000    0.500000000000000000
0.200     0.829298620917919838    0.829298620919911911
0.400     1.214087651174541538    1.214087651179356353
0.600     1.648940599795940321    1.648940599804728624
0.800     2.127229535739452615    2.127229535753742962
1.000     2.640859085748648472    2.640859085770443926
1.200     3.179941538599753592    3.179941538631678277
1.400     3.732400016532125164    3.732400016577594570
1.600     4.283483787738902038    4.283483787802350840
1.800     4.815176267706243962    4.815176267793400910
2.000     5.305471950416249527    5.305471950534498937
Cumulative Error: 3.9793e-10
|Yn - correct_value| : 0.000000000118249410
|Yn - correct_value|/h^4 : 0.189199056421784889

=============================
N=200, h=0.010
=============================
t(time point)   w(approximation)
--------------------------------
0.000     0.500000000000000000    0.500000000000000000
0.200     0.829298620888197724    0.829298620919911911
0.400     1.214087651103626042    1.214087651179356353
0.600     1.648940599667046980    1.648940599804728624
0.800     2.127229535530384297    2.127229535753742962
1.000     2.640859085430221409    2.640859085770443926
1.200     3.179941538133793433    3.179941538631678277
1.400     3.732400015868910792    3.732400016577594570
1.600     4.283483786813928162    4.283483787802350840
1.800     4.815176266436112407    4.815176267793400910
2.000     5.305471948693464945    5.305471950534498937
Cumulative Error: 6.2020e-09
|Yn - correct_value| : 0.000000001841033992
|Yn - correct_value|/h^4 : 0.184103399192281331

=============================
N=100, h=0.020
=============================
t(time point)   w(approximation)
--------------------------------
0.000     0.500000000000000000    0.500000000000000000
0.200     0.829298620414921750    0.829298620919911911
0.400     1.214087650007202202    1.214087651179356353
0.600     1.648940597694742216    1.648940599804728624
0.800     2.127229532348099639    2.127229535753742962
1.000     2.640859080598850994    2.640859085770443926
1.200     3.179941531079105932    3.179941538631678277
1.400     3.732400005843240720    3.732400016577594570
1.600     4.283483772847521465    4.283483787802350840
1.800     4.815176247275439358    4.815176267793400910
2.000     5.305471922723098643    5.305471950534498937
Cumulative Error: 9.3935e-08
|Yn - correct_value| : 0.000000027811400294
|Yn - correct_value|/h^4 : 0.173821251836514507

=============================
N=50, h=0.040
=============================
t(time point)   w(approximation)
--------------------------------
0.000     0.500000000000000000    0.500000000000000000
0.200     0.829298612665408497    0.829298620919911911
0.400     1.214087633325071414    1.214087651179356353
0.600     1.648940568504594584    1.648940599804728624
0.800     2.127229485929060360    2.127229535753742962
1.000     2.640859010752749203    2.640859085770443926
1.200     3.179941429707732858    3.179941538631678277
1.400     3.732399862410829883    3.732400016577594570
1.600     4.283483573698356750    4.283483787802350840
1.800     4.815175974768772349    4.815176267793400910
2.000     5.305471554137950463    5.305471950534498937
Cumulative Error: 1.3489e-06
|Yn - correct_value| : 0.000000396396548474
|Yn - correct_value|/h^4 : 0.154842401747790043



\end{verbatim}


\section{Discussion}

Let $\phi$ be the solution of the differential equation
\begin{equation}
 y' = f(t, y)
\end{equation}
which satisfies the initial condition
\begin{equation}
 \phi(t_0) = y_0
\end{equation}

In this problem, I wrote the ordinary diffrential equation 
solver by using Adams Fourth-Order Predictor-Corrector 
Problem is to solve the initial value problem
\begin{eqnarray}
   y' = y - t^2 + 1 \\
   0 \le t \le 2 \\
   y(0) = 0.5
\end{eqnarray}

The exact solution for this odinary diffresntial equation is 
\begin{equation}
 \phi(t) = -0.5e^t + t^2 + 2t + 1
\end{equation}

Adams-Brashforth algorithm is
\begin{equation}
 x(t+h) = x(t) + \frac{h}{24}[55f(x(t)) - 59f(x(t-h)) + 37f(x(t-2h))
         - 9f(x(t-3h))]
\end{equation}

If the solution x has been computed at the four points t, t-h, t-2h, and 
t-3h, then above formula can be used to compute x(t+h). If this is done
systematically, then only one evaluation of f is required for each step.
This represents a considerable saving over fourth-order Runge-Kutta
procedure. In practice, above formula used as predictor.
The corrector usually used with above formula is the Adams-Moulton formula:
\begin{equation}
 x(t+h) = x(t) + \frac{h}{24}[9\tilde{f}(x(t+h)) + 19f(x(t)) - 5f(x(t-h))
         + 9f(x(t-2h))]
\end{equation}

Here $\tilde{f}(x(t+h))$ is the predicted value of x(t+h) computed from 
above formula. The combination of the two formulas results in a predictor-correntor scheme.

It is interesting to compare an m-step Adams-Bashforth explicit method to
an (m-1) step Adams-Moulton implicit methos. Both require m evaluation
of f per step, and both have the terms $y^{m+1}(\mu_i)h^m$ in their local
trucation error. In general, the coefficients of the terms involving f
and in the local trucation error are smaller for the implicit methods 
than the implicit methods. This leads to greater stability and smaller 
rouding errors for the implicit methods.

Adams-Bashforth Four step methods has local trucation error 
$\frac{25}{720}y^{5}(\mu_i)h^4$ and Adams-Moulton Three step methods has local trucation error $\frac{19}{720}y^{5}(\mu_i)h^4$. Therefore, total 
error is $O(h^4)$. This experiments prove that the Adams Fourth-Order 
Predictor-Correct algorithm exhibits fourth-order convergence. 

This experiments prove that the Adams Fourth-Order Predictor-Corrector algorithm exhibits
fourth-order convergence. We can see the experimental results as the table:
 
\begin{Table}
  \begin{center}
  \caption{Experimental Convergence Order}
  \begin{tabular}{|c|c|c|c|}\hline
 $h \; (Time \: Step) $ & $y_n \; (t = 2.0)$ & $|y_n - solution|$ & $ \frac{|y_n - solution|}{h^4}$ \\ \hline \hline
 0.005 & 5.305471950416249527 & 0.000000000118249410 & 0.189199056421784889 \\ \hline
 0.010 & 5.305471948693464945 & 0.000000001841033992 & 0.184103399192281331 \\ \hline
 0.020 & 5.305471922723098643 & 0.000000027811400294 &  0.173821251836514507 \\ \hline
 0.040 & 5.305471554137950463 & 0.000000396396548474 & 0.154842401747790043 \\ \hline
  \end{tabular}
  \end{center}
\end{Table}
 
\end{document}

\end{document}

