\documentstyle[12pt]{article}
\textwidth 16cm
\textheight 23cm
\topmargin 0cm
\evensidemargin 0cm
\oddsidemargin 0cm
\parindent=0pt
\parskip=10pt
\begin{document}

\begin{center}
\Large \bf
Numerieke methoden in de natuurwetenschappen\\
\large 
\end{center}
\vspace{0.4cm}
\noindent 
{\bf Solution of initial value differential equation}

In this exercise you will solve the same problem with five different 
algorithms. In the final report you should 
comment about the advantages/disadvantages of each method.

We will consider a model that can describe the dynamics of a population
from a given initial value. Since we are concerned here
with the rate of change of a quantity (the population) in time, we can solve
this problem by means of a differential equation. In particular, the
{\bf logistic model} is described by the following non-linear equation:
\begin{equation}
\frac{dP}{dt} = kP\left(1-\frac{P}{M}\right)
\label{logmod}
\end{equation}
where $P(t)$ is the population, $k$ is the constant growth rate, and $M$ is a
limiting size for the population. In particular, it represents the maximum
value of the population that the environment can sustain (this is the reason 
why it also called the {\bf carrying capacity}). Note also that the sign of $k$ determines
if the population grows or decreases.
Choose as values for these coefficients $k=0.2$ and
$M=200$, and as initial value for the population $P(0)=150$ (Question: what 
happens if $P<<M$?). It is straightforward to see that, if $k>0$:
\begin{equation}
\lim_{t\rightarrow\infty}P(t) = M
\label{lim}
\end{equation}
Eq.~(\ref{logmod}) can be solved analytically, and the exact solution 
provides you with the possibility of checking the numerical error.
Furthermore, population growth exhibits in time different regimes 
(linear, rapidly varying, constant), which
will help you to appreciate the advantages of adjustable step algorithms.

In writing the program, keep all subroutines for integration in a separate 
module which does use any other module. All quantities needed are passed as 
arguments of the call and as external functions. In this way, you can directly 
use these subroutines also for other problems in the future. Make also use of 
an input file to read initial conditions and other input parameters.

\begin{enumerate}
 \item Find the analytical solution of Eq.~(\ref{logmod}). Hint: even if
       the differential equation is not linear, it is still separable.

 \item Use the  simple Euler method, one of the Runge-Kutta methods of order 2
(Midpoint, Modified Euler, Heun) and the 
Runge-Kutta method of order 4 
to calculate population evolution  for $0 < t < 70$ distributed over a 
uniform grid with spacing $\delta t$. In order to find an appropriate value for the time 
step $\delta t$ check the results against the expected 
behaviour and value of  $P_{lim}$.  

\item Use the  Runge Kutta method with adaptive step size and the Runge-Kutta-Fehlberg
methods
to find population evolution in the same range as the previous point 
with tolerance 10$^{-3}$ and 10$^{-4}$. Compare the solutions and the
steps used in the calculation.

\end{enumerate}

\end{document}
