diff options
-rw-r--r-- | day1/session1.tex | 20 | ||||
-rw-r--r-- | day1/session2.tex | 3 | ||||
-rw-r--r-- | day1/session3.tex | 23 | ||||
-rw-r--r-- | day1/session4.tex | 14 | ||||
-rw-r--r-- | day1/session5.tex | 2 | ||||
-rwxr-xr-x | day1/session6.tex | 30 |
6 files changed, 49 insertions, 43 deletions
diff --git a/day1/session1.tex b/day1/session1.tex index 5f525ca..4f4177c 100644 --- a/day1/session1.tex +++ b/day1/session1.tex @@ -77,7 +77,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {08 March, 2010\\Day 1, Session 1} +\date[] {02 April, 2010\\Day 1, Session 1} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -157,21 +157,21 @@ \item Editor - we recommend \alert{scite} \item Data files: \begin{itemize} - \item \typ{sslc/sslc1.txt} - \item \typ{pendulum/pendulum.txt} - \item \typ{motion-plot/pos.txt} - \item \typ{word-freq/holmes.txt} - \item \typ{anagrams/anag.txt} + \item \typ{sslc1.txt} + \item \typ{pendulum.txt} + \item \typ{pos.txt} + \item \typ{holmes.txt} + \item \typ{anag.txt} \end{itemize} \item Python scripts: \begin{itemize} - \item \typ{sslc/sslc_allreg.py} - \item \typ{sslc/sslc_science.py} + \item \typ{sslc_allreg.py} + \item \typ{sslc_science.py} \end{itemize} \item Images \begin{itemize} - \item \typ{lena/lena.png} - \item \typ{smoothing/smoothing.gif} + \item \typ{lena.png} + \item \typ{smoothing.gif} \end{itemize} \end{enumerate} \end{frame} diff --git a/day1/session2.tex b/day1/session2.tex index 9afc5b9..dbab39a 100644 --- a/day1/session2.tex +++ b/day1/session2.tex @@ -78,7 +78,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {08 March, 2010\\Day 1, Session 2} +\date[] {02 April, 2010\\Day 1, Session 2} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -341,7 +341,6 @@ Out[]: 9 9 9 \alert{Data is usually present in a file!} \\ Lets look at the \typ{pendulum.txt} file. \begin{lstlisting} -In []: cd circulate/pendulum/ In []: cat pendulum.txt 1.0000e-01 6.9004e-01 1.1000e-01 6.9497e-01 diff --git a/day1/session3.tex b/day1/session3.tex index e92ebed..f2bff96 100644 --- a/day1/session3.tex +++ b/day1/session3.tex @@ -73,13 +73,13 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Title page -\title[Statistics]{Python for Scienc and Engg: Statistics} +\title[Statistics]{Python for Science and Engg: Statistics} \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {08 March, 2010\\Day 1, Session 3} +\date[] {02 April, 2010\\Day 1, Session 3} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -145,9 +145,9 @@ In []: g_list = [] In []: for line in open('pendulum.txt'): .... point = line.split() - .... l = float(point[0]) + .... L = float(point[0]) .... t = float(point[1]) - .... g = 4 * pi * pi * l / (t * t) + .... g = 4 * pi * pi * L / (t * t) .... g_list.append(g) \end{lstlisting} \end{frame} @@ -274,7 +274,7 @@ Recall \typ{p = [2, 3, 5, 7]} and\\ \begin{lstlisting} In []: d = {'png' : 'image file', 'txt' : 'text file', - 'py' : 'python code' + 'py' : 'python code', 'java': 'bad code', 'cpp': 'complex code'} @@ -296,14 +296,17 @@ Out[]: False \begin{frame}[fragile] \frametitle{Dictionaries \ldots} - \begin{lstlisting} + \begin{small} + \begin{lstlisting} In []: d.keys() -Out[]: ['py', 'txt', 'jpg'] +Out[]: ['cpp', 'py', 'txt', 'java', 'png'] In []: d.values() -Out[]: ['python code', 'text file', - 'image file'] - \end{lstlisting} +Out[]: ['complex code', 'python code', + 'text file', 'bad code', + 'image file'] + \end{lstlisting} + \end{small} \inctime{10} \end{frame} diff --git a/day1/session4.tex b/day1/session4.tex index 42227f1..b39b5fd 100644 --- a/day1/session4.tex +++ b/day1/session4.tex @@ -79,7 +79,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {08 March, 2010\\Day 1, Session 4} +\date[] {02 April, 2010\\Day 1, Session 4} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -171,6 +171,7 @@ Also available \alert{\typ{zeros, zeros_like}} \begin{frame}[fragile] \frametitle{Accessing elements} + \begin{small} \begin{lstlisting} In []: c Out[]: @@ -182,16 +183,17 @@ In []: c[1][2] Out[]: 23 In []: c[1,2] Out[]: 23 + +In []: c[1] +Out[]: array([21, 22, 23]) \end{lstlisting} + \end{small} \end{frame} \begin{frame}[fragile] \frametitle{Changing elements} \begin{small} \begin{lstlisting} -In []: c[1] -Out[]: array([21, 22, 23]) - In []: c[1,1] = -22 In []: c Out[]: @@ -394,10 +396,11 @@ array([[ -6. , 6. , -6. , -3. ], \begin{frame}[fragile] \frametitle{Inverse of a Matrix} \begin{lstlisting} -In []: inv(a) + \end{lstlisting} \begin{small} \begin{lstlisting} +In []: inv(a) Out[]: array([[-0.5 , 0.55, -0.15, 0.7 ], [ 0.75, -0.5 , 0.5 , -0.75], @@ -405,6 +408,7 @@ array([[-0.5 , 0.55, -0.15, 0.7 ], [ 0.25, -0.25, 0.25, -0.25]]) \end{lstlisting} \end{small} +\emphbar{Try this: \typ{I = dot(a, inv(a))}} \end{frame} \begin{frame}[fragile] diff --git a/day1/session5.tex b/day1/session5.tex index 46726cc..7bd9f70 100644 --- a/day1/session5.tex +++ b/day1/session5.tex @@ -78,7 +78,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {08 March, 2010\\Day 1, Session 5} +\date[] {02 April, 2010\\Day 1, Session 5} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff --git a/day1/session6.tex b/day1/session6.tex index 61b536c..0e34996 100755 --- a/day1/session6.tex +++ b/day1/session6.tex @@ -78,7 +78,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {08 March, 2010\\Day 1, Session 6} +\date[] {02 April, 2010\\Day 1, Session 6} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -239,7 +239,7 @@ Use \kwrd{solve()} \begin{frame}[fragile] \frametitle{\typ{fsolve}} -Find the root of $sin(x)+cos^2(x)$ nearest to $0$ +Find the root of $sin(z)+cos^2(z)$ nearest to $0$ \vspace{-0.1in} \begin{center} \includegraphics[height=2.8in, interpolate=true]{data/fsolve} @@ -248,18 +248,18 @@ Find the root of $sin(x)+cos^2(x)$ nearest to $0$ \begin{frame}[fragile] \frametitle{\typ{fsolve}} -Root of $sin(x)+cos^2(x)$ nearest to $0$ +Root of $sin(z)+cos^2(z)$ nearest to $0$ \begin{lstlisting} -In []: fsolve(sin(x)+cos(x)*cos(x), 0) -NameError: name 'x' is not defined +In []: fsolve(sin(z)+cos(z)*cos(z), 0) +NameError: name 'z' is not defined \end{lstlisting} \end{frame} \begin{frame}[fragile] \frametitle{\typ{fsolve}} \begin{lstlisting} -In []: x = linspace(-pi, pi) -In []: fsolve(sin(x)+cos(x)*cos(x), 0) +In []: z = linspace(-pi, pi) +In []: fsolve(sin(z)+cos(z)*cos(z), 0) \end{lstlisting} \begin{small} \alert{\typ{TypeError:}} @@ -271,8 +271,8 @@ In []: fsolve(sin(x)+cos(x)*cos(x), 0) \frametitle{Functions - Definition} We have been using them all along. Now let's see how to define them. \begin{lstlisting} -In []: def f(x): - return sin(x)+cos(x)*cos(x) +In []: def f(z): + return sin(z)+cos(z)*cos(z) \end{lstlisting} \begin{itemize} \item \typ{def} @@ -285,7 +285,7 @@ In []: def f(x): \begin{frame}[fragile] \frametitle{Functions - Calling them} \begin{lstlisting} -In [15]: f() +In []: f() --------------------------------------- \end{lstlisting} \alert{\typ{TypeError:}}\typ{f() takes exactly 1 argument} @@ -301,7 +301,7 @@ More on Functions later \ldots \begin{frame}[fragile] \frametitle{\typ{fsolve} \ldots} -Find the root of $sin(x)+cos^2(x)$ nearest to $0$ +Find the root of $sin(z)+cos^2(z)$ nearest to $0$ \begin{lstlisting} In []: fsolve(f, 0) Out[]: -0.66623943249251527 @@ -313,16 +313,16 @@ Out[]: -0.66623943249251527 \begin{frame}[fragile] \frametitle{Exercise Problem} - Find the root of the equation $x^2 - sin(x) + cos^2(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): - return x**2 - sin(x) + cos(x)*cos(x) - fsolve(f, 0) +def f(x): + return x**2 - sin(x) + cos(x)*cos(x) - tan(x) +fsolve(f, 0) \end{lstlisting} \end{small} \begin{center} |