diff options
Diffstat (limited to 'day1/session4.tex')
-rw-r--r-- | day1/session4.tex | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/day1/session4.tex b/day1/session4.tex index bfff165..ddac34a 100644 --- a/day1/session4.tex +++ b/day1/session4.tex @@ -607,3 +607,98 @@ In []: plot(l, Tline) \end{frame} \end{document} + +%% Questions for Quiz %% +%% ------------------ %% + +\begin{frame}[fragile] +\frametitle{\incqno } +\begin{lstlisting} +In []: a = array([[1, 2], + [3, 4]]) +In []: a[1,0] = 0 +\end{lstlisting} +What is the resulting array? +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } +\begin{lstlisting} + In []: x = array(([1,2,3,4], + [2,3,4,5])) + In []: x[-2][-3] = 4 + In []: print x +\end{lstlisting} +What will be printed? +\end{frame} + +%% \begin{frame}[fragile] +%% \frametitle{\incqno } +%% \begin{lstlisting} +%% In []: x = array([[1,2,3,4], +%% [3,4,2,5]]) +%% \end{lstlisting} +%% What is the \lstinline+shape+ of this array? +%% \end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } +\begin{lstlisting} + In []: x = array([[1,2,3,4]]) +\end{lstlisting} +How to \lstinline+x+ to \lstinline+array([[1,2,0,4]])+? +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } +\begin{lstlisting} + In []: x = array([[1,2,3,4], + [3,4,2,5]]) +\end{lstlisting} +How do you get the following slice of \lstinline+x+? +\begin{lstlisting} +array([[2,3], + [4,2]]) +\end{lstlisting} +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } +\begin{lstlisting} +In []: a = array([[1, 2], + [3, 4]]) +\end{lstlisting} +How do you get the transpose of this array? +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } +\begin{lstlisting} +In []: a = array([[1, 2], + [3, 4]]) +In []: b = array([[1, 1], + [2, 2]]) +In []: a*b +\end{lstlisting} +What does this produce? +\end{frame} + +\begin{frame} +\frametitle{\incqno } +What command do you use to find the inverse of a matrix and its +eigenvalues? +\end{frame} + +%% \begin{frame} +%% \frametitle{\incqno } +%% The file \lstinline+datafile.txt+ contains 3 columns of data. What +%% command will you use to read the entire data file into an array? +%% \end{frame} + +%% \begin{frame} +%% \frametitle{\incqno } +%% If the contents of the file \lstinline+datafile.txt+ is read into an +%% $N\times3$ array called \lstinline+data+, how would you obtain the third +%% column of this data? +%% \end{frame} + |