\documentstyle[a4wide,12pt]{article}

\begin{document}
\section*{Introduction to numerical projects}

Here follows a brief recipe and recommendation on how to write a report for each
project.
\begin{itemize}
\item Give a short description of the nature of the problem and the eventual 
numerical methods you have used.
\item Describe the algorithm you have used and/or developed. Here you may find it convenient
to use pseudocoding. In many cases you can describe the algorithm
in the program itself.

\item Include the source code of your program. Comment your program properly.
\item If possible, try to find analytic solutions, or known limits
in order to test your program when developing the code.
\item Include your results either in figure form or in a table. Remember to
       label your results. All tables and figures should have relevant captions
       and labels on the axes.
\item Try to evaluate the reliabilty and numerical stability/precision
of your results. If possible, include a qualitative and/or quantitative
discussion of the numerical stability, eventual loss of precision etc. 

\item Try to give an interpretation of you results in your answers to 
the problems.
\item Critique: if possible include your comments and reflections about the 
exercise, whether you felt you learnt something, ideas for improvements and 
other thoughts you've made when solving the exercise.
We wish to keep this course at the interactive level and your comments can help
us improve it.
\item Try to establish a practice where you log your work at the 
computerlab. You may find such a logbook very handy at later stages
in your work, especially when you don't properly remember 
what a previous test version 
of your program did. Here you could also record 
the time spent on solving the exercise, various algorithms you may have tested
or other topics which you feel worthy of mentioning.
\end{itemize}



\section*{Format for electronic delivery of report and programs}
%
The preferred format for the report is a PDF file. You can also
use DOC or postscript formats. 
As programming language we prefer that you choose between C/C++ and Fortran90/95.
You could also use Java or Python as programming languages. 
Matlab/Maple/Mathematica/IDL are not allowed as programming
languages for the handins, but you can use them to check your results where possible.
The following prescription should be followed when preparing the report:
\begin{itemize}
\item Use Classfronter to hand in your projects, log in  at 
blyant.uio.no and choose 'fellesrom fys3150 og fys4150'.
Thereafter you will see an icon to the left with 'hand in' or 'innlevering'.
Click on that icon and go to the given project. 
There you can load up the files within the deadline.
\item Upload {\bf only} the report file and the source code file(s) you have developed.
The report file should include all of your discussions and a list of the codes you have developed. 
Do not include library files which are available at the course homepage, unless you have
made specific changes to them.
\item Comments  from us on your projects, approval or not, corrections to be made 
etc can be found under
your Classfronter domain and are only visible to you and the teachers of the course.

\end{itemize}
Finally, 
we do prefer that you work two and two together. Optimal working groups consist of 
2-3 students. You can then hand in a common report. 

\section*{Project 5, Chaos in the driven nonlinear pendulum, deadline   november 14  12pm (midnight)}
For this project you can build upon program programs/chapter13/program1.cpp (or the f90 version).
The angular equation of motion of the pendulum is given by
Newton's equation and with no external force it reads 
\begin{equation}
  ml\frac{d^2\theta}{dt^2}+mgsin(\theta)=0,
\end{equation}
with an angular velocity and acceleration given by
\begin{equation}
     v=l\frac{d\theta}{dt},
\end{equation}
and 
\begin{equation}
     a=l\frac{d^2\theta}{dt^2}.
\end{equation}


We do however expect that the motion will gradually come to an end
due a viscous drag torque acting on the pendulum. 
In the presence of the drag, the above equation becomes
\begin{equation}
   ml\frac{d^2\theta}{dt^2}+\nu\frac{d\theta}{dt}  +mgsin(\theta)=0,
\label{eq:pend1}
\end{equation}
where $\nu$ is now a positive constant parameterizing the viscosity
of the medium in question. In order to maintain the motion against
viscosity, it is necessary to add some external driving force. 
We choose here a periodic driving force. The last equation becomes then
\begin{equation}
   ml\frac{d^2\theta}{dt^2}+\nu\frac{d\theta}{dt}  +mgsin(\theta)=Asin(\omega t),
\label{eq:pend2}
\end{equation}
with $A$ and $\omega$ two constants representing the amplitude and 
the angular frequency respectively. The latter is called the driving frequency.



\begin{enumerate}
\item[a)] Rewrite Eqs.~(\ref{eq:pend1}) and (\ref{eq:pend2}) as dimensionless equations.

\item [b)] Write then a code which solves  Eq.~(\ref{eq:pend1}) using the fourth-order
Runge Kutta method. Perform calculations for at least ten  periods with $N=100$, $N=1000$ and $N=10000$ mesh points
and values of $\nu = 1$, $\nu = 5$ and $\nu =10$.  
Set $l=1.0$ m, $g=1$ m/s$^2$ and $m=1$ kg.  
Choose as initial conditions $\theta(0) = 0.2$ (radians) and $v(0) = 0$ (radians/s). 
Make plots of $\theta$ (in radians) as function of time
and phase space plots of
$\theta$ versus the velocity $v$.
Check the stability of your results as functions of time and number of mesh points. 
Which case corresponds to damped, underdamped and overdamped oscillatory motion?  Comment your results.
\item[c)] Now we switch to Eq.~(\ref{eq:pend2}) for the rest of the project. Add an external driving force and 
set $l=g=1$, $m=1$, $\nu = 1/2$ and $\omega = 2/3$.  
Choose as initial conditions $\theta(0) = 0.2$ and $v(0) = 0$ and $A=0.5$ and $A=1.2$.
Make plots of $\theta$ (in radians) as function of time for at least 300 periods and phase space plots of
$\theta$ versus the velocity $v$. Choose an appropriate time step. Comment and explain the results for the different values of $A$.
\item[d)]  Keep now the constants from the previous exercise fixed but set now $A=1.35$, $A=1.44$ and 
$A=1.465$. Plot $\theta$ (in radians) as function of time for at least 300 periods for these values of $A$ and 
comment your results. 
\item[e)] We want to analyse further these results by making phase space plots of
$\theta$ versus the velocity $v$ using only the points where we have $\omega t=2n\pi$ where $n$ is an integer. These are normally
called the drive periods.
This is an example of what is called a Poincare section and is a very useful way to plot and analyze the behavior of a dynamical
system. Comment your results.
\end{enumerate}


\end{document}




