diff options
author | Santosh G. Vattam | 2010-04-27 15:20:28 +0530 |
---|---|---|
committer | Santosh G. Vattam | 2010-04-27 15:20:28 +0530 |
commit | aeb424782a888813d5c56ea885665f8a85a21d89 (patch) | |
tree | 82cf7e9671897cb7b3c7e03bca24314b6e0aa5d8 | |
parent | 8c5dc893d695e91e5068e3719be9ead30e75d2e0 (diff) | |
download | workshops-aeb424782a888813d5c56ea885665f8a85a21d89.tar.gz workshops-aeb424782a888813d5c56ea885665f8a85a21d89.tar.bz2 workshops-aeb424782a888813d5c56ea885665f8a85a21d89.zip |
Minor corrections post SVCE.
-rw-r--r-- | day1/session1.tex | 14 | ||||
-rw-r--r-- | day1/session3.tex | 16 | ||||
-rw-r--r-- | day1/session4.tex | 4 | ||||
-rwxr-xr-x | day1/session6.tex | 28 | ||||
-rw-r--r-- | day2/session1.tex | 6 |
5 files changed, 50 insertions, 18 deletions
diff --git a/day1/session1.tex b/day1/session1.tex index eaca360..d3ebd3c 100644 --- a/day1/session1.tex +++ b/day1/session1.tex @@ -485,6 +485,13 @@ In []: ylim(ymin-0.2, ymax+0.2) \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 @@ To avoid this, run using \alert{\typ{\%run -i four_plot.py}}\\ \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 --git a/day1/session3.tex b/day1/session3.tex index 4a7591d..187bf5c 100644 --- a/day1/session3.tex +++ b/day1/session3.tex @@ -311,6 +311,22 @@ Out[]: ['complex code', 'python code', \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 --git a/day1/session4.tex b/day1/session4.tex index e131dad..585160f 100644 --- a/day1/session4.tex +++ b/day1/session4.tex @@ -589,7 +589,9 @@ In []: Tline.shape \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 --git a/day1/session6.tex b/day1/session6.tex index 455b86d..184a51c 100755 --- a/day1/session6.tex +++ b/day1/session6.tex @@ -273,8 +273,8 @@ In []: fsolve(sin(z)+cos(z)*cos(z), 0) \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 @@ In []: def f(z): \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 @@ More on Functions later \ldots \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 @@ Out[]: -0.66623943249251527 \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 @@ fsolve(f, 0) \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 @@ In []: def pend_int(initial, t): .... 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 --git a/day2/session1.tex b/day2/session1.tex index 2be0c35..84f27a1 100644 --- a/day2/session1.tex +++ b/day2/session1.tex @@ -174,12 +174,12 @@ Out[]: 3.0 \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} |