# HG changeset patch # User Puneeth Chaganti # Date 1256721351 -19800 # Node ID 081600805dde5b56e476a0f85f9a9faf92dc0102 # Parent ffa8f417d761b5b1b781201203875a58be7d8c38 Minor edits to sessions 5 and 6. diff -r ffa8f417d761 -r 081600805dde day1/session5.tex --- a/day1/session5.tex Wed Oct 28 12:36:25 2009 +0530 +++ b/day1/session5.tex Wed Oct 28 14:45:51 2009 +0530 @@ -141,7 +141,6 @@ T.append(float(t)) In []: L = array(L) In []: T = array(T) -In []: Tsq = T*T \end{lstlisting} \end{frame} @@ -300,6 +299,7 @@ \end{lstlisting} \begin{itemize} \item \typ{def} +\item name \item arguments \item \typ{return} \end{itemize} @@ -319,50 +319,7 @@ In []: f(1) Out[]: 1.8414709848078965 \end{lstlisting} -\end{frame} - - -\begin{frame}[fragile] -\frametitle{Functions - Default Arguments} -\begin{lstlisting} -In []: def f(x=1): - return sin(x)+x**2 -In []: f(10) -Out[]: 99.455978889110625 -In []: f(1) -Out[]: 1.8414709848078965 -In []: f() -Out[]: 1.8414709848078965 -\end{lstlisting} -\end{frame} - -\begin{frame}[fragile] -\frametitle{Functions - Keyword Arguments} -\begin{lstlisting} -In []: def f(x=1, y=pi): - return sin(y)+x**2 -In []: f() -Out[]: 1.0000000000000002 -In []: f(2) -Out[]: 4.0 -In []: f(y=2) -Out[]: 1.9092974268256817 -In []: f(y=pi/2,x=0) -Out[]: 1.0 -\end{lstlisting} -\end{frame} - -\begin{frame}[fragile] - \frametitle{More on functions} - \begin{itemize} - \item Scope of variables in the function is local - \item Mutable items are \alert{passed by reference} - \item First line after definition may be a documentation string - (\alert{recommended!}) - \item Function definition and execution defines a name bound to the - function - \item You \emph{can} assign a variable to a function! - \end{itemize} +More on Functions later \ldots \end{frame} \begin{frame}[fragile] @@ -392,5 +349,6 @@ \item Quadrature \end{itemize} \end{frame} + \end{document} diff -r ffa8f417d761 -r 081600805dde day1/session6.tex --- a/day1/session6.tex Wed Oct 28 12:36:25 2009 +0530 +++ b/day1/session6.tex Wed Oct 28 14:45:51 2009 +0530 @@ -198,8 +198,8 @@ \begin{frame}[fragile] \frametitle{Initial Estimates} \begin{itemize} -\item Find the roots of $cosx-x^2$ between $-\pi/2$ and $\pi/2$ -\item We shall use a crude method to get an initial estimate first +\item Find roots of $cosx-x^2$ in $(-\pi/2, \pi/2)$ +\item How to get a rough initial estimate? \end{itemize} \begin{enumerate} \item Check for change of signs of $f(x)$ in the given interval @@ -350,15 +350,28 @@ \begin{frame}[fragile] \frametitle{Scipy Methods \dots} -\small{ +\begin{small} \begin{lstlisting} In []: from scipy.optimize import fixed_point In []: from scipy.optimize import bisect In []: from scipy.optimize import newton -\end{lstlisting}} +\end{lstlisting} +\end{small} \end{frame} +\begin{frame} + \frametitle{Things we have learned} + \begin{itemize} + \item Solving ODEs + \item Finding Roots + \begin{itemize} + \item Estimating Interval + \item Newton Raphson + \item Scipy methods + \end{itemize} + \end{itemize} +\end{frame} \end{document}