From 6c60fbc7652eb8a01fdb8e8b0b2c59ced16e397e Mon Sep 17 00:00:00 2001
From: Jan Grewe <jan.grewe@g-node.org>
Date: Mon, 29 Oct 2018 21:48:14 +0100
Subject: [PATCH] [exercise5] control flow, some rewording

---
 programming/exercises/control_flow.tex | 47 ++++++++++++++------------
 1 file changed, 26 insertions(+), 21 deletions(-)

diff --git a/programming/exercises/control_flow.tex b/programming/exercises/control_flow.tex
index 725a81e..84d48da 100644
--- a/programming/exercises/control_flow.tex
+++ b/programming/exercises/control_flow.tex
@@ -14,7 +14,7 @@
 %%%%% text size %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \usepackage[left=20mm,right=20mm,top=25mm,bottom=25mm]{geometry}
 \pagestyle{headandfoot}
-\header{{\bfseries\large Exercise 4}}{{\bfseries\large Control Flow}}{{\bfseries\large 30. October, 2017}}
+\header{{\bfseries\large Exercise 5}}{{\bfseries\large Control Flow}}{{\bfseries\large 30. October, 2018}}
 \firstpagefooter{Dr. Jan Grewe}{Phone: 29 74588}{Email:
   jan.grewe@uni-tuebingen.de}
 \runningfooter{}{\thepage}{}
@@ -33,39 +33,44 @@
 \begin{center}
   \textbf{\Large Introduction to scientific computing}\\[1ex]
   {\large Jan Grewe, Jan Benda}\\[-3ex]
-  Abteilung Neuroethologie \hfill --- \hfill Institut f\"ur Neurobiologie \hfill --- \hfill \includegraphics[width=0.28\textwidth]{UT_WBMW_Black_RGB} \\
+  Neuroethologie \hfill --- \hfill Institute for Neurobiology \hfill --- \hfill \includegraphics[width=0.28\textwidth]{UT_WBMW_Black_RGB} \\
 \end{center}
 
-The exercises are meant for self-monitoring, revision of the lecture
-topic. You should try to solve them on your own. Your solution should
-be submitted as a single script (m-file) in the Ilias system. Each
-task should be solved in its own ``cell''. Each cell must be
-executable on its own. The file should be named according to the following pattern:
-``variables\_datatypes\_\{lastname\}.m'' benannt werden
+The exercises are meant for self-monitoring and revision of the
+lecture. You should try to solve them on your own. Your solution
+should be submitted as a single script (m-file) in the Ilias
+system. Each task should be solved in its own ``cell''. Each cell must
+be executable on its own. The file should be named according to the
+following pattern: ``variables\_datatypes\_\{lastname\}.m''
 (e.g. variables\_datentypes\_mueller.m).
 
 \begin{questions}
   \question Implement \code{for} loops in which the  \emph{running variable}:
   \begin{parts}
     \part ... assumes values from 0 to 10. Print the value of the running variable for each iteration step.
+    \begin{solution}
+      for i = 1:10
+      disp(i);
+      end;
+    \end{solution}
     \part ... assumes values from 10 to 0. Print out the value for each iteration.
     \part ... assumes values from 0 to 1 in steps of 0.1. Print out the value for each iteration.
   \end{parts}
 
-  \question Indexing in vectros:
+  \question Indexing in vectors:
   \begin{parts}
-    \part Define a vector \code{x} that contains values from 1:100.
+    \part Define a vector \code{x} that contains values ranging from 101 to 200.
     \part Use a \code{for} loop to print each element of \code{x}. Use the running variable for the indexing.
     \begin{solution}
       \code{for i = 1:length(x); disp(x(i)); end}
     \end{solution}
-    \part Do the same without using the running variable for indexing.
+    \part Do the same without use the running variable directly (not for indexing).
     \begin{solution}
       \code{for i : x; disp(i); end;}
     \end{solution}
   \end{parts}
 
-  \question Create a vector \verb+x+ that contains 50 random numbers in the range 0 - 10.
+  \question Create a vector \verb+x+ that contains 50 random numbers in the value range 0 - 10.
   \begin{parts}
     \part Use a loop to calculate the arithmetic mean. The mean is defined as:
     $\overline{x}=\frac{1}{n}\sum\limits_{i=0}^{n}x_i $.
@@ -74,20 +79,20 @@ executable on its own. The file should be named according to the following patte
     \part Search the MATLAB help for functions that do the calculations for you :-).
   \end{parts}
 
-  \question Implement a\code{while} loop
+  \question Implement a \code{while} loop
   \begin{parts}
-    \part ... that iterates  100 times. Print out the current iteration number.
+    \part ... that iterates 100 times. Print out the current iteration number.
     \part ... iterates endlessly. You can interrupt the execution with the command \code{Strg + C}.
   \end{parts}
 
-  \question Use an endless \code{while} loop to individually print out the elements of a vector that contains 10 elements.
+  \question Use an endless \code{while} loop to individually print out the elements of a vector that contains 10 elements. Stop the execution after all elements have been printed.
 
   \question Use the endless \verb+while+ loop to draw random numbers
-  (\verb+randn+) until you it is larger than 1.33.
+  (\verb+randn+) until you hit one that is larger than 1.33.
   \begin{parts}
     \part Count the number of required iterations.
-    \part Use a \code{for} loop to run the previous test 1000 times. Remeber all counts and calculate the mean of it.
-    \part Create a plot that schows for each of the 1000 trials, how often you had to draw.
+    \part Use a \code{for} loop to run the previous test 1000 times. Remember all counts and calculate the mean of it.
+    \part Create a plot that shows for each of the 1000 trials, how often you had to draw.
     \part Play around with the threshold. What happens?
   \end{parts}
 
@@ -100,19 +105,19 @@ executable on its own. The file should be named according to the following patte
   \end{parts}
 
   \question Test the random number generator! To do so count the
-  number of elements that fall in the classes defined by the edges
+  number of elements that fall into the classes defined by the edges
   [0.0, 0.2, 0.4, 0.6, 0.8, 1.0]. Store the results in a vector. Use a
   loop to draw 1000 random numbers with \verb+rand()+ (see help). What
   would be the expectation? What is the result?
 
-  \question String parsing: It is quite common to use the names of datasets to encode the conditions under which they were recorded. To find out the required information we have to \emph{parse} he name.
+  \question String parsing: It is quite common to use the names of datasets to encode the conditions under which they were recorded. To find out the required information we have to \emph{parse} the name.
   \begin{parts}
     \part Create a variable
     \verb+filename = '2015-10-12_100Hz_1.25V.dat'+. Obviously, the
     underscore was used as a delimiter.
     \part Use a \verb+for+ loop to find the positions of the underscores and store these in a vector.
     \part Use a second loop to iterate over the previously filled `position' vector and use this information to
-    cut filename appropriately.
+    cut \verb+filename+ appropriately.
     \part Print out the individual parts.
   \end{parts}