% -*- latex -*-
% FILE: "/home/evmik/jobs/wm/2010_fall_practical_computing_for_scientists/sample_report_source/sample_report.tex"
% LAST MODIFICATION: "Wed, 25 Aug 2010 09:54:58 -0400 (evmik)"
% (C) 2010 by Eugeniy Mikhailov, <evgmik@gmail.com>
% $Id:$
\documentclass[letter,12pt]{article}

%---------------------------------------------------------------
\usepackage{listings} % allow to include nicely formated listings
\usepackage{color}    % we can add color
\usepackage{fullpage} % default article style is to gready about margins
%---------------------------------------------------------------

\begin{document}

%---------------------------------------------------------------
\title{Sample of homework report}
\author{Eugeniy E. Mikhailov}
\date{\today}
\maketitle
%---------------------------------------------------------------
\section{Problem 1}
%---------------------------------------------------------------

%---------------------------------------------------------------
\subsection{Problem statement}
%---------------------------------------------------------------
Write a function which finds a maximum out of two user supplied numbers.

%---------------------------------------------------------------
\subsection{Solution}
%---------------------------------------------------------------

First we need to compare two numbers which leads to the straightforward if-else
construct which selects the proper answer. However there is one special case
when both inputs are the same. The comparison should
have $\ge$ comparison operator to include this case into decision
tree. See the resulting function {\it find\_max} in the
listing~\ref{lst:find_max}.

%---------------------------------------------------------------
\lstset{language=matlab}
\lstset{linewidth=\textwidth}
\lstset{commentstyle=\textit, stringstyle=\upshape,showspaces=false}
\lstset{frame=trBL,frameround=tttt}
\lstinputlisting[caption=Find max  code,label=lst:find_max]{find_max.m}
%---------------------------------------------------------------

%---------------------------------------------------------------
\subsection{Test cases}
%---------------------------------------------------------------
To check the validity of the code I tried 3 possible combination of the
input parameters. When first argument is  smaller then second, when
first argument is lager then second, and finally when they are both the
same. The results of the tests are as expected (see
listing~\ref{lst:find_max_output}.
%---------------------------------------------------------------
\lstset{language=matlab}
\lstset{linewidth=\textwidth}
\lstset{commentstyle=\textit, stringstyle=\upshape,showspaces=false}
\lstset{frame=trBL,frameround=tttt}
\lstinputlisting[caption=Find max code test,label=lst:find_max_output]{output.m}
%---------------------------------------------------------------


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