% -*- latex -*-
% FILE: "/home/evmik/jobs/wm/2011_fall_practical_computing_for_scientists/hw06/hw06.tex"
% LAST MODIFICATION: "Sun, 16 Oct 2011 21:55:49 -0400 (evmik)"
% (C) 2010 by Eugeniy Mikhailov, <evgmik@gmail.com>
% $Id:$
\documentclass[letter,12pt]{article}

%---------------------------------------------------------------
\usepackage{listings}
\usepackage{color}
\usepackage{fullpage}
%---------------------------------------------------------------

\begin{document}
\newcommand{\problem}[1]{%
	{\flushleft  \bf #1\\}
}
\newcommand{\hw}[1]{%
	\begin{center}
		\Large  \bf Homework #1%
	\end{center}%
}
\newcommand{\mat}[1]{% matlab code
{\color{blue}\texttt{#1}}%
}

%---------------------------------------------------------------
\hw{06}
General comments: 
\begin{itemize}
	\item Do not forget to run some test cases. 
\end{itemize}


\problem{Problem 1 (2 points)}
%---------------------------------------------------------------
Prove that for the golden section algorithm $R$ is still given by the same
expression even if we need to choose $a'=x_1$ and
$b'=b$.

\problem{Problem 2 (3 points)}
%---------------------------------------------------------------
Assuming that initial spacing  between  initial bracket points is $h$.
Estimate (analytically) how many iterations it requires to narrow the bracket to
the $10^{-8}\times h$ space.


\problem{Problem 3 (5 points)}
%---------------------------------------------------------------
Implement the golden section algorithm.
Do not forget to check your code with simple
test cases.
Find where the function
$E(X)=x^2-100*(1-\exp(-x))$ has a minimum. 


\problem{Problem 4 (5 points)}
%---------------------------------------------------------------
For the coin flipping game described on lecture 12, find the optimal
(maximizing your gain)
betting fraction using the golden section algorithm and Monte Carlo
simulation. Feel free to reuse provided complimentary codes. 

Note: you need a lot of game runs (at least a 1000) to have reasonably
small uncertainty for the merit function evaluations. I would suggest
to average at least  1000 runs with length of 100 coin flips  each.

\problem{Problem 5 (5 points)}
%---------------------------------------------------------------
Find the point where function 
\begin{eqnarray*}
F(x,y,z,w,u)=(x-2)^2 + (y-1)^4 + (u-z)^2 + (u-2*w)^2 + (u-6)^2 + 11 
\end{eqnarray*}
has a minimum. What is the value of
$F(x,y,z,w,u)$ at this point?

\problem{Problem 6 (5 points)}
%---------------------------------------------------------------
You are making speed detector based on the Doppler effect. You device detects
dependence of the signal strength vs time, which recorded in the
'hw\_fit\_cos\_problem.dat' file (first column is time and second is the
signal strength).

Fit the data with 
\begin{eqnarray*}
	A \cos(\omega t +\phi)
\end{eqnarray*}
where $A$,  $\omega$ and $\phi$ are the amplitude, the frequency and the phase of the signal, and $t$ is time.

Find fit parameters: the amplitude, the frequency and the phase of the
signal. 
\end{document}
%---------------------------------------------------------------
