\documentclass[12pt]{article}
\textwidth 16cm
\textheight 25cm
\topmargin -1cm
\evensidemargin 0cm
\oddsidemargin 0cm
\usepackage{epsfig}
\parindent=0pt
\parskip=10pt
\begin{document}


\begin{center}
\Large \bf
Numerieke methoden in de natuurwetenschappen\\
\large 
\vspace{0.2cm}
18-Oct-2000\\
\end{center}
\vspace{0.4cm}
\noindent 
{\bf Ex.~3: General nonlinear least squares fitting}\\

In many experiments it happens that a given line of resonant absorption splits 
under the effect of a given perturbation, such as a magnetic or electric field. In this 
exercise the purpose is to extract the value of the splitting by applying a 
general  nonlinear least squares fitting to the data. In figure we present a 
case rather simple but illustrative of a whole class of problems.
\begin{figure}[h]
\includegraphics{figex3.eps}
%\caption{caption}
\end{figure}
The solid line is the function $f_0^{exp}$ due to resonant absorption at 
frequency $\omega=2.0$ in 
absence of external fields,  the dotted line the function $f^{exp}$ due to a 
splitting of the 
line into two contributions of half intensity and an amount $\Delta\omega$ 
apart. Physical reasons  tell us the line  $f^{exp}$ could be fitted by a 
function $f^{calc}$ which can be expressed in terms of the unperturbed 
lineshape $f_0^{exp}$ as:
\begin{equation}
f^{calc}(\omega_i,\Delta\omega)= {{f_0^{exp}(\omega_i + \Delta\omega/2) + f_0^{exp}(\omega_i - \Delta\omega/2)} \over {2}}
\end{equation}

The interesting point of this exercise is that you do not need to know the  
explicit form giving the shape of the absorption line but you can use the 
unperturbed data $f_0^{exp}$ and formula (1) as fitting function to 
extract $\Delta\omega$ 
by the data representing $f^{exp}(\omega_i)$.

The file splitting.dat contains 4000 values of $\omega$, $f_0^{exp}$ 
and $f^{exp}$ in 
the first, second and third column respectively. Use these values to find 
the value of $\Delta\omega$ with two digit precision. Consider that you have 
data in units of 0.001 and express your tentative values of $\Delta\omega$
in multiples of this value. Besides, since you have to shift $f_0^{exp}$ to
evaluate $f^{calc}(\omega_i,\Delta\omega)$ consider you have less than 4000 points available 
for the fit, namely 4000-($\Delta\omega$/0.001) points. 

In order to facilitate comparison with the formula's given in the 'college',
consider that you have only one fitting parameter so that the vector {\bf a}
has only one element $a_1=\Delta\omega$. Consequently, the matrix $\it{M}$
has only one element so that you have to solve just one equation iteratively.
The function $f^{exp}(\omega_i)$ takes the place of $y_i$ and 
$f^{calc}(\omega_i,\Delta\omega)$ that of $y(x_i, {\bf a})$, $i$ running over the available experimental points.
First you choose an initial guess for $\Delta\omega^0$ and for its increment
$\delta\Delta\omega^0$, calculate the numerical derivative and then solve the 
equation $ \it{M} \delta\Delta\omega= B$ to get the new value of  
$\delta\Delta\omega$. Add this increment (or $\sim$half of it in order to avoid large jumps in the parameters) to the initial $\Delta\omega^0$ and 
repeat until convergence is reached. In doing this keep track of the values 
$\delta\Delta\omega, \Delta\omega$, and of any other quantity of interest
in successive iterations.



\end{document}
