day1/session4.tex
changeset 293 f7d7b5565232
parent 286 ac457f7d1702
child 304 c53251e506cc
equal deleted inserted replaced
292:2622aebff64a 293:f7d7b5565232
   144        [ 2,  5, -1, -9],
   144        [ 2,  5, -1, -9],
   145        [ 2,  1, -1,  3],
   145        [ 2,  1, -1,  3],
   146        [ 1, -3,  2,  7]])
   146        [ 1, -3,  2,  7]])
   147 \end{lstlisting}
   147 \end{lstlisting}
   148 \end{frame}
   148 \end{frame}
       
   149 
       
   150 \begin{frame}[fragile]
       
   151 \frametitle{Initializing some special matrices}
       
   152 \begin{small}
       
   153   \begin{lstlisting}
       
   154 In []: ones((3,5))
       
   155 Out[]: 
       
   156 array([[ 1.,  1.,  1.,  1.,  1.],
       
   157        [ 1.,  1.,  1.,  1.,  1.],
       
   158        [ 1.,  1.,  1.,  1.,  1.]])
       
   159 
       
   160 In []: ones_like([1, 2, 3, 4, 5]) 
       
   161 Out[]: array([1, 1, 1, 1, 1])   
       
   162 
       
   163 In []: identity(2)
       
   164 Out[]: 
       
   165 array([[ 1.,  0.],
       
   166        [ 0.,  1.]])
       
   167   \end{lstlisting}
       
   168 Also available \alert{\typ{zeros, zeros_like, empty, empty_like}}
       
   169 \end{small}
       
   170 \end{frame}
       
   171 
   149 
   172 
   150 \begin{frame}[fragile]
   173 \begin{frame}[fragile]
   151   \frametitle{Accessing elements}
   174   \frametitle{Accessing elements}
   152   \begin{lstlisting}
   175   \begin{lstlisting}
   153 In []: C = array([[1,1,2],
   176 In []: C = array([[1,1,2],
   424 %% \inctime{15}
   447 %% \inctime{15}
   425 %% \end{frame}
   448 %% \end{frame}
   426 
   449 
   427 \section{Least Squares Fit}
   450 \section{Least Squares Fit}
   428 \begin{frame}[fragile]
   451 \begin{frame}[fragile]
   429 \frametitle{$L$ vs. $T^2$}
   452 \frametitle{$L$ vs. $T^2$ - Scatter}
   430 \vspace{-0.15in}
   453 \vspace{-0.15in}
   431 \begin{figure}
   454 \begin{figure}
   432 \includegraphics[width=4in]{data/L-Tsq-points}
   455 \includegraphics[width=4in]{data/L-Tsq-points}
   433 \end{figure}
   456 \end{figure}
   434 \end{frame}
   457 \end{frame}
   435 
   458 
   436 \begin{frame}[fragile]
   459 \begin{frame}[fragile]
   437 \frametitle{$L$ vs. $T^2$}
   460 \frametitle{$L$ vs. $T^2$ - Line}
   438 \vspace{-0.15in}
   461 \vspace{-0.15in}
   439 \begin{figure}
   462 \begin{figure}
   440 \includegraphics[width=4in]{data/L-Tsq-Line}
   463 \includegraphics[width=4in]{data/L-Tsq-Line}
   441 \end{figure}
   464 \end{figure}
   442 \end{frame}
   465 \end{frame}
   443 
   466 
   444 \begin{frame}[fragile]
   467 \begin{frame}[fragile]
   445 \frametitle{Least Squares Fit}
   468 \frametitle{$L$ vs. $T^2$ }
       
   469 \frametitle{$L$ vs. $T^2$ - Least Square Fit}
   446 \vspace{-0.15in}
   470 \vspace{-0.15in}
   447 \begin{figure}
   471 \begin{figure}
   448 \includegraphics[width=4in]{data/least-sq-fit}
   472 \includegraphics[width=4in]{data/least-sq-fit}
   449 \end{figure}
   473 \end{figure}
   450 \end{frame}
   474 \end{frame}
   482 \frametitle{Generating $A$}
   506 \frametitle{Generating $A$}
   483 \begin{lstlisting}
   507 \begin{lstlisting}
   484 In []: A = array([L, ones_like(L)])
   508 In []: A = array([L, ones_like(L)])
   485 In []: A = A.T
   509 In []: A = A.T
   486 \end{lstlisting}
   510 \end{lstlisting}
   487 \begin{small}
       
   488 \begin{block}{}
       
   489   \begin{lstlisting}
       
   490 In []: ones((3,5))
       
   491 Out[]: 
       
   492 array([[ 1.,  1.,  1.,  1.,  1.],
       
   493        [ 1.,  1.,  1.,  1.,  1.],
       
   494        [ 1.,  1.,  1.,  1.,  1.]])
       
   495 
       
   496 In []: ones_like([1, 2, 3, 4, 5]) 
       
   497 Out[]: array([1, 1, 1, 1, 1])   
       
   498   \end{lstlisting}
       
   499 Also available \alert{\typ{zeros, zeros_like, empty, empty_like}}
       
   500 \end{block}
       
   501 \end{small}
       
   502 
       
   503 %% \begin{itemize}
   511 %% \begin{itemize}
   504 %% \item A is also called a Van der Monde matrix
   512 %% \item A is also called a Van der Monde matrix
   505 %% \item It can also be generated using \typ{vander}
   513 %% \item It can also be generated using \typ{vander}
   506 %% \end{itemize}
   514 %% \end{itemize}
   507 %% \begin{lstlisting}
   515 %% \begin{lstlisting}
   547 \begin{frame}
   555 \begin{frame}
   548   \frametitle{What did we learn?}
   556   \frametitle{What did we learn?}
   549   \begin{itemize}
   557   \begin{itemize}
   550   \item Matrices
   558   \item Matrices
   551     \begin{itemize}
   559     \begin{itemize}
       
   560       \item Initializing
   552       \item Accessing elements
   561       \item Accessing elements
   553       \item Slicing and Striding
   562       \item Slicing and Striding
   554       \item Transpose
   563       \item Transpose
   555       \item Addition
   564       \item Addition
   556       \item Multiplication
   565       \item Multiplication