# HG changeset patch # User Santosh G. Vattam # Date 1272361828 -19800 # Node ID 5e485a5d8ac47055482671fa770d05cc27cd188c # Parent a0bec380b44fcb9c63dc2fdc5b85522811aa989e Minor corrections post SVCE. diff -r a0bec380b44f -r 5e485a5d8ac4 day1/session1.tex --- a/day1/session1.tex Tue Apr 27 12:14:30 2010 +0530 +++ b/day1/session1.tex Tue Apr 27 15:20:28 2010 +0530 @@ -485,6 +485,13 @@ \end{frame} \begin{frame}[fragile] + \frametitle{Axes lengths} + \begin{center} + \includegraphics[height=3in, interpolate=true]{data/limits} + \end{center} +\end{frame} + +\begin{frame}[fragile] \frametitle{Review Problem} \begin{enumerate} \item Plot x, -x, sin(x), xsin(x) in range $-5\pi$ to $5\pi$ @@ -567,6 +574,13 @@ \end{frame} \begin{frame}[fragile] + \frametitle{Result graph} + \begin{center} + \includegraphics[height=3in, interpolate=true]{data/four_plot} + \end{center} +\end{frame} + +\begin{frame}[fragile] \frametitle{What did we learn?} \begin{itemize} \item Starting up IPython diff -r a0bec380b44f -r 5e485a5d8ac4 day1/session3.tex --- a/day1/session3.tex Tue Apr 27 12:14:30 2010 +0530 +++ b/day1/session3.tex Tue Apr 27 15:20:28 2010 +0530 @@ -311,6 +311,22 @@ \end{frame} \begin{frame}[fragile] + \frametitle{Inserting elements into dictionary} + \emphbar{\alert{d[key] = value}} + \begin{lstlisting} + In []: d['bin'] = 'binary file' + In []: d + Out[]: + {'bin': 'binary file', + 'cpp': 'complex code', + 'java': 'bad code', + 'png': 'image file', + 'py': 'python code', + 'txt': 'text file'} + \end{lstlisting} +\end{frame} + +\begin{frame}[fragile] \frametitle{Getting back to the problem} Let our dictionary be: \begin{lstlisting} diff -r a0bec380b44f -r 5e485a5d8ac4 day1/session4.tex --- a/day1/session4.tex Tue Apr 27 12:14:30 2010 +0530 +++ b/day1/session4.tex Tue Apr 27 15:20:28 2010 +0530 @@ -589,7 +589,9 @@ \item Now plot \typ{Tline} vs. \typ{L}, to get the Least squares fit line. \end{itemize} \begin{lstlisting} -In []: plot(L, Tline) +In []: plot(L, Tline, 'r') + +In []: plot(L, tsq, 'o') \end{lstlisting} \end{frame} diff -r a0bec380b44f -r 5e485a5d8ac4 day1/session6.tex --- a/day1/session6.tex Tue Apr 27 12:14:30 2010 +0530 +++ b/day1/session6.tex Tue Apr 27 15:20:28 2010 +0530 @@ -273,8 +273,8 @@ \frametitle{Functions - Definition} We have been using them all along. Now let's see how to define them. \begin{lstlisting} -In []: def f(z): - return sin(z)+cos(z)*cos(z) +In []: def g(z): + ....: return sin(z)+cos(z)*cos(z) \end{lstlisting} \begin{itemize} \item \typ{def} @@ -287,15 +287,15 @@ \begin{frame}[fragile] \frametitle{Functions - Calling them} \begin{lstlisting} -In []: f() +In []: g() --------------------------------------- \end{lstlisting} -\alert{\typ{TypeError:}}\typ{f() takes exactly 1 argument} +\alert{\typ{TypeError:}}\typ{g() takes exactly 1 argument} \typ{(0 given)} \begin{lstlisting} -In []: f(0) +In []: g(0) Out[]: 1.0 -In []: f(1) +In []: g(1) Out[]: 1.1333975665343254 \end{lstlisting} More on Functions later \ldots @@ -305,7 +305,7 @@ \frametitle{\typ{fsolve} \ldots} Find the root of $sin(z)+cos^2(z)$ nearest to $0$ \begin{lstlisting} -In []: fsolve(f, 0) +In []: fsolve(g, 0) Out[]: -0.66623943249251527 \end{lstlisting} \begin{center} @@ -315,16 +315,16 @@ \begin{frame}[fragile] \frametitle{Exercise Problem} - Find the root of the equation $x^2 - sin(x) + cos^2(x) == tan(x)$ nearest to $0$ + Find the root of the equation $x^2 - sin(x) + cos^2(x) = tan(x)$ nearest to $0$ \end{frame} \begin{frame}[fragile] \frametitle{Solution} \begin{small} \begin{lstlisting} -def f(x): +def g(x): return x**2 - sin(x) + cos(x)*cos(x) - tan(x) -fsolve(f, 0) +fsolve(g, 0) \end{lstlisting} \end{small} \begin{center} @@ -353,14 +353,14 @@ \item Let's consider the spread of an epidemic in a population \item $\frac{dy}{dt} = ky(L-y)$ gives the spread of the disease \item L is the total population. -\item Use L = 25000, k = 0.00003, y(0) = 250 +\item Use L = 250000, k = 0.00003, y(0) = 250 \item Define a function as below \end{itemize} \begin{lstlisting} In []: from scipy.integrate import odeint In []: def epid(y, t): .... k = 0.00003 - .... L = 25000 + .... L = 250000 .... return k*y*(L-y) .... \end{lstlisting} @@ -414,8 +414,8 @@ .... omega = initial[1] .... g = 9.81 .... L = 0.2 - .... f=[omega, -(g/L)*sin(theta)] - .... return f + .... F=[omega, -(g/L)*sin(theta)] + .... return F .... \end{lstlisting} \end{frame} diff -r a0bec380b44f -r 5e485a5d8ac4 day2/session1.tex --- a/day2/session1.tex Tue Apr 27 12:14:30 2010 +0530 +++ b/day2/session1.tex Tue Apr 27 15:20:28 2010 +0530 @@ -174,12 +174,12 @@ \begin{lstlisting} In []: t = True -In []: f = not t +In []: F = not t -In []: f or t +In []: F or t Out[]: True -In []: f and t +In []: F and t Out[]: False \end{lstlisting} \inctime{5}