summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--day1/day1quiz1.tex1
-rw-r--r--day1/day1quiz2.tex2
-rw-r--r--day1/session1.tex111
-rw-r--r--day1/session2.tex45
-rw-r--r--day1/session3.tex4
-rw-r--r--day1/session4.tex19
-rw-r--r--day1/session5.tex4
-rwxr-xr-xday1/session6.tex2
-rwxr-xr-xday2/day2quiz.tex4
-rw-r--r--day2/session1.tex7
-rw-r--r--day2/session2.tex33
-rw-r--r--day2/session3.tex2
-rw-r--r--day2/session4.tex2
-rw-r--r--day2/session5.tex2
14 files changed, 184 insertions, 54 deletions
diff --git a/day1/day1quiz1.tex b/day1/day1quiz1.tex
index f3a7bf4..331eb57 100644
--- a/day1/day1quiz1.tex
+++ b/day1/day1quiz1.tex
@@ -74,6 +74,7 @@ Describe the plot produced by the following:
In []: x = linspace(0, 2*pi, 50)
In []: plot(x, cos(x), 'go')
\end{lstlisting}
+Note: Do not draw it, just describe the plot
\end{frame}
\begin{frame}
diff --git a/day1/day1quiz2.tex b/day1/day1quiz2.tex
index 539e1e5..64bc265 100644
--- a/day1/day1quiz2.tex
+++ b/day1/day1quiz2.tex
@@ -35,7 +35,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title page
-\title[Basic Python]{Python for science and engineering: Day 1, Quiz 2}
+\title[Basic Python]{Python for science and engineering: Day 2, Quiz 1}
\author[FOSSEE Team] {FOSSEE}
diff --git a/day1/session1.tex b/day1/session1.tex
index 309e890..426b9e8 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[] {28 January, 2010\\Day 1, Session 1}
+\date[] {12 February, 2010\\Day 1, Session 1}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
@@ -123,6 +123,65 @@
%% \end{frame}
\begin{frame}
+ \frametitle{Workshop Schedule: Day 1}
+ \begin{description}
+ \item[Session 1] Fri 14:00--15:00
+ \item[Session 2] Fri 15:05--16:05
+ \item[Session 3] Fri 16:10--17:10
+ \item[Quiz 1] Fri 17:10--17:25
+ \item[Exercises] Thu 17:30--18:00
+ \end{description}
+\end{frame}
+
+\begin{frame}
+ \frametitle{Workshop Schedule: Day 2}
+ \begin{description}
+ \item[Session 1] Sat 09:00--10:00
+ \item[Session 2] Sat 10:05--11:05
+ \item[Session 3] Sat 11:20--12:20
+ \item[Quiz 2] Fri 14:25--14:40
+ \end{description}
+\end{frame}
+
+\begin{frame}
+ \frametitle{Workshop Schedule: Day 3}
+ \begin{description}
+ \item[Session 1] Sun 09:00--10:00
+ \item[Session 2] Sun 10:05--11:05
+ \item[Session 3] Sun 11:20--12:20
+ \item[Quiz 3] Sun 12:20--12:30
+ \item[Exercises] Sun 12:30--13:00
+ \end{description}
+\end{frame}
+
+\section{Checklist}
+\begin{frame}
+\frametitle{Checklist}
+ \begin{enumerate}
+ \item IPython
+ \item Editor
+ \item Data files:
+ \begin{itemize}
+ \item \typ{sslc1.txt}
+ \item \typ{pendulum.txt}
+ \item \typ{points.txt}
+ \item \typ{pos.txt}
+ \item \typ{holmes.txt}
+ \end{itemize}
+ \item Python scripts:
+ \begin{itemize}
+ \item \typ{sslc_allreg.py}
+ \item \typ{sslc_science.py}
+ \end{itemize}
+ \item Images
+ \begin{itemize}
+ \item \typ{lena.png}
+ \item \typ{smoothing.gif}
+ \end{itemize}
+ \end{enumerate}
+\end{frame}
+
+\begin{frame}
\frametitle{About the Workshop}
\begin{block}{Intended Audience}
\begin{itemize}
@@ -140,6 +199,40 @@
\end{block}
\end{frame}
+\section{Starting up Ipython}
+\begin{frame}[fragile]
+\frametitle{Starting up \ldots}
+\begin{block}{}
+\begin{lstlisting}
+ $ ipython -pylab
+\end{lstlisting} %$
+\end{block}
+\begin{lstlisting}
+ In []: print "Hello, World!"
+ Hello, World!
+\end{lstlisting}
+Exiting
+\begin{lstlisting}
+ In []: ^D(Ctrl-D)
+ Do you really want to exit([y]/n)? y
+\end{lstlisting}
+\end{frame}
+
+\section{Loops}
+\begin{frame}[fragile]
+\frametitle{Loops}
+Breaking out of loops
+\begin{lstlisting}
+ In []: while True:
+ ...: print "Hello, World!"
+ ...:
+ Hello, World!
+ Hello, World!^C(Ctrl-C)
+ ------------------------------------
+ KeyboardInterrupt
+\end{lstlisting}
+\end{frame}
+
\section{Plotting}
\subsection{Drawing plots}
\begin{frame}[fragile]
@@ -301,8 +394,10 @@ In []: figure(1)
In []: plot(y, sin(y))
In []: figure(2)
In []: plot(y, cos(y))
+In []: savefig('cosine.png')
In []: figure(1)
In []: title('sin(y)')
+In []: savefig('sine.png')
In []: close()
In []: close()
\end{lstlisting}
@@ -312,10 +407,10 @@ In []: close()
\frametitle{Showing it better}
\vspace{-0.15in}
\begin{lstlisting}
-In []: plot(y, sin(y), 'g')
+In []: plot(y, cos(y), 'r')
In []: clf()
-In []: plot(y, cos(y), 'r', linewidth=2)
+In []: plot(y, sin(y), 'g', linewidth=2)
\end{lstlisting}
\vspace*{-0.2in}
\begin{center}
@@ -345,8 +440,7 @@ In []: ymin, ymax = ylim()
\end{lstlisting}
\emphbar{Set the axes limits}
\begin{lstlisting}
-In []: xmax = 2*pi
-In []: xlim(xmin, xmax)
+In []: xlim(xmin, 2*pi)
In []: ylim(ymin-0.2, ymax+0.2)
\end{lstlisting}
\end{frame}
@@ -398,9 +492,9 @@ In []: ylim(-5*pi, 5*pi)
\frametitle{Saving Commands}
Save commands of review problem into file
\begin{itemize}
-\item Use \typ{\%hist} command of IPython (Recall \%\typ{hist} from the previous session)
+\item Use \typ{\%hist} command of IPython
\item Identify the required line numbers
-\item Then, use \typ{\%save} command of IPython (Recall \%\typ{save} from the previous session)
+\item Then, use \typ{\%save} command of IPython
\end{itemize}
\typ{In []: \%hist}\\
\typ{In []: \%save four_plot.py} \alert{\typ{16 18-27}}
@@ -421,6 +515,9 @@ Save commands of review problem into file
\begin{frame}[fragile]
\frametitle{What did we learn?}
\begin{itemize}
+ \item Starting up IPython
+ \item \kwrd{\%hist} - History of commands
+ \item \kwrd{\%save} - Saving commands
\item Running a script using \kwrd{\%run -i}
\item Creating simple plots.
\item Adding labels and legends.
diff --git a/day1/session2.tex b/day1/session2.tex
index fb2e128..2e493e4 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[] {28 January, 2010\\Day 1, Session 2}
+\date[] {12 February, 2010\\Day 1, Session 2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
@@ -208,43 +208,45 @@ In []: mtlist = []
\end{lstlisting}
\emphbar{Empty List}
\begin{lstlisting}
-In []: a = [ 1, 2, 3, 4, 5]
+In []: p = [ 2, 3, 5, 7]
-In []: a[0]+a[1]+a[-1]
-Out[]: 8
+In []: p[0]+p[1]+p[-1]
+Out[]: 12
\end{lstlisting}
\end{frame}
\begin{frame}[fragile]
\frametitle{List: Slicing}
\begin{block}{Remember\ldots}
- \kwrd{In []: a = [ 1, 2, 3, 4, 5]}
+ \kwrd{In []: p = [ 2, 3, 5, 7]}
\end{block}
\begin{lstlisting}
-In []: a[1:3]
-Out[]: [2, 3]
+In []: p[1:3]
+Out[]: [3, 5]
\end{lstlisting}
\emphbar{A slice}
\begin{lstlisting}
-In []: a[1:-1]
-Out[]: [2, 3, 4]
+In []: p[0:-1]
+Out[]: [2, 3, 5]
+In []: p[::2]
+Out[]: [2, 5]
\end{lstlisting}
-\alert{\typ{list[initial:final]}}
+\alert{\typ{list[initial:final:step]}}
\end{frame}
%% more on list slicing
\begin{frame}[fragile]
\frametitle{List operations}
\begin{lstlisting}
-In []: b = [ 6, 7, 8, 9]
-In []: c = a + b
+In []: b = [ 11, 13, 17]
+In []: c = p + b
In []: c
-Out[]: [1, 2, 3, 4, 5, 6, 7, 8, 9]
+Out[]: [2, 3, 5, 7, 11, 13, 17]
-In []: a.append(6)
-In []: a
-Out[]: [ 1, 2, 3, 4, 5, 6]
+In []: p.append(11)
+In []: p
+Out[]: [ 2, 3, 5, 7, 11]
\end{lstlisting}
%\inctime{10}
\end{frame}
@@ -299,6 +301,12 @@ In []: t = [0.69, 0.90, 1.19,
\begin{lstlisting}
In []: tsq = []
+In []: len(l)
+Out[]: 9
+
+In []: len(t)
+Out[]: 9
+
In []: for time in t:
....: tsq.append(time*time)
....:
@@ -312,14 +320,15 @@ This gives \kwrd{tsq} which is the list of squares of \typ{t} values.
\begin{frame}[fragile]
\frametitle{How to come out of the \texttt{for} loop?}
- Recall that hitting the ``ENTER'' key twice returns the cursor to the previous indentation level
+ Hitting the ``ENTER'' key twice returns the cursor to the previous indentation level
\begin{lstlisting}
In []: for time in t:
....: tsq.append(time*time)
....:
....:
- In []: print tsq
+ In []: print tsq, len(tsq)
+ In []: plot(l, tsq)
\end{lstlisting}
\end{frame}
diff --git a/day1/session3.tex b/day1/session3.tex
index e785729..49e5773 100644
--- a/day1/session3.tex
+++ b/day1/session3.tex
@@ -79,7 +79,7 @@
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
-\date[] {28 January, 2010\\Day 1, Session 3}
+\date[] {12 February, 2010\\Day 1, Session 3}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
@@ -319,7 +319,7 @@ science = {}
\end{lstlisting}
\begin{itemize}
\item Keys will be region codes
- \item Values will be the number students who scored more than 90\% in that region
+ \item Values will be the number students who scored more than 90\% in that region in Science
\end{itemize}
\begin{block}{Sample \emph{science} dictionary}
\{'A': 729, 'C': 764, 'B': 1120,'E': 414, 'D': 603, 'F': 500\}
diff --git a/day1/session4.tex b/day1/session4.tex
index 89e5e00..9cf0768 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[] {28 January, 2010\\Day 1, Session 4}
+\date[] {13 February, 2010\\Day 2, Session 1}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
@@ -279,6 +279,21 @@ array([[11, 13],
\end{frame}
\begin{frame}[fragile]
+ \frametitle{Shape of a matrix}
+ \begin{lstlisting}
+In []: c
+Out[]:
+array([[11, 12, 13],
+ [ 0, 0, 0],
+ [31, 32, 33]])
+
+In []: c.shape
+Out[]: (3, 3)
+ \end{lstlisting}
+\emphbar{Shape specifies shape or dimensions of a matrix}
+\end{frame}
+
+\begin{frame}[fragile]
\frametitle{Slicing \& Striding Exercises}
\begin{small}
\begin{lstlisting}
@@ -518,7 +533,7 @@ Out[]: array([-1., 8., -1.])
\begin{frame}[fragile]
\frametitle{Getting $L$ and $T^2$}
-If you \alert{closed} IPython after session 2
+%If you \alert{closed} IPython after session 2
\begin{lstlisting}
In []: l = []
In []: t = []
diff --git a/day1/session5.tex b/day1/session5.tex
index 791b393..4f51519 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[] {28 January, 2010\\Day 1, Session 5}
+\date[] {12 February, 2010\\Day 1, Session 5}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
@@ -189,7 +189,7 @@ In []: plot(x, exp(x/10)*sin(x))
\begin{frame}[fragile]
\frametitle{Problem 3 cont...}
-Create a sequence of images in which the damped oscillator($e^{x/10}sin(x)$) slowly evolves over time.
+Create a sequence of images in which the damped oscillator($e^{-x/10}sin(x)$) slowly evolves over time.
\begin{columns}
\column{0.35\textwidth}
\includegraphics[width=1.5in,height=1.5in, interpolate=true]{data/plot2}
diff --git a/day1/session6.tex b/day1/session6.tex
index 6ef775f..85ff042 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[] {28 January, 2010\\Day 1, Session 6}
+\date[] {13 February, 2010\\Day 2, Session 2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
diff --git a/day2/day2quiz.tex b/day2/day2quiz.tex
index 5561d3d..c55f099 100755
--- a/day2/day2quiz.tex
+++ b/day2/day2quiz.tex
@@ -40,7 +40,7 @@
\author[FOSSEE Team] {FOSSEE}
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
-\date[] {\today \\ Day 2, Quiz 1}
+\date[] {\today \\ Day 2, Quiz}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -94,7 +94,7 @@ How do you create a complex number with real part 2 and imaginary part
\begin{frame}
\frametitle{\incqno }
- What does '*' * 40 produce?
+ What does 't' * 40 produce?
\end{frame}
\begin{frame}[fragile]
diff --git a/day2/session1.tex b/day2/session1.tex
index 82881a0..b733b88 100644
--- a/day2/session1.tex
+++ b/day2/session1.tex
@@ -79,7 +79,7 @@
\author[FOSSEE Team] {The FOSSEE Group}
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
-\date[] {29 January, 2010\\Day 2, Session 1}
+\date[] {13 February, 2010\\Day 2, Session 3}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
@@ -275,6 +275,9 @@ In []: a.lower?
\begin{lstlisting}
In []: ''.join(['a', 'b', 'c'])
Out[]: 'abc'
+
+In []: ', '.join(['a', 'b', 'c'])
+Out[]: 'a, b, c'
\end{lstlisting}
\end{frame}
@@ -508,7 +511,7 @@ Hello World
\subsection{Basic Conditional flow}
\begin{frame}[fragile]
\frametitle{\typ{If...elif...else} example}
-Type out the code below in an editor.
+Type the following code in an editor \& save as \alert{ladder.py}
\small
\begin{lstlisting}
x = int(raw_input("Enter an integer:"))
diff --git a/day2/session2.tex b/day2/session2.tex
index c64ca87..a4b8f10 100644
--- a/day2/session2.tex
+++ b/day2/session2.tex
@@ -78,7 +78,7 @@
\author[FOSSEE Team] {The FOSSEE Group}
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
-\date[] {12 January, 2010\\Day 2, Session 2}
+\date[] {13 February, 2010\\Day 3, Session 1}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
@@ -208,19 +208,6 @@ In []: for i in range(3, 10, 2):
\item It appears that for all starting values there is a cycle of 4, 2, 1 at which the procedure loops.
\end{enumerate}
Write a program that accepts the starting value and prints out the Collatz sequence.
-\end{frame}
-
-\begin{frame}[fragile]{Problem 1.3}
- Write a program that prints the following pyramid on the screen.
- \begin{lstlisting}
-1
-2 2
-3 3 3
-4 4 4 4
- \end{lstlisting}
-The number of lines must be obtained from the user.\\
-\pause
-\emphbar{When can your code fail?}
\inctime{5}
\end{frame}
@@ -519,6 +506,24 @@ def what( n ):
\end{lstlisting}
\end{frame}
+\begin{frame}[fragile]
+ \frametitle {What does this function do?}
+ \begin{lstlisting}
+def what( x, n ):
+ if n < 0:
+ n = -n
+ x = 1.0 / x
+
+ z = 1.0
+ while n > 0:
+ if n % 2 == 1:
+ z *= x
+ x *= x
+ n /= 2
+ return z
+ \end{lstlisting}
+\end{frame}
+
\begin{frame}
\frametitle{What did we learn?}
\begin{itemize}
diff --git a/day2/session3.tex b/day2/session3.tex
index 8b2a12f..392a3e5 100644
--- a/day2/session3.tex
+++ b/day2/session3.tex
@@ -78,7 +78,7 @@
\author[FOSSEE Team] {The FOSSEE Group}
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
-\date[] {12 January, 2010\\Day 2, Session 3}
+\date[] {13 February, 2010\\Day 3, Session 2}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
diff --git a/day2/session4.tex b/day2/session4.tex
index eb89a2a..a425456 100644
--- a/day2/session4.tex
+++ b/day2/session4.tex
@@ -100,7 +100,7 @@
\author[FOSSEE] {FOSSEE}
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
-\date[] {12 January, 2010\\Day 2, Session 4}
+\date[] {13 February, 2010\\Day 3, Session 4}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\pgfdeclareimage[height=0.75cm]{iitblogo}{iitblogo}
diff --git a/day2/session5.tex b/day2/session5.tex
index abbd2af..c22c143 100644
--- a/day2/session5.tex
+++ b/day2/session5.tex
@@ -78,7 +78,7 @@
\author[FOSSEE] {FOSSEE}
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
-\date[] {12 January, 2010\\Day 2, Session 5}
+\date[] {13 February, 2010\\Day 3, Session 3}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}