day1/session2.tex
changeset 162 1af425d33eba
parent 161 ff22fae4fde5
child 163 f7aeeedb9aa3
equal deleted inserted replaced
161:ff22fae4fde5 162:1af425d33eba
   151 \section{Plotting Points}
   151 \section{Plotting Points}
   152 \begin{frame}[fragile]
   152 \begin{frame}[fragile]
   153 \frametitle{Simple Pendulum - L and T}
   153 \frametitle{Simple Pendulum - L and T}
   154   \begin{itemize}
   154   \begin{itemize}
   155     \item Given data of Length and Time-period of a Simple pendulum 
   155     \item Given data of Length and Time-period of a Simple pendulum 
       
   156     \item $T^2 = \frac{4\pi^2}{g}L$\\ \alert{{$L$} and {$T^2$} vary linearly}
   156     \item We wish to plot L vs. \alert{$T^2$}
   157     \item We wish to plot L vs. \alert{$T^2$}
   157   \end{itemize}    
   158   \end{itemize}    
   158 \begin{lstlisting}
   159 \begin{lstlisting}
   159 In []: L = [0.1,  0.2,  0.3,  
   160 In []: L = [0.1,  0.2,  0.3,  
   160             0.4,  0.5,  0.6,  
   161             0.4,  0.5,  0.6,  
   164             1.6441, 1.7949, 1.8758]
   165             1.6441, 1.7949, 1.8758]
   165 \end{lstlisting}
   166 \end{lstlisting}
   166 \end{frame}
   167 \end{frame}
   167 
   168 
   168 \begin{frame}[fragile]
   169 \begin{frame}[fragile]
   169 \frametitle{Simple Pendulum \ldots}
   170 \frametitle{Plotting $L$ vs. $T^2$}
   170 \begin{itemize}
   171 \begin{itemize}
   171 \item Let us begin with $L$ vs. \alert{$T$}
   172 \item We must square each of the values in T
   172 \end{itemize}
   173 \item How to do it?
   173 \begin{lstlisting}
   174 \item T is a \kwrd{list} and we use a \kwrd{for} loop to iterate over it
   174   In []: plot(L, T)
   175 \end{itemize}
   175 \end{lstlisting}
   176 \end{frame}
   176 \begin{itemize}
   177 
   177 \item But we wish to plot points!
   178 \begin{frame}[fragile]
   178 \end{itemize}
   179 \frametitle{Plotting $L$ vs $T^2$}
       
   180 \begin{lstlisting}
       
   181 In []: TSq = []
       
   182 
       
   183 In []: for t in T:
       
   184  ....:     TSq.append(t*t)
       
   185 
       
   186 In []: plot(L, TSq)
       
   187 Out[]: [<matplotlib.lines.Line2D object at 0xa5b05ac>]
       
   188 \end{lstlisting}
   179 \end{frame}
   189 \end{frame}
   180 
   190 
   181 \begin{frame}[fragile]
   191 \begin{frame}[fragile]
   182 \frametitle{Plotting points}
   192 \frametitle{Plotting points}
       
   193 \begin{itemize}
       
   194 \item But we want to plot points!
       
   195 \end{itemize}
   183 \begin{lstlisting}
   196 \begin{lstlisting}
   184   In []: clf()
   197   In []: clf()
   185 
   198 
   186   In []: plot(L, T, 'o')
   199   In []: plot(L, TSq, 'o')
   187   Out[]: [<matplotlib.lines.Line2D object at 0xac17e0c>]
   200   Out[]: [<matplotlib.lines.Line2D object at 0xac17e0c>]
   188 
   201 
   189   In []: clf()
   202   In []: clf()
   190   In []: plot(L, T, '.')
   203   In []: plot(L, TSq, '.')
   191   Out[]: [<matplotlib.lines.Line2D object at 0xac17e0c>]
   204   Out[]: [<matplotlib.lines.Line2D object at 0xac17e0c>]
   192 \end{lstlisting}
   205 \end{lstlisting}
   193 \end{frame}
   206 \end{frame}
   194 
   207 
   195 \begin{frame}[fragile]
   208 \begin{frame}[fragile]
   198   \item \kwrd{'o'} - Dots
   211   \item \kwrd{'o'} - Dots
   199   \item \kwrd{'.'} - Smaller Dots
   212   \item \kwrd{'.'} - Smaller Dots
   200   \item \kwrd{'-'} - Lines
   213   \item \kwrd{'-'} - Lines
   201   \item \kwrd{'- -'} - Dashed lines
   214   \item \kwrd{'- -'} - Dashed lines
   202 \end{itemize}
   215 \end{itemize}
   203 \end{frame}
       
   204 
       
   205 \begin{frame}[fragile]
       
   206 \frametitle{Plotting $L$ vs. $T^2$}
       
   207 \begin{itemize}
       
   208 \item We must square each of the values in T
       
   209 \item How to do it?
       
   210 \item T is a \kwrd{list} and we use a \kwrd{for} loop to iterate over it
       
   211 \end{itemize}
       
   212 \end{frame}
       
   213 
       
   214 \begin{frame}[fragile]
       
   215 \frametitle{Plotting $L$ vs $T^2$}
       
   216 \begin{lstlisting}
       
   217 In []: TSq = []
       
   218 
       
   219 In []: for t in T:
       
   220  ....:     TSq.append(t*t)
       
   221 
       
   222 In []: plot(L, TSq, '.')
       
   223 Out[]: [<matplotlib.lines.Line2D object at 0xa5b05ac>]
       
   224 \end{lstlisting}
       
   225 \end{frame}
   216 \end{frame}
   226 
   217 
   227 \begin{frame}{New Concepts}
   218 \begin{frame}{New Concepts}
   228   \begin{itemize}
   219   \begin{itemize}
   229     \item lists
   220     \item lists
   383   \end{lstlisting}
   374   \end{lstlisting}
   384 \end{frame}
   375 \end{frame}
   385 
   376 
   386 \begin{frame}[fragile]
   377 \begin{frame}[fragile]
   387 \begin{figure}
   378 \begin{figure}
   388 \includegraphics[width=3.5in]{data/L-Tsq.png}
   379 %\includegraphics[width=3.5in]{data/L-Tsq.png}
   389 \end{figure}
   380 \end{figure}
   390 \vspace{-0.2in}
   381 \vspace{-0.2in}
   391 Coming up - \alert{Least Square Fit \ldots}
   382 Coming up - \alert{Least Square Fit \ldots}
   392 \end{frame}
   383 \end{frame}
   393 
   384 
   394 
       
   395 
       
   396 
       
   397 \end{document}
   385 \end{document}
   398 
       
   399 
       
   400 
       
   401