% -*- latex -*-
\documentclass[letter,12pt]{article}
%---------------------------------------------------------------
%\usepackage{listings}
\usepackage[framed]{matlab-prettifier}
\usepackage{color}
\usepackage{fullpage}
\usepackage{enumitem} % control over itemize, list environment
%---------------------------------------------------------------

\begin{document}
\newcommand{\hwtitle}[1]{%
	\begin{center}
		\Large  \bf Midterm #1%
	\end{center}%
}

\newcommand{\mat}[1]{% matlab code
%{\color{blue}\texttt{#1}}%
	% this one does not work inside of captions
	{\lstinline[style = Matlab-editor, basicstyle = \mlttfamily, columns=fixed]!#1!}%
	% this one work but style is different
	%{\lstinline[columns=fixed]!#1!}%
}
%---------------------------------------------------------------
\newcommand{\problem}[1]{% homework problem
	%{\item  \bf #1%}
\item {\bf #1{}:}% the next blank line is important

}

\newenvironment{homework}[2]%
{%
	\hwtitle{#1}
	#2% Prerequisits

	\begin{enumerate}[
		label={\bf Problem\ \arabic*}, 
		leftmargin=0pt,
		start,
		labelindent=0pt,
		widest=20, align=left, itemindent=!
		]
}%
{%
	\end{enumerate}
}%
%---------------------------------------------------------------

\begin{homework}{01 (100 points)}{
%Prerequisites

\begin{itemize}
	\item 
		One report per team is enough, but make sure everyone is
		listed in the authors list.
	\item
		Discuss the relevant physics equations, describe your solution, show
		results. Report page limit is 10 pages excluding listings which should be
		in appendixes, font size to be no less than 12pt. 
		The emailed submission must have all relevant listings in the attachments.
\end{itemize}

\vskip .5in
%Problem statement
%---------------------------------------------------------------

Your company just bought a new ship (actually a barge)
with name which reads something  ``...  ... fitted''.
May be it is ``Sea worthy fitted''.

Unfortunately, not much
is known about it. You know that the ship has length $L=50$~m and exactly the
same cross section, orthogonal to the long side, through the whole length of the ship. Yep,
nobody tried to reduce the drag, looks like designers were not worried
about a fuel price tag.

Luckily, you were able to find the original designer of
this ship, and she recalled, that the ship 
cross section (orthogonal to the long side) is described by the following formula
\begin{equation}
	\label{eq:hull}
	y =  \Re \left( 
		a \sqrt{1 - \left(\frac{x}{b}\right)^2} 
		+ \frac{a}{2} \sqrt{1 - \left(\frac{x}{2 b}\right)^4} 
		+ c \exp(-|x|/d)
		+e
	\right)
\end{equation}
where $y$ is the position measured from the maximum capacity waterline; 
$\Re$ stands for the real part of the expression,
$x$ is the horizontal distance from
the center line; $a, b, c, d$, and $e$
are some unknown parameters, but definitely
$a <0$ and $c<0$. Easy to
see, that at least there is  symmetry with respect to the $y$ axis. But none of the relevant
parameters are known. 

Being a big boss, you send a young apprentice
to do some measurements of the hull to recover the $a, b, c, d$, and
$e$ parameters. She comeback with a data file which has measurements only
of the starboard side of the ship. They are in the data file
\mat{'hull_shape.dat'} where all
measurements are in meters, the first column is $x$ position and the second
one is $y$.

At this point you begins to  realize, that 
the actual name of the ship is ``To be fitted'' and nobody but you 
has the required training to do it.
}

\vskip .2in
%---------------------------------------------------------------
\problem{}

Find the unknown coefficients describing the hull shape. Do not forget the
uncertainties.

\vskip .2in
%---------------------------------------------------------------
\problem{}

Estimate the precision of the $y$ measurements done by the apprentice.

%---------------------------------------------------------------
\problem{}
Find the weight which this ship can carry when it is submerged to the
maximum capacity waterline.
Recall the buoyancy force expression: this force is equivalent to the
weight of the displaced water.

Note, with this ``elegant'' hull
shape, she cannot  be used in a sea voyage, so we are limited to a fresh
water environment where density of water $\rho = 1000$~kg/m${}^3$.
Assume, that your company stuck gold and bought the ship made from the exotic
unobtanium material which is very strong and lightweight, so, in your
calculations, you can disregard volume and mass taken by the hull.


%---------------------------------------------------------------
\problem{}

Find the weight which this ship can carry when it submerged to the point
$y_m = 3a/4$.
Report, how far from the center line ($y$ axis) the hull meets the water.

%---------------------------------------------------------------
\problem{Bonus (10 points)}

Similar to problem 3. Find a maximum load capacity  for a more elegant
hull shape cross section. The cross section is described by the same expression as equation~\ref{eq:hull}
but coefficients $b$ and $d$ have the following dependence on $z$
\begin{equation}
	b(z)=b_0 f(z), 
\end{equation}
\begin{equation}
	d(z)=d_0 f(z),
\end{equation}
where
\begin{equation}
	f(z) =
	1- \tanh \left( 10 \left(\frac{2|z|}{L}\right)^8 \right)
\end{equation}
Here $b_0$ and $d_0$ are equal to values $b$ and $d$ found in 
problem 1; $z$ is distance from the center of the ship measured along
the long side.

\end{homework}
%---------------------------------------------------------------
\end{document}
%---------------------------------------------------------------
