[exercises] translation

This commit is contained in:
Jan Grewe 2017-10-24 08:16:51 +02:00
parent 99fac2be07
commit ee18cd17d1

View File

@ -14,8 +14,7 @@
%%%%% text size %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[left=20mm,right=20mm,top=25mm,bottom=25mm]{geometry}
\pagestyle{headandfoot} \header{{\bfseries\large \"Ubung
3}}{{\bfseries\large Boolesche Ausdr\"ucke, logisches
Indizieren}}{{\bfseries\large 31. Oktober, 2016}}
3}}{{\bfseries\large Boolean Expressions and logical indexing}}{{\bfseries\large 24. Oktober, 2017}}
\firstpagefooter{Dr. Jan Grewe}{Phone: 29 74588}{Email:
jan.grewe@uni-tuebingen.de} \runningfooter{}{\thepage}{}
@ -31,25 +30,24 @@
\vspace*{-6.5ex}
\begin{center}
\textbf{\Large Einf\"uhrung in die wissenschaftliche Datenverarbeitung}\\[1ex]
\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} \\
\end{center}
Die folgenden Aufgaben dienen der Wiederholung, \"Ubung und
Selbstkontrolle und sollten eigenst\"andig bearbeitet und gel\"ost
werden. Die L\"osung soll in Form eines einzelnen Skriptes (m-files)
im ILIAS hochgeladen werden. Jede Aufgabe sollte in einer eigenen
``Zelle'' gel\"ost sein. Die Zellen \textbf{m\"ussen} unabh\"angig
voneinander ausf\"uhrbar sein. Das Skript sollte nach dem Muster:\newline
``boolesche\_ausdruecke\_\{nachname\}.m'' benannt werden
(z.B. variablen\_datentypen\_mueller.m).
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
(e.g. variables\_datentypes\_mueller.m).
\section{Boolesche Ausdr\"ucke}
\section{Boolean expressions}
\begin{questions}
\question Gegeben sind zwei Vektoren \verb+x = [1 5 2 8 9 0 1]+ und
\verb+y = [5 2 2 6 0 0 2]+. F\"uhre aus und erkl\"are.
\question Consider the following vectors \verb+x = [1 5 2 8 9 0 1]+ and
\verb+y = [5 2 2 6 0 0 2]+. Execute the following commands and explain.
\begin{parts}
\part \verb+x > y+
\part \verb+y < x+
@ -59,32 +57,29 @@ voneinander ausf\"uhrbar sein. Das Skript sollte nach dem Muster:\newline
\part \verb+x | y+
\end{parts}
\question Finde heraus, was die Funktionen \verb+bitand+ und \verb+bitor+ machen.
\question Find out what the functions \verb+bitand+ and \verb+bitor+ do.
\begin{parts}
\part F\"uhre aus und erkl\"are: \verb+bitand(10, 8)+
\part F\"uhre aus und erkl\"are: \verb+bitor(10, 8)+
\part Execute and explain: \verb+bitand(10, 8)+
\part Execute and explain: \verb+bitor(10, 8)+
\end{parts}
\item Implementiere folgende Boolesche Ausdr\"ucke. Teste mit
zuf\"alligen ganzzahlingen Werten f\"ur \verb+x+ und \verb+y+.
\item Implemen the following Boolean expressions. Test using randomly selected integer values for \verb+x+ and \verb+y+.
\begin{parts}
\part Das Ergebnis sei wahr, wenn \verb+x+ gr\"o{\ss}er als \verb+y+ und die
Summe aus \verb+x+ und \verb+y+ nicht kleiner als 100 ist.
\part Das Ergebnis sei wahr, wenn \verb+x+ und \verb+y+ ungleich 0
oder \verb+x+ und \verb+y+ gleich sind.
\part The result should be \verb+true+ if \verb+x+ greater than \verb+y+ and the sum of \verb+x+ and \verb+y+ is not less than 100.
\part The result shoudl be \verb+true+ if \verb+x+ and \verb+y+ are not equal zero or \verb+x+ and \verb+y+ are equal.
\end{parts}
\end{questions}
\newpage
\section{Logische Indizierung}
\section{Logical Indexing}
Boolesche Ausdr\"ucke k\"onnen benutzt werden um aus Vektoren und
Matrizen die Elemente herauszusuchen, die einem bestimmeten Kriterium
entsprechen.
Boolean expressions can be used to select elements of vectors or
matrices that match in certain criteria. This process is called
logical indexing.
\begin{questions}
\question Gegeben sind \verb+x = (1:10)+ und
\verb+y = [3 1 5 6 8 2 9 4 7 0]+. Versuche die Ausgaben folgender
Anweisungen zu verstehen. Erkl\"are die Ergebnisse.
\question Given are the vectors \verb+x = (1:10)+ and
\verb+y = [3 1 5 6 8 2 9 4 7 0]+. Try to understand the results of
the following commands. Explain.
\begin{parts}
\part \verb+x < 5+
\part \verb+x( x < 5) )+
@ -93,15 +88,11 @@ entsprechen.
\part \verb+x( (x == 0) & (y == 0) )+
\end{parts}
\question Teste den Zufallsgenerator:
\question Test the random number generator:
\begin{parts}
\part Erzeuge eine 100x100 2-D Matrize mit Zufallswerten zwischen
0 und 100 (\verb+randi+). Ersetze die Werte der Elemente, die in
folgende Klassen fallen: \verb+x < 33+ mit 0,
\verb+x >= 33 und x < 66+ mit 1 und alle \verb+x >= 66+ auf 2.
\part Ermittle die Anzahl Elemente f\"ur jede Klasse mithilfe eines
Booleschen Ausdrucks (\verb+sum+ kann eingesetzt werden um die
Anzahl Treffer zu ermitteln).
\part Create a 100x100 2-D matrix that is filled with random numbers in the range 0 to 100 (\verb+randi+). Replace the elements according to these rules: \verb+x < 33+ to 0,
\verb+x >= 33 and x < 66+ to 1 and all \verb+x >= 66+ to 2.
\part Count the number of elements in each class using Boolean expressions (\verb+sum+ can be used to count the matches).
\end{parts}
\end{questions}