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


\begin{center}
\Large \bf
Numerieke methoden in de natuurwetenschappen\\
\large 
\vspace{0.2cm}
15-Dec-2000\\
\end{center}
\vspace{0.4cm}
\noindent 
{\bf Ex.~6: The vibrating string: solution with finite differences. }  
Points a) and b) are compulsory, point c)
is facultative but useful.

Consider a vibrating string fixed at both ends ($x=0$ and $x=L=$1~m) and under
a  uniform tension $T=10^3$~N. We wish to find the allowed frequency of 
vibrations 
$\omega$ and the corresponding displacements by solving the equation:
\begin{equation}
{d^2y(x) \over dx^2} + {\omega^2 \mu(x) \over T} y(x) = 0
\end{equation}
where $\mu(x)$ is the mass of the string per unit length. We take first
a constant mass density $\mu_0=0.954$~g/m, and then 
$\mu(x)=\mu_0+(x-{L \over 2})\Delta$ with $\Delta=$0.5~g/m$^2$. In the first 
case the solutions are known and correspond to a sinusoidal motion with 
frequency
\begin{equation}
\omega={n\pi \over L} \sqrt{T/\mu}~~~~~~~~n=1,2,...
\end{equation}
Note that this problem could be also solved by the shooting technique.
\begin{description}
\item {a)} Solve the problem by the finite difference method to find the first 
two eigenvalues and eigenvectors for both constant and variable mass density.
Write the equations onto a grid of 11 and 21 points from 0 to L and compare the results. Find the eigenvalues by searching for the zeroes of the determinant
of the resulting tridiagonal matrix and the eigenvectors by backsubstitution.

\item {b)} Find the lowest eigenvalue by the inverse power method. 

\item {c)} For a number of numerical problems it is customary to use 
libraries of ready-to-use subroutines, such as those of the NAG library,
which can be called from a f77 or f90 program. 
It is useful to learn using them. The first step is to identify the appropriate subroutine, the second to understand which is the required input and 
where the output 
is given. A list of the avalaible subroutines can be found by 
invoking nagdtext or by looking at 
the manuals on paper which can be found in the computer room of mathematics 
on the second floor. A description of how to use them can be found at:

http://www.sci.kun.nl/cncz/software/local/html/nag.html.

In short, you have to give the path by typing:

setenv LD\_LIBRARY\_PATH /usr/lib:/usr/ccs/lib:/usr/local/lib

and compile with the options:


f90 myprog.f90~~  -lnag -lF77

The last option is needed because the NAG library is written in F77.

Find a subroutine which solves the diagonalization problem and use it. 
Check against the results found at point a). 
\end{description}
\end{document}
