day1/session4.tex
changeset 200 d80339ba98ee
parent 185 e59ab9ab1a89
child 203 5c0332b97ed6
equal deleted inserted replaced
199:85a799d90c6a 200:d80339ba98ee
   234           [-0.52532209, -0.08675134, -0.81649658],
   234           [-0.52532209, -0.08675134, -0.81649658],
   235           [-0.8186735 ,  0.61232756,  0.40824829]]))
   235           [-0.8186735 ,  0.61232756,  0.40824829]]))
   236 \end{lstlisting}
   236 \end{lstlisting}
   237 \end{small}
   237 \end{small}
   238 \end{frame}
   238 \end{frame}
   239 
       
   240 
       
   241 \section{Integration}
   239 \section{Integration}
   242 
   240 
   243 \subsection{Quadrature}
   241 \subsection{Quadrature}
   244 
   242 
   245 \begin{frame}[fragile]
   243 \begin{frame}[fragile]
   249 \item Area under $(sin(x) + x^2)$ in $(0,1)$
   247 \item Area under $(sin(x) + x^2)$ in $(0,1)$
   250 \item scipy has functions to do that
   248 \item scipy has functions to do that
   251 \end{itemize}
   249 \end{itemize}
   252 \small{\typ{In []: from scipy.integrate import quad}}
   250 \small{\typ{In []: from scipy.integrate import quad}}
   253 \begin{itemize}
   251 \begin{itemize}
   254 \item Inputs - function to integrate, limits
   252 \item Inputs - function to integrate, limits of integration
   255 \end{itemize}
   253 \end{itemize}
   256 \begin{lstlisting}
   254 \begin{lstlisting}
   257 In []: x = 0
   255 In []: x = 0
   258 In []: quad(sin(x)+x**2, 0, 1)
   256 In []: quad(sin(x)+x**2, 0, 1)
   259 \end{lstlisting}
   257 \end{lstlisting}
   349 
   347 
   350 \subsection{ODEs}
   348 \subsection{ODEs}
   351 
   349 
   352 \begin{frame}[fragile]
   350 \begin{frame}[fragile]
   353 \frametitle{ODE Integration}
   351 \frametitle{ODE Integration}
   354 We shall use the simple ODE of a simple pendulum. 
   352 We shall look at the motion of a simple pendulum. 
   355 \begin{equation*}
   353 \begin{equation*}
   356 \ddot{\theta} = -\frac{g}{L}sin(\theta)
   354 \ddot{\theta} = -\frac{g}{L}sin(\theta)
   357 \end{equation*}
   355 \end{equation*}
   358 \begin{itemize}
   356 \begin{itemize}
   359 \item This equation can be written as a system of two first order ODEs
   357 \item This equation can be written as a system of two first order ODEs