Bool done

This commit is contained in:
Jan Grewe 2014-10-08 14:56:48 +02:00
parent 4851365afc
commit e81498d095
7 changed files with 114 additions and 59 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

View File

@ -672,21 +672,58 @@
\begin{frame}[plain] \begin{frame}[plain]
\huge{Boolesche Operationen} \huge{3. Boolesche Operationen}
\end{frame} \end{frame}
\begin{frame} \begin{frame}
\frametitle{Boolesche Operationen} \frametitle{Boolesche Operationen} \framesubtitle{Was ist das?}
\framesubtitle{Was ist das?}\pause Boolesche Operationen sind Operationen, die sich zu Wahr oder Falsch
auswerten lassen. Auf Mengen angewendet (Zeichnungen geklaut bei
Cornelia M\"uhlich, Uni-Jena):
\only<1> {
\begin{figure}
\centering
\includegraphics[width=0.75\columnwidth]{./images/grundmenge}
\end{figure}
}
\only<2> {
\begin{figure}
\centering
\includegraphics[height=0.65\textheight]{./images/beete}
\end{figure}
}
\only<3> {
\begin{figure}
\centering
\includegraphics[height=0.65\textheight]{./images/AvB}
\end{figure}
}
\only<4> {
\begin{figure}
\centering
\includegraphics[height=0.65\textheight]{./images/AundB}
\end{figure}
}
\only<5> {
\begin{figure}
\centering
\includegraphics[height=0.65\textheight]{./images/AnotB}
\end{figure}
}
\only<6> {
\begin{figure}
\centering
\includegraphics[height=0.65\textheight]{./images/AxorB}
\end{figure}
}
\end{frame} \end{frame}
\begin{frame}[fragile]
\begin{frame}
\frametitle{Boolesche Operationen} \frametitle{Boolesche Operationen}
\framesubtitle{Logische Operatoren} \framesubtitle{Logische Operatoren}
\begin{table}[th] \begin{table}[th]
\caption{\label{logicalOperatorsTab}
\textbf{Logical operators.}}
\begin{center} \begin{center}
\begin{tabular}{c|c} \begin{tabular}{c|c}
\hline \hline
@ -699,25 +736,27 @@
\hline \hline
\end{tabular} \end{tabular}
\end{center} \end{center}
\vspace{1em}
Das auschliessende ODER (XOR) ist nur als Funktion \verb+xor(A, B)+ verf\"ugbar. Das auschliessende ODER (XOR) ist nur als Funktion \verb+xor(A, B)+ verf\"ugbar.
\end{table} \end{table}
\end{frame} \end{frame}
\subsection{Relational operators} \begin{frame}[fragile]
\begin{frame}
\frametitle{Boolesche Operationen} \frametitle{Boolesche Operationen}
\framesubtitle{Relationale Operatoren} \framesubtitle{Relationale Operatoren}
\begin{table}[th] \begin{table}[th]
\caption{\label{relOperatorsTab}
\textbf{Relational Operators.}}
\begin{center} \begin{center}
\begin{tabular}{c|c} \begin{tabular}{c|c}
\hline \hline
\textbf{Operator} & \textbf{Beschreibung} \\ \hline \textbf{Operator} & \textbf{Beschreibung} \\ \hline
$<$ & kleiner als\\ $<$ & kleiner als\\
$>$ & gr\"o\{ss}er als \\ $>$ & gr\"osser als \\
$==$ & gleich \\ $==$ & gleich \\
$>=$ & gr\"o\{ss}er oder gleich\\ $>=$ & gr\"osser oder gleich \\
$<=$ & kleiner oder gleich\\ $<=$ & kleiner oder gleich \\
$\sim=$ & ungleich\\ $\sim=$ & ungleich\\
\hline \hline
\end{tabular} \end{tabular}
@ -725,13 +764,12 @@
\end{table} \end{table}
\end{frame} \end{frame}
\subsection{Logical operators}
\subsection{Boolean operations} \begin{frame}[fragile]
\begin{frame}[fragile]{Boolean operations}{Examples} \frametitle{Boolean operations}
\tiny \framesubtitle{Beispiele}
\begin{lstlisting}[label=booleanListing1] \tiny
\begin{lstlisting}
>> x = [2 0 0 5 0] & [1 0 3 2 0] >> x = [2 0 0 5 0] & [1 0 3 2 0]
x = x =
1 0 0 1 0 1 0 0 1 0
@ -746,12 +784,14 @@
\end{lstlisting} \end{lstlisting}
\end{frame} \end{frame}
\subsection{Exercises}
\begin{frame}[fragile]{Boolean operations}{Exercises} \begin{frame}[fragile]
\vspace{-0.5cm} \frametitle{Boolesche Operationen}
\framesubtitle{\"Ubungen}
\vspace{-0.5cm}
\begin{enumerate} \begin{enumerate}
\item Given are two vectors \verb+x = [1 5 2 8 9 0 1]+ and \item Gegeben sind zwei Vektoren \verb+x = [1 5 2 8 9 0 1]+ und
\verb+y = [5 2 2 6 0 0 2]+. Execute and explain the following commands. \verb+y = [5 2 2 6 0 0 2]+. F\"uhre aus und erkl\"are.
\begin{enumerate} \begin{enumerate}
\item \verb+x > y+ \item \verb+x > y+
\item \verb+y < x+ \item \verb+y < x+
@ -760,16 +800,31 @@
\item \verb+x & ~y+ \item \verb+x & ~y+
\item \verb+x | y+ \item \verb+x | y+
\end{enumerate} \end{enumerate}
\item One can use boolean operations for so called logical indexing: \end{enumerate}
Given are \verb+x = 1:10+ and \verb+y = [3 1 5 6 8 2 9 4 7 0]+. Try \end{frame}
to understand the following commands.
\begin{frame}[fragile]
\frametitle{Logische Indexierung}
\framesubtitle{\"Ubungen}
Boolesche Operationen koennen eingesetzt werden um aus Vektoren und
Matrizen Elemente auszuwaehlen, die einer bestimmten Bedingung
entsprechen.
\begin{enumerate}
\item Gegeben sind \verb+x = (1:10)+ und
\verb+y = [3 1 5 6 8 2 9 4 7 0]+. Try to understand the following
commands.
\begin{enumerate} \begin{enumerate}
\item \verb+x( (y <= 2) )+ \item \verb+x( (y <= 2) )+
\item \verb+x( (x > 2) | (y < 8) )+ \item \verb+x( (x > 2) | (y < 8) )+
\item \verb+x( (x == 0) & (y == 0) )+ \item \verb+x( (x == 0) \& (y == 0) )+
\end{enumerate} \end{enumerate}
\item Play around with boolean operations. \item Erzeuge eine 100x100 2-D Matrix mit Zufallswerten zwischen 0 und 100 (\verb+randi+). Ersetze \verb+x < 33+ mit 0, \verb+x >= 33 und x < 66+ mit 1 und alle \verb+x >= 66+ auf 2.
\item Ermittle die Anzahl Elemente fuer jede Klasse mithilfe eines Booleschen Ausdrucks.
\end{enumerate} \end{enumerate}
\end{frame} \end{frame}
\end{document} \end{document}