day1/session5.tex
changeset 224 668f88f20218
parent 223 081600805dde
child 226 0995e8f32913
equal deleted inserted replaced
223:081600805dde 224:668f88f20218
    94     \frametitle{Outline}
    94     \frametitle{Outline}
    95     \tableofcontents[currentsection,currentsubsection]
    95     \tableofcontents[currentsection,currentsubsection]
    96   \end{frame}
    96   \end{frame}
    97 }
    97 }
    98 
    98 
    99 %%\AtBeginSection[]
    99 \AtBeginSection[]
   100 %%{
   100 {
   101   %%\begin{frame}<beamer>
   101   \begin{frame}<beamer>
   102 %%    \frametitle{Outline}
   102    \frametitle{Outline}
   103   %%  \tableofcontents[currentsection,currentsubsection]
   103    \tableofcontents[currentsection,currentsubsection]
   104   %%\end{frame}
   104   \end{frame}
   105 %%}
   105 }
   106 
   106 
   107 % If you wish to uncover everything in a step-wise fashion, uncomment
   107 % If you wish to uncover everything in a step-wise fashion, uncomment
   108 % the following command: 
   108 % the following command: 
   109 %\beamerdefaultoverlayspecification{<+->}
   109 %\beamerdefaultoverlayspecification{<+->}
   110 
   110 
   216 #use der=1, 2,.. for 1st, 2nd,.. order
   216 #use der=1, 2,.. for 1st, 2nd,.. order
   217 In []: Tnew = splev(Lnew, tck, der=1)
   217 In []: Tnew = splev(Lnew, tck, der=1)
   218 \end{lstlisting}
   218 \end{lstlisting}
   219 \end{frame}
   219 \end{frame}
   220 
   220 
   221 \begin{frame}[fragile]
   221 %% \begin{frame}[fragile]
   222 \frametitle{}
   222 %% \frametitle{Interpolation \ldots}
   223 \end{frame}
   223 %% \begin{itemize}
       
   224 %% \item 
       
   225 %% \end{itemize}
       
   226 %% \end{frame}
   224 
   227 
   225 \section{Differentiation}
   228 \section{Differentiation}
   226 
   229 
   227 \begin{frame}[fragile]
   230 \begin{frame}[fragile]
   228 \frametitle{Numerical Differentiation}
   231 \frametitle{Numerical Differentiation}
   259   \includegraphics[height=2in, interpolate=true]{data/fwdDiff}
   262   \includegraphics[height=2in, interpolate=true]{data/fwdDiff}
   260 \end{center}
   263 \end{center}
   261 \end{frame}
   264 \end{frame}
   262 
   265 
   263 \begin{frame}[fragile]
   266 \begin{frame}[fragile]
   264 \frametitle{}
   267 \frametitle{Example}
       
   268 \begin{itemize}
       
   269 \item Given x, y positions of a particle in \typ{pos.txt}
       
   270 \item Find velocity \& acceleration in x, y directions
       
   271 \end{itemize}
       
   272 \small{
       
   273 \begin{center}
       
   274 \begin{tabular}{| c | c | c |}
       
   275 \hline
       
   276 $X$ & $Y$ \\ \hline
       
   277 0.     &  0.\\ \hline
       
   278 0.25   &  0.47775\\ \hline
       
   279 0.5    &  0.931\\ \hline
       
   280 0.75   &  1.35975\\ \hline
       
   281 1.     &  1.764\\ \hline
       
   282 1.25   &  2.14375\\ \hline
       
   283 \vdots & \vdots\\ \hline
       
   284 \end{tabular}
       
   285 \end{center}}
       
   286 \end{frame}
       
   287 
       
   288 \begin{frame}[fragile]
       
   289 \frametitle{Example \ldots}
       
   290 \begin{itemize}
       
   291 \item Read the file
       
   292 \item Obtain an array of x, y
       
   293 \item Obtain velocity and acceleration
       
   294 \item use \typ{deltaT = 0.05}
       
   295 \end{itemize}
       
   296 \begin{lstlisting}
       
   297 In []: X = []
       
   298 In []: Y = []
       
   299 In []: for line in open('location.txt'):
       
   300   ....     points = line.split()
       
   301   ....     X.append(float(points[0]))
       
   302   ....     Y.append(float(points[1]))
       
   303 In []: S = array([X, Y])
       
   304 \end{lstlisting}
       
   305 \end{frame}
       
   306 
       
   307 
       
   308 \begin{frame}[fragile]
       
   309 \frametitle{Example \ldots}
       
   310 \begin{itemize}
       
   311 \item use \typ{deltaT = 0.05}
       
   312 \end{itemize}
       
   313 \begin{lstlisting}
       
   314 In []: deltaT = 0.05
       
   315 
       
   316 In []: v = (S[:,1:]-S[:,:-1])/deltaT
       
   317 
       
   318 In []: a = (v[:,1:]-v[:,:-1])/deltaT
       
   319 \end{lstlisting}
       
   320 Try Plotting the position, velocity \& acceleration.
   265 \end{frame}
   321 \end{frame}
   266 
   322 
   267 \section{Quadrature}
   323 \section{Quadrature}
   268 
   324 
   269 \begin{frame}[fragile]
   325 \begin{frame}[fragile]
   327 \begin{lstlisting}
   383 \begin{lstlisting}
   328 In []: quad(f, 0, 1)
   384 In []: quad(f, 0, 1)
   329 \end{lstlisting}
   385 \end{lstlisting}
   330 Returns the integral and an estimate of the absolute error in the result.
   386 Returns the integral and an estimate of the absolute error in the result.
   331 \begin{itemize}
   387 \begin{itemize}
   332 \item Use \typ{dblquad} for Double integrals
   388 \item Look at \typ{dblquad} for Double integrals
   333 \item Use \typ{tplquad} for Triple integrals
   389 \item Use \typ{tplquad} for Triple integrals
   334 \end{itemize}
   390 \end{itemize}
   335 \end{frame}
   391 \end{frame}
   336 
   392 
   337 \begin{frame}
   393 \begin{frame}