day1/session4.tex
changeset 319 cef948318842
parent 318 e75d3c993ed5
child 330 46533051b9d3
equal deleted inserted replaced
318:e75d3c993ed5 319:cef948318842
   154 Out[]: 
   154 Out[]: 
   155 array([[ 1.,  1.,  1.,  1.,  1.],
   155 array([[ 1.,  1.,  1.,  1.,  1.],
   156        [ 1.,  1.,  1.,  1.,  1.],
   156        [ 1.,  1.,  1.,  1.,  1.],
   157        [ 1.,  1.,  1.,  1.,  1.]])
   157        [ 1.,  1.,  1.,  1.,  1.]])
   158 
   158 
   159 In []: ones_like([1, 2, 3, 4, 5]) 
   159 In []: ones_like([1, 2, 3, 4]) 
   160 Out[]: array([1, 1, 1, 1, 1])   
   160 Out[]: array([1, 1, 1, 1])   
   161 
   161 
   162 In []: identity(2)
   162 In []: identity(2)
   163 Out[]: 
   163 Out[]: 
   164 array([[ 1.,  0.],
   164 array([[ 1.,  0.],
   165        [ 0.,  1.]])
   165        [ 0.,  1.]])
   513   ....     t.append(float(point[1]))
   513   ....     t.append(float(point[1]))
   514   ....
   514   ....
   515   ....
   515   ....
   516 \end{lstlisting}
   516 \end{lstlisting}
   517 \end{frame}
   517 \end{frame}
       
   518 
       
   519 \begin{frame}[fragile]
       
   520 \frametitle{Getting $L$ and $T^2$ \dots}
       
   521 \begin{lstlisting}
       
   522 In []: l = array(l)
       
   523 In []: t = array(t)
       
   524 \end{lstlisting}
       
   525 \alert{\typ{In []: tsq = t*t}}
       
   526 \end{frame}
   518  
   527  
   519 \begin{frame}[fragile]
   528 \begin{frame}[fragile]
   520 \frametitle{Generating $A$}
   529 \frametitle{Generating $A$}
   521 \begin{lstlisting}
   530 \begin{lstlisting}
   522 In []: A = array([l, ones_like(l)])
   531 In []: A = array([l, ones_like(l)])
   536 \begin{itemize}
   545 \begin{itemize}
   537 \item Now use the \typ{lstsq} function
   546 \item Now use the \typ{lstsq} function
   538 \item Along with a lot of things, it returns the least squares solution
   547 \item Along with a lot of things, it returns the least squares solution
   539 \end{itemize}
   548 \end{itemize}
   540 \begin{lstlisting}
   549 \begin{lstlisting}
   541 In []: result = lstsq(A,TSq)
   550 In []: result = lstsq(A,tsq)
   542 In []: coef = result[0]
   551 In []: coef = result[0]
   543 \end{lstlisting}
   552 \end{lstlisting}
   544 \end{frame}
   553 \end{frame}
   545 
   554 
   546 \begin{frame}[fragile]
   555 \begin{frame}[fragile]