day1/session4.tex
changeset 343 adb85e126341
parent 339 8ac5fe07810f
child 354 5dc6c3673f9d
equal deleted inserted replaced
342:f91a75802238 343:adb85e126341
   605   \item Least Square Curve fitting
   605   \item Least Square Curve fitting
   606   \end{itemize}
   606   \end{itemize}
   607 \end{frame}
   607 \end{frame}
   608 
   608 
   609 \end{document}
   609 \end{document}
       
   610 
       
   611 %% Questions for Quiz %%
       
   612 %% ------------------ %%
       
   613 
       
   614 \begin{frame}[fragile]
       
   615 \frametitle{\incqno }
       
   616 \begin{lstlisting}
       
   617 In []: a = array([[1, 2],
       
   618                   [3, 4]])
       
   619 In []: a[1,0] = 0
       
   620 \end{lstlisting}
       
   621 What is the resulting array?
       
   622 \end{frame}
       
   623 
       
   624 \begin{frame}[fragile]
       
   625 \frametitle{\incqno }
       
   626 \begin{lstlisting}
       
   627   In []: x = array(([1,2,3,4],
       
   628                     [2,3,4,5]))
       
   629   In []: x[-2][-3] = 4
       
   630   In []: print x
       
   631 \end{lstlisting}
       
   632 What will be printed?
       
   633 \end{frame}
       
   634 
       
   635 %% \begin{frame}[fragile]
       
   636 %% \frametitle{\incqno }
       
   637 %% \begin{lstlisting}
       
   638 %%   In []: x = array([[1,2,3,4],
       
   639 %%                     [3,4,2,5]])
       
   640 %% \end{lstlisting}
       
   641 %% What is the \lstinline+shape+ of this array?
       
   642 %% \end{frame}
       
   643 
       
   644 \begin{frame}[fragile]
       
   645 \frametitle{\incqno }
       
   646 \begin{lstlisting}
       
   647   In []: x = array([[1,2,3,4]])
       
   648 \end{lstlisting}
       
   649 How to \lstinline+x+ to \lstinline+array([[1,2,0,4]])+?
       
   650 \end{frame}
       
   651 
       
   652 \begin{frame}[fragile]
       
   653 \frametitle{\incqno }
       
   654 \begin{lstlisting}
       
   655   In []: x = array([[1,2,3,4],
       
   656                     [3,4,2,5]])
       
   657 \end{lstlisting}
       
   658 How do you get the following slice of \lstinline+x+?
       
   659 \begin{lstlisting}
       
   660 array([[2,3],
       
   661        [4,2]])
       
   662 \end{lstlisting}
       
   663 \end{frame}
       
   664 
       
   665 \begin{frame}[fragile]
       
   666 \frametitle{\incqno }
       
   667 \begin{lstlisting}
       
   668 In []: a = array([[1, 2],
       
   669                   [3, 4]])
       
   670 \end{lstlisting}
       
   671 How do you get the transpose of this array?
       
   672 \end{frame}
       
   673 
       
   674 \begin{frame}[fragile]
       
   675 \frametitle{\incqno }
       
   676 \begin{lstlisting}
       
   677 In []: a = array([[1, 2],
       
   678                   [3, 4]])
       
   679 In []: b = array([[1, 1],
       
   680                   [2, 2]])
       
   681 In []: a*b
       
   682 \end{lstlisting}
       
   683 What does this produce?
       
   684 \end{frame}
       
   685 
       
   686 \begin{frame}
       
   687 \frametitle{\incqno }
       
   688 What command do you use to find the inverse of a matrix and its
       
   689 eigenvalues?
       
   690 \end{frame}
       
   691 
       
   692 %% \begin{frame}
       
   693 %% \frametitle{\incqno }
       
   694 %% The file \lstinline+datafile.txt+ contains 3 columns of data.  What
       
   695 %% command will you use to read the entire data file into an array?
       
   696 %% \end{frame}
       
   697 
       
   698 %% \begin{frame}
       
   699 %% \frametitle{\incqno }
       
   700 %% If the contents of the file \lstinline+datafile.txt+ is read into an
       
   701 %% $N\times3$ array called \lstinline+data+, how would you obtain the third
       
   702 %% column of this data?
       
   703 %% \end{frame}
       
   704