day1/session4.tex
changeset 334 2214b5dba4d4
parent 330 46533051b9d3
child 337 56aa2efbf7d9
equal deleted inserted replaced
333:25b18b51be41 334:2214b5dba4d4
    77 \title[Matrices \& Curve Fitting]{Python for Science and Engg: Matrices \& Least Square Fit}
    77 \title[Matrices \& Curve Fitting]{Python for Science and Engg: Matrices \& Least Square Fit}
    78 
    78 
    79 \author[FOSSEE] {FOSSEE}
    79 \author[FOSSEE] {FOSSEE}
    80 
    80 
    81 \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
    81 \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
    82 \date[] {7 November, 2009\\Day 1, Session 4}
    82 \date[] {14 December, 2009\\Day 1, Session 4}
    83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    83 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    84 
    84 
    85 %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
    85 %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
    86 %\logo{\pgfuseimage{iitmlogo}}
    86 %\logo{\pgfuseimage{iitmlogo}}
    87 
    87 
   132 \end{frame}
   132 \end{frame}
   133 
   133 
   134 \begin{frame}[fragile]
   134 \begin{frame}[fragile]
   135 \frametitle{Matrices: Initializing}
   135 \frametitle{Matrices: Initializing}
   136 \begin{lstlisting}
   136 \begin{lstlisting}
   137 In []: A = array([[ 1,  1,  2, -1],
   137 In []: c = array([[1,1,2],
   138                   [ 2,  5, -1, -9],
   138                   [2,4,1],
   139                   [ 2,  1, -1,  3],
   139                   [-1,3,7]])
   140                   [ 1, -3,  2,  7]])
   140 
   141 In []: A
   141 In []: c
   142 Out[]: 
   142 Out[]: 
   143 array([[ 1,  1,  2, -1],
   143 array([[1,1,2],
   144        [ 2,  5, -1, -9],
   144        [2,4,1],
   145        [ 2,  1, -1,  3],
   145        [-1,3,7]])
   146        [ 1, -3,  2,  7]])
       
   147 \end{lstlisting}
   146 \end{lstlisting}
   148 \end{frame}
   147 \end{frame}
   149 
   148 
   150 \begin{frame}[fragile]
   149 \begin{frame}[fragile]
   151 \frametitle{Initializing some special matrices}
   150 \frametitle{Initializing some special matrices}
   155 Out[]: 
   154 Out[]: 
   156 array([[ 1.,  1.,  1.,  1.,  1.],
   155 array([[ 1.,  1.,  1.,  1.,  1.],
   157        [ 1.,  1.,  1.,  1.,  1.],
   156        [ 1.,  1.,  1.,  1.,  1.],
   158        [ 1.,  1.,  1.,  1.,  1.]])
   157        [ 1.,  1.,  1.,  1.,  1.]])
   159 
   158 
   160 In []: ones_like([1, 2, 3, 4, 5]) 
   159 In []: ones_like([1, 2, 3, 4]) 
   161 Out[]: array([1, 1, 1, 1, 1])   
   160 Out[]: array([1, 1, 1, 1])   
   162 
   161 
   163 In []: identity(2)
   162 In []: identity(2)
   164 Out[]: 
   163 Out[]: 
   165 array([[ 1.,  0.],
   164 array([[ 1.,  0.],
   166        [ 0.,  1.]])
   165        [ 0.,  1.]])
   171 
   170 
   172 
   171 
   173 \begin{frame}[fragile]
   172 \begin{frame}[fragile]
   174   \frametitle{Accessing elements}
   173   \frametitle{Accessing elements}
   175   \begin{lstlisting}
   174   \begin{lstlisting}
   176 In []: C = array([[1,1,2],
   175 In []: c
   177                   [2,4,1],
   176 Out[]: 
   178                   [-1,3,7]])
   177 array([[1,1,2],
   179 
   178        [2,4,1],
   180 In []: C[1][2]
   179        [-1,3,7]])
       
   180 
       
   181 In []: c[1][2]
   181 Out[]: 1
   182 Out[]: 1
   182 
   183 In []: c[1,2]
   183 In []: C[1,2]
       
   184 Out[]: 1
   184 Out[]: 1
   185 
   185 In []: c[1]
   186 In []: C[1]
       
   187 Out[]: array([2, 4, 1])
   186 Out[]: array([2, 4, 1])
   188   \end{lstlisting}
   187   \end{lstlisting}
   189 \end{frame}
   188 \end{frame}
   190 
   189 
   191 \begin{frame}[fragile]
   190 \begin{frame}[fragile]
   192   \frametitle{Changing elements}
   191   \frametitle{Changing elements}
   193   \begin{small}
   192   \begin{small}
   194   \begin{lstlisting}
   193   \begin{lstlisting}
   195 In []: C[1,1] = -2
   194 In []: c[1,1] = -2
   196 In []: C
   195 In []: c
   197 Out[]: 
   196 Out[]: 
   198 array([[ 1,  1,  2],
   197 array([[ 1,  1,  2],
   199        [ 2, -2,  1],
   198        [ 2, -2,  1],
   200        [-1,  3,  7]])
   199        [-1,  3,  7]])
   201 
   200 
   202 In []: C[1] = [0,0,0]
   201 In []: c[1] = [0,0,0]
   203 In []: C
   202 In []: c
   204 Out[]: 
   203 Out[]: 
   205 array([[ 1,  1,  2],
   204 array([[ 1,  1,  2],
   206        [ 0,  0,  0],
   205        [ 0,  0,  0],
   207        [-1,  3,  7]])
   206        [-1,  3,  7]])
   208   \end{lstlisting}
   207   \end{lstlisting}
   212 
   211 
   213 \begin{frame}[fragile]
   212 \begin{frame}[fragile]
   214   \frametitle{Slicing}
   213   \frametitle{Slicing}
   215 \begin{small}
   214 \begin{small}
   216   \begin{lstlisting}
   215   \begin{lstlisting}
   217 In []: C[:,1]
   216 In []: c[:,1]
   218 Out[]: array([1, 0, 3])
   217 Out[]: array([1, 0, 3])
   219 
   218 
   220 In []: C[1,:]
   219 In []: c[1,:]
   221 Out[]: array([0, 0, 0])
   220 Out[]: array([0, 0, 0])
   222 
   221 
   223 In []: C[0:2,:]
   222 In []: c[0:2,:]
   224 Out[]: 
   223 Out[]: 
   225 array([[1, 1, 2],
   224 array([[1, 1, 2],
   226        [0, 0, 0]])
   225        [0, 0, 0]])
   227 
   226 
   228 In []: C[1:3,:]
   227 In []: c[1:3,:]
   229 Out[]: 
   228 Out[]: 
   230 array([[ 0,  0,  0],
   229 array([[ 0,  0,  0],
   231        [-1,  3,  7]])
   230        [-1,  3,  7]])
   232   \end{lstlisting}
   231   \end{lstlisting}
   233 \end{small}
   232 \end{small}
   235 
   234 
   236 \begin{frame}[fragile]
   235 \begin{frame}[fragile]
   237   \frametitle{Slicing \ldots}
   236   \frametitle{Slicing \ldots}
   238 \begin{small}
   237 \begin{small}
   239   \begin{lstlisting}
   238   \begin{lstlisting}
   240 In []: C[:2,:]
   239 In []: c[:2,:]
   241 Out[]: 
   240 Out[]: 
   242 array([[1, 1, 2],
   241 array([[1, 1, 2],
   243        [0, 0, 0]])
   242        [0, 0, 0]])
   244 
   243 
   245 In []: C[1:,:]
   244 In []: c[1:,:]
   246 Out[]: 
   245 Out[]: 
   247 array([[ 0,  0,  0],
   246 array([[ 0,  0,  0],
   248        [-1,  3,  7]])
   247        [-1,  3,  7]])
   249 
   248 
   250 In []: C[1:,:2]
   249 In []: c[1:,:2]
   251 Out[]: 
   250 Out[]: 
   252 array([[ 0,  0],
   251 array([[ 0,  0],
   253        [-1,  3]])
   252        [-1,  3]])
   254   \end{lstlisting}
   253   \end{lstlisting}
   255 
   254 
   258 
   257 
   259 \begin{frame}[fragile]
   258 \begin{frame}[fragile]
   260   \frametitle{Striding}
   259   \frametitle{Striding}
   261   \begin{small}
   260   \begin{small}
   262   \begin{lstlisting}
   261   \begin{lstlisting}
   263 In []: C[::2,:]
   262 In []: c[::2,:]
   264 Out[]: 
   263 Out[]: 
   265 array([[ 1,  1,  2],
   264 array([[ 1,  1,  2],
   266        [-1,  3,  7]])
   265        [-1,  3,  7]])
   267 
   266 
   268 In []: C[:,::2]
   267 In []: c[:,::2]
   269 Out[]: 
   268 Out[]: 
   270 xarray([[ 1,  2],
   269 xarray([[ 1,  2],
   271        [ 0,  0],
   270        [ 0,  0],
   272        [-1,  7]])
   271        [-1,  7]])
   273 
   272 
   274 In []: C[::2,::2]
   273 In []: c[::2,::2]
   275 Out[]: 
   274 Out[]: 
   276 array([[ 1,  2],
   275 array([[ 1,  2],
   277        [-1,  7]])
   276        [-1,  7]])
   278   \end{lstlisting}
   277   \end{lstlisting}
   279   \end{small}
   278   \end{small}
   281 
   280 
   282 \begin{frame}[fragile]
   281 \begin{frame}[fragile]
   283   \frametitle{Slicing \& Striding Exercises}
   282   \frametitle{Slicing \& Striding Exercises}
   284 \begin{small}
   283 \begin{small}
   285   \begin{lstlisting}
   284   \begin{lstlisting}
   286 In []: A = imread('lena.png')
   285 In []: a = imread('lena.png')
   287 
   286 
   288 In []: imshow(A)
   287 In []: imshow(a)
   289 Out[]: <matplotlib.image.AxesImage object at 0xa0384cc>
   288 Out[]: <matplotlib.image.AxesImage object at 0xa0384cc>
   290 
   289 
   291 In []: A.shape 
       
   292 Out[]: (512, 512, 4)
       
   293   \end{lstlisting}
   290   \end{lstlisting}
   294 \end{small}
   291 \end{small}
   295   \begin{itemize}
   292   \begin{itemize}
   296   \item Crop the image to get the top-left quarter
   293   \item Crop the image to get the top-left quarter
   297   \item Crop the image to get only the face
   294   \item Crop the image to get only the face
   301 
   298 
   302 \begin{frame}[fragile]
   299 \begin{frame}[fragile]
   303   \frametitle{Solutions}
   300   \frametitle{Solutions}
   304 \begin{small}
   301 \begin{small}
   305   \begin{lstlisting}
   302   \begin{lstlisting}
   306 In []: imshow(A[:256,:256])
   303 In []: imshow(a[:256,:256])
   307 Out[]: <matplotlib.image.AxesImage object at 0xb6f658c>
   304 Out[]: <matplotlib.image.AxesImage object at 0xb6f658c>
   308 
   305 
   309 In []: imshow(A[200:400,200:400])
   306 In []: imshow(a[200:400,200:400])
   310 Out[]: <matplotlib.image.AxesImage object at 0xb757c2c>
   307 Out[]: <matplotlib.image.AxesImage object at 0xb757c2c>
   311 
   308 
   312 In []: imshow(A[::2,::2])
   309 In []: imshow(a[::2,::2])
   313 Out[]: <matplotlib.image.AxesImage object at 0xb765c8c>
   310 Out[]: <matplotlib.image.AxesImage object at 0xb765c8c>
   314   \end{lstlisting}
   311   \end{lstlisting}
   315 \end{small}
   312 \end{small}
   316 \end{frame}
   313 \end{frame}
   317 
   314 
   318 \begin{frame}[fragile]
   315 \begin{frame}[fragile]
   319 \frametitle{Transpose of a Matrix}
   316 \frametitle{Transpose of a Matrix}
   320 \begin{lstlisting}
   317 \begin{lstlisting}
   321 In []: A.T
   318 In []: a = array([[ 1,  1,  2, -1],
       
   319   ...:            [ 2,  5, -1, -9],
       
   320   ...:            [ 2,  1, -1,  3],
       
   321   ...:            [ 1, -3,  2,  7]])
       
   322 
       
   323 In []: a.T
   322 Out[]:
   324 Out[]:
   323 array([[ 1,  2,  2,  1],
   325 array([[ 1,  2,  2,  1],
   324        [ 1,  5,  1, -3],
   326        [ 1,  5,  1, -3],
   325        [ 2, -1, -1,  2],
   327        [ 2, -1, -1,  2],
   326        [-1, -9,  3,  7]])
   328        [-1, -9,  3,  7]])
   328 \end{frame}
   330 \end{frame}
   329 
   331 
   330 \begin{frame}[fragile]
   332 \begin{frame}[fragile]
   331   \frametitle{Sum of all elements}
   333   \frametitle{Sum of all elements}
   332   \begin{lstlisting}
   334   \begin{lstlisting}
   333 In []: sum(A)
   335 In []: sum(a)
   334 Out[]: 12
   336 Out[]: 12
   335   \end{lstlisting}
   337   \end{lstlisting}
   336 \end{frame}
   338 \end{frame}
   337 
   339 
   338 \begin{frame}[fragile]
   340 \begin{frame}[fragile]
   339   \frametitle{Matrix Addition}
   341   \frametitle{Matrix Addition}
   340   \begin{lstlisting}
   342   \begin{lstlisting}
   341 In []: B = array([[3,2,-1,5],
   343 In []: b = array([[3,2,-1,5],
   342                   [2,-2,4,9],
   344                   [2,-2,4,9],
   343                   [-1,0.5,-1,-7],
   345                   [-1,0.5,-1,-7],
   344                   [9,-5,7,3]])
   346                   [9,-5,7,3]])
   345 In []: A + B
   347 In []: a + b
   346 Out[]: 
   348 Out[]: 
   347 array([[  4. ,   3. ,   1. ,   4. ],
   349 array([[  4. ,   3. ,   1. ,   4. ],
   348        [  4. ,   3. ,   3. ,   0. ],
   350        [  4. ,   3. ,   3. ,   0. ],
   349        [  1. ,   1.5,  -2. ,  -4. ],
   351        [  1. ,   1.5,  -2. ,  -4. ],
   350        [ 10. ,  -8. ,   9. ,  10. ]])
   352        [ 10. ,  -8. ,   9. ,  10. ]])
   352 \end{frame}
   354 \end{frame}
   353 
   355 
   354 \begin{frame}[fragile]
   356 \begin{frame}[fragile]
   355 \frametitle{Elementwise Multiplication}
   357 \frametitle{Elementwise Multiplication}
   356 \begin{lstlisting}
   358 \begin{lstlisting}
   357 In []: A*B
   359 In []: a*b
   358 Out[]: 
   360 Out[]: 
   359 array([[  3. ,   2. ,  -2. ,  -5. ],
   361 array([[  3. ,   2. ,  -2. ,  -5. ],
   360        [  4. , -10. ,  -4. , -81. ],
   362        [  4. , -10. ,  -4. , -81. ],
   361        [ -2. ,   0.5,   1. , -21. ],
   363        [ -2. ,   0.5,   1. , -21. ],
   362        [  9. ,  15. ,  14. ,  21. ]])
   364        [  9. ,  15. ,  14. ,  21. ]])
   365 \end{frame}
   367 \end{frame}
   366 
   368 
   367 \begin{frame}[fragile]
   369 \begin{frame}[fragile]
   368 \frametitle{Matrix Multiplication}
   370 \frametitle{Matrix Multiplication}
   369 \begin{lstlisting}
   371 \begin{lstlisting}
   370 In []: dot(A,B)
   372 In []: dot(a, b)
   371 Out[]: 
   373 Out[]: 
   372 array([[ -6. ,   6. ,  -6. ,  -3. ],
   374 array([[ -6. ,   6. ,  -6. ,  -3. ],
   373        [-64. ,  38.5, -44. ,  35. ],
   375        [-64. ,  38.5, -44. ,  35. ],
   374        [ 36. , -13.5,  24. ,  35. ],
   376        [ 36. , -13.5,  24. ,  35. ],
   375        [ 58. , -26. ,  34. , -15. ]])
   377        [ 58. , -26. ,  34. , -15. ]])
   377 \end{frame}
   379 \end{frame}
   378 
   380 
   379 \begin{frame}[fragile]
   381 \begin{frame}[fragile]
   380 \frametitle{Inverse of a Matrix}
   382 \frametitle{Inverse of a Matrix}
   381 \begin{lstlisting}
   383 \begin{lstlisting}
   382 In []: inv(A)
   384 In []: inv(a)
   383 \end{lstlisting}
   385 \end{lstlisting}
   384 \begin{small}
   386 \begin{small}
   385 \begin{lstlisting}
   387 \begin{lstlisting}
   386 Out[]: 
   388 Out[]: 
   387 array([[-0.5 ,  0.55, -0.15,  0.7 ],
   389 array([[-0.5 ,  0.55, -0.15,  0.7 ],
   393 \end{frame}
   395 \end{frame}
   394 
   396 
   395 \begin{frame}[fragile]
   397 \begin{frame}[fragile]
   396 \frametitle{Determinant}
   398 \frametitle{Determinant}
   397 \begin{lstlisting}
   399 \begin{lstlisting}
   398 In []: det(A)
   400 In []: det(a)
   399 Out[]: 80.0
   401 Out[]: 80.0
   400 \end{lstlisting}
   402 \end{lstlisting}
   401 \end{frame}
   403 \end{frame}
   402 
   404 
   403 %%use S=array(X,Y)
   405 %%use S=array(X,Y)
   404 \begin{frame}[fragile]
   406 \begin{frame}[fragile]
   405 \frametitle{Eigenvalues and Eigen Vectors}
   407 \frametitle{Eigenvalues and Eigen Vectors}
   406 \begin{small}
   408 \begin{small}
   407 \begin{lstlisting}
   409 \begin{lstlisting}
   408 In []: E = array([[3,2,4],[2,0,2],[4,2,3]])
   410 In []: e = array([[3,2,4],[2,0,2],[4,2,3]])
   409 
   411 
   410 In []: eig(E)
   412 In []: eig(e)
   411 Out[]: 
   413 Out[]: 
   412 (array([-1.,  8., -1.]),
   414 (array([-1.,  8., -1.]),
   413  array([[-0.74535599,  0.66666667, -0.1931126 ],
   415  array([[-0.74535599,  0.66666667, -0.1931126 ],
   414         [ 0.2981424 ,  0.33333333, -0.78664085],
   416         [ 0.2981424 ,  0.33333333, -0.78664085],
   415         [ 0.59628479,  0.66666667,  0.58643303]]))
   417         [ 0.59628479,  0.66666667,  0.58643303]]))
   416 
   418 
   417 In []: eigvals(E)
   419 In []: eigvals(e)
   418 Out[]: array([-1.,  8., -1.])
   420 Out[]: array([-1.,  8., -1.])
   419 \end{lstlisting}
   421 \end{lstlisting}
   420 \end{small}
   422 \end{small}
   421 \end{frame}
   423 \end{frame}
   422 
   424 
   423 %% \begin{frame}[fragile]
   425 %% \begin{frame}[fragile]
   424 %% \frametitle{Computing Norms}
   426 %% \frametitle{Computing Norms}
   425 %% \begin{lstlisting}
   427 %% \begin{lstlisting}
   426 %% In []: norm(E)
   428 %% In []: norm(e)
   427 %% Out[]: 8.1240384046359608
   429 %% Out[]: 8.1240384046359608
   428 %% \end{lstlisting}
   430 %% \end{lstlisting}
   429 %% \end{frame}
   431 %% \end{frame}
   430 
   432 
   431 %% \begin{frame}[fragile]
   433 %% \begin{frame}[fragile]
   432 %%   \frametitle{Singular Value Decomposition}
   434 %%   \frametitle{Singular Value Decomposition}
   433 %%   \begin{small}
   435 %%   \begin{small}
   434 %%   \begin{lstlisting}
   436 %%   \begin{lstlisting}
   435 %% In []: svd(E)
   437 %% In []: svd(e)
   436 %% Out[]: 
   438 %% Out[]: 
   437 %% (array(
   439 %% (array(
   438 %% [[ -6.66666667e-01,  -1.23702565e-16,   7.45355992e-01],
   440 %% [[ -6.66666667e-01,  -1.23702565e-16,   7.45355992e-01],
   439 %%  [ -3.33333333e-01,  -8.94427191e-01,  -2.98142397e-01],
   441 %%  [ -3.33333333e-01,  -8.94427191e-01,  -2.98142397e-01],
   440 %%  [ -6.66666667e-01,   4.47213595e-01,  -5.96284794e-01]]),
   442 %%  [ -6.66666667e-01,   4.47213595e-01,  -5.96284794e-01]]),
   501 \item We need to find $p$ to plot the line
   503 \item We need to find $p$ to plot the line
   502 \end{itemize}
   504 \end{itemize}
   503 \end{frame}
   505 \end{frame}
   504 
   506 
   505 \begin{frame}[fragile]
   507 \begin{frame}[fragile]
       
   508 \frametitle{Getting $L$ and $T^2$}
       
   509 If you \alert{closed} IPython after session 2
       
   510 \begin{lstlisting}
       
   511 In []: l = []
       
   512 In []: t = []
       
   513 In []: for line in open('pendulum.txt'):
       
   514   ....     point = line.split()
       
   515   ....     l.append(float(point[0]))
       
   516   ....     t.append(float(point[1]))
       
   517   ....
       
   518   ....
       
   519 \end{lstlisting}
       
   520 \end{frame}
       
   521 
       
   522 \begin{frame}[fragile]
       
   523 \frametitle{Getting $L$ and $T^2$ \dots}
       
   524 \begin{lstlisting}
       
   525 In []: l = array(l)
       
   526 In []: t = array(t)
       
   527 \end{lstlisting}
       
   528 \alert{\typ{In []: tsq = t*t}}
       
   529 \end{frame}
       
   530  
       
   531 \begin{frame}[fragile]
   506 \frametitle{Generating $A$}
   532 \frametitle{Generating $A$}
   507 \begin{lstlisting}
   533 \begin{lstlisting}
   508 In []: A = array([L, ones_like(L)])
   534 In []: A = array([l, ones_like(l)])
   509 In []: A = A.T
   535 In []: A = A.T
   510 \end{lstlisting}
   536 \end{lstlisting}
   511 %% \begin{itemize}
   537 %% \begin{itemize}
   512 %% \item A is also called a Van der Monde matrix
   538 %% \item A is also called a Van der Monde matrix
   513 %% \item It can also be generated using \typ{vander}
   539 %% \item It can also be generated using \typ{vander}
   522 \begin{itemize}
   548 \begin{itemize}
   523 \item Now use the \typ{lstsq} function
   549 \item Now use the \typ{lstsq} function
   524 \item Along with a lot of things, it returns the least squares solution
   550 \item Along with a lot of things, it returns the least squares solution
   525 \end{itemize}
   551 \end{itemize}
   526 \begin{lstlisting}
   552 \begin{lstlisting}
   527 In []: result = lstsq(A,TSq)
   553 In []: result = lstsq(A,tsq)
   528 In []: coef = result[0]
   554 In []: coef = result[0]
   529 \end{lstlisting}
   555 \end{lstlisting}
   530 \end{frame}
   556 \end{frame}
   531 
   557 
   532 \begin{frame}[fragile]
   558 \begin{frame}[fragile]
   533 \frametitle{Least Square Fit Line \ldots}
   559 \frametitle{Least Square Fit Line \ldots}
   534 We get the points of the line from \typ{coef}
   560 We get the points of the line from \typ{coef}
   535 \begin{lstlisting}
   561 \begin{lstlisting}
   536 In []: Tline = coef[0]*L + coef[1]
   562 In []: Tline = coef[0]*l + coef[1]
   537 \end{lstlisting}
   563 \end{lstlisting}
   538 \begin{itemize}
   564 \begin{itemize}
   539 \item Now plot Tline vs. L, to get the Least squares fit line. 
   565 \item Now plot \typ{Tline} vs. \typ{l}, to get the Least squares fit line. 
   540 \end{itemize}
   566 \end{itemize}
   541 \begin{lstlisting}
   567 \begin{lstlisting}
   542 In []: plot(L, Tline)
   568 In []: plot(l, Tline)
   543 \end{lstlisting}
   569 \end{lstlisting}
   544 \end{frame}
   570 \end{frame}
   545 
   571 
   546 \begin{frame}[fragile]
   572 \begin{frame}[fragile]
   547 \frametitle{Least Squares Fit}
   573 \frametitle{Least Squares Fit}