Updated sessions of day 1 with the corrections from GRD.
--- a/day1/session1.tex Tue Mar 23 00:09:50 2010 +0530
+++ b/day1/session1.tex Mon Mar 29 15:55:07 2010 +0530
@@ -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}
--- a/day1/session2.tex Tue Mar 23 00:09:50 2010 +0530
+++ b/day1/session2.tex Mon Mar 29 15:55:07 2010 +0530
@@ -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 @@
\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
--- a/day1/session3.tex Tue Mar 23 00:09:50 2010 +0530
+++ b/day1/session3.tex Mon Mar 29 15:55:07 2010 +0530
@@ -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 @@
\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 @@
\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}
--- a/day1/session4.tex Tue Mar 23 00:09:50 2010 +0530
+++ b/day1/session4.tex Mon Mar 29 15:55:07 2010 +0530
@@ -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 @@
\begin{frame}[fragile]
\frametitle{Accessing elements}
+ \begin{small}
\begin{lstlisting}
In []: c
Out[]:
@@ -182,16 +183,17 @@
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 @@
\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 @@
[ 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]
--- a/day1/session5.tex Tue Mar 23 00:09:50 2010 +0530
+++ b/day1/session5.tex Mon Mar 29 15:55:07 2010 +0530
@@ -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}
--- a/day1/session6.tex Tue Mar 23 00:09:50 2010 +0530
+++ b/day1/session6.tex Mon Mar 29 15:55:07 2010 +0530
@@ -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 @@
\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 @@
\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 @@
\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 @@
\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 @@
\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 @@
\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}