From dfd30ccfe16229203702ae0332165e14fdaf80cf Mon Sep 17 00:00:00 2001 From: Shantanu Date: Tue, 22 Dec 2009 14:10:37 +0530 Subject: commited changes made for scipy and cheatsheats. --- day1/cheatsheet1.tex | 6 +++--- day1/cheatsheet2.tex | 2 +- day1/cheatsheet3.tex | 4 ++-- day1/cheatsheet4.tex | 6 +++--- day1/cheatsheet6.tex | 2 +- day1/exercises.tex | 2 +- day1/session1.tex | 39 +++++++++++++++++++-------------------- day1/session2.tex | 6 +++--- day1/session3.tex | 2 +- day1/session4.tex | 9 ++++++--- day1/session6.tex | 19 +++++++++++++++++-- day2/cheatsheet1.tex | 2 +- day2/cheatsheet2.tex | 2 +- day2/cheatsheet3.tex | 14 +++++++------- day2/exercises.tex | 2 +- day2/session1.tex | 2 +- day2/session2.tex | 4 ++-- day2/session3.tex | 4 ++-- day2/session4.tex | 4 ++-- day2/session5.tex | 2 +- 20 files changed, 75 insertions(+), 58 deletions(-) diff --git a/day1/cheatsheet1.tex b/day1/cheatsheet1.tex index 29aa60f..00488c8 100755 --- a/day1/cheatsheet1.tex +++ b/day1/cheatsheet1.tex @@ -44,7 +44,7 @@ Do you really want to exit ([y]/n)? y \subsection{plot} \typ{In []: plot(X, Y)}\\ -For given arrays of equal length(above case X and Y), \typ{plot} plots the correspoding *x* and *y* pairs taken from X and Y. +For given arrays of equal length(above case X and Y), \typ{plot} plots the corresponding *x* and *y* pairs taken from X and Y. \subsection{Colors of plots} \typ{In []: plot(y, sin(y), 'g')}\\ @@ -65,7 +65,7 @@ Plots the line with linewidth = 2 \subsection{label and title} \typ{In []: xlabel('Length') #sets *x* axis label to Length}\\ \typ{In []: ylabel('Time') #sets *y* axis label to Time.}\\ -\typ{In []: title('Sinusoids') #sets title of plot}\\ +\typ{In []: title('Sinusoid') #sets title of plot}\\ \\ \textbf{Additionally}\\ Pylab accepts TeX equation expressions in any text expression. To get something like:\\ @@ -78,7 +78,7 @@ Same way one can have TeX expression on xlabel, ylabel etc. \subsection{legends} \typ{In []: legend('sin(x)',loc=center)} \\ -Placec a legend on the current plot at location *loc*.\\ +Place a legend on the current plot at location *loc*.\\ Apart from \typ{center}, some other \typ{loc} which can be specified are: \begin{lstlisting} 'best' diff --git a/day1/cheatsheet2.tex b/day1/cheatsheet2.tex index 0b61e7c..fa76388 100755 --- a/day1/cheatsheet2.tex +++ b/day1/cheatsheet2.tex @@ -29,7 +29,7 @@ \section{Plotting Points with Lists} \begin{lstlisting} -In []: x = [0, 1, 2, 3] +In []: x = [0, 1, 2, 3] # Creating a list In []: y = [7, 11, 15, 19] In []: plot(x, y) In []: clf() diff --git a/day1/cheatsheet3.tex b/day1/cheatsheet3.tex index db50de3..244cb86 100755 --- a/day1/cheatsheet3.tex +++ b/day1/cheatsheet3.tex @@ -69,7 +69,7 @@ Drawing Pie Charts \begin{lstlisting} In []: pie(science.values(), labels=science.keys()) \end{lstlisting} -Numpy Arrays +Arrays \begin{lstlisting} In []: a = array([1, 2, 3]) #Creating In []: b = array([4, 5, 6]) @@ -77,7 +77,7 @@ In []: a + b #Sum; Element-wise \end{lstlisting} Numpy statistical operations \begin{lstlisting} -In []: mean(math_scores) +In []: mean(math_scores) In []: median(math_scores) In []: std(math_scores) \end{lstlisting} diff --git a/day1/cheatsheet4.tex b/day1/cheatsheet4.tex index d04609a..d89e8a2 100755 --- a/day1/cheatsheet4.tex +++ b/day1/cheatsheet4.tex @@ -28,7 +28,7 @@ Matrix Creation\\ \typ{In []: C = array([[1,1,2], [2,4,1], [-1,3,7]])}\\ It creates C matrix of shape 3x3\\ -Shape is dimenions of given array. +Shape is dimensions of given array. \begin{lstlisting} In []: C.shape Out[]: (3, 3) @@ -38,7 +38,7 @@ Out[]: (3, 2) \typ{In []: B = ones_like(C)} \\ B would be array of ones with the same shape and type as C.\\ \typ{In []: A = ones((3,2))} \\ -A would be new array of given shape(arguments), filled with ones.\\ +A would be new matrix of given shape(arguments), filled with ones.\\ \typ{In []: I = identity(3)}\\ I would be identity matrix of shape 3x3 @@ -77,7 +77,7 @@ array([[ 1, 1, 2], \end{lstlisting} \subsection{Slicing} -Accessing rows with Matricies is straightforward. But If one wants to access particular Column, or want a sub-matrix, Slicing is the way to go. +Accessing rows with Matrices is straightforward. But If one wants to access particular Column, or want a sub-matrix, Slicing is the way to go. \begin{lstlisting} In []: C[:,1] Out[]: array([1, 0, 3]) diff --git a/day1/cheatsheet6.tex b/day1/cheatsheet6.tex index 5dacecc..7eddb8f 100755 --- a/day1/cheatsheet6.tex +++ b/day1/cheatsheet6.tex @@ -82,7 +82,7 @@ Out[95]: 1.5707963267948966 In [96]: expression(pi/3) Out[96]: 0.90689968211710881 \end{lstlisting} -\subsection{Roots of non-linear eqations} +\subsection{Roots of non-linear equations} For Finding the roots of a non linear equation(defined as $f(x)=0$), around a starting estimate we use \typ{fsolve}:\\ \typ{In []: from scipy.optimize import fsolve}\\ \typ{fsolve} is not a part of \typ{pylab}, instead is a function in the \textbf{optimize} module of \textbf{scipy}, and hence we \textbf{import} it.\\ diff --git a/day1/exercises.tex b/day1/exercises.tex index da88e05..91310ef 100644 --- a/day1/exercises.tex +++ b/day1/exercises.tex @@ -78,7 +78,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {7 November, 2009\\Day 1, Session 5} +\date[] {14 December, 2009\\Day 1, Session 5} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff --git a/day1/session1.tex b/day1/session1.tex index 47051cc..e3040a0 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[] {7 November, 2009\\Day 1, Session 1} +\date[] {14 December, 2009\\Day 1, Session 1} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -125,28 +125,28 @@ \begin{frame} \frametitle{Workshop Schedule: Day 1} \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[Session 4] Sat 12:25--13:25 - \item[Quiz 1] Sat 14:25--14:40 - \item[Session 5] Sat 14:40--15:25 - \item[Session 6] Sat 15:40--16:40 - \item[Quiz 2] Sat 16:45--17:00 + \item[Session 1] Mon 09:00--10:00 + \item[Session 2] Mon 10:05--11:05 + \item[Session 3] Mon 11:20--12:20 + \item[Session 4] Mon 12:25--13:25 + \item[Quiz 1] Mon 14:25--14:40 + \item[Exercises] Mon 14:40--15:25 + \item[Session 5] Mon 15:40--16:40 + \item[Quiz 2] Mon 16:45--17:00 \end{description} \end{frame} \begin{frame} \frametitle{Workshop Schedule: Day 2} \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[Session 4] Sun 12:25--13:25 - \item[Quiz 1] Sun 14:25--14:40 - \item[Session 5] Sun 14:40--15:25 - \item[Session 6] Sun 15:40--16:40 - \item[Quiz 2] Sun 16:45--17:00 + \item[Session 1] Tue 09:00--10:00 + \item[Session 2] Tue 10:05--11:05 + \item[Session 3] Tue 11:20--12:20 + \item[Session 4] Tue 12:25--13:25 + \item[Quiz 1] Tue 14:25--14:40 + \item[Exercises] Tue 14:40--15:25 + \item[Session 5] Tue 15:40--16:40 + \item[Quiz 2] Tue 16:45--17:00 \end{description} \end{frame} @@ -189,7 +189,6 @@ \item Images \begin{itemize} \item \typ{lena.png} - \item \typ{smoothing.gif} \end{itemize} \end{enumerate} \end{frame} @@ -197,9 +196,9 @@ \begin{frame}[fragile] \frametitle{Starting up \ldots} \begin{block}{} -\begin{verbatim} +\begin{lstlisting} $ ipython -pylab -\end{verbatim} +\end{lstlisting} %$ \end{block} \begin{lstlisting} In []: print "Hello, World!" diff --git a/day1/session2.tex b/day1/session2.tex index 73637c9..884a653 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[] {7 November, 2009\\Day 1, Session 2} +\date[] {14 December, 2009\\Day 1, Session 2} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -418,12 +418,12 @@ Out[]: ['hello', 'world'] \end{lstlisting} This is what happens with \typ{line} \begin{lstlisting} -In []: line = '1.2000e-01 7.4252e-01' +In []: line = '1.20 7.42' In []: point = line.split() In []: point -Out[]: ['1.2000e-01', '7.4252e-01'] +Out[]: ['1.20', '7.42'] \end{lstlisting} \end{frame} diff --git a/day1/session3.tex b/day1/session3.tex index 3db46b3..79f7dc9 100644 --- a/day1/session3.tex +++ b/day1/session3.tex @@ -79,7 +79,7 @@ \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {7 November, 2009\\Day 1, Session 3} +\date[] {14 December, 2009\\Day 1, Session 3} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff --git a/day1/session4.tex b/day1/session4.tex index 3cff99c..33f1f68 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[] {7 November, 2009\\Day 1, Session 4} +\date[] {14 December, 2009\\Day 1, Session 4} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -287,8 +287,6 @@ In []: a = imread('lena.png') In []: imshow(a) Out[]: -In []: a.shape -Out[]: (512, 512, 4) \end{lstlisting} \end{small} \begin{itemize} @@ -317,6 +315,11 @@ Out[]: \begin{frame}[fragile] \frametitle{Transpose of a Matrix} \begin{lstlisting} +In []: a = array([[ 1, 1, 2, -1], + ...: [ 2, 5, -1, -9], + ...: [ 2, 1, -1, 3], + ...: [ 1, -3, 2, 7]]) + In []: a.T Out[]: array([[ 1, 2, 2, 1], diff --git a/day1/session6.tex b/day1/session6.tex index 0f1523e..906fb54 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[] {7 November, 2009\\Day 1, Session 6} +\date[] {14 December, 2009\\Day 1, Session 6} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -150,7 +150,6 @@ Let us now look at how to solve this using \kwrd{matrices} [-1, 0.5, -1]]) In []: b = array([[1], [-2], [0]]) In []: x = solve(A, b) - In []: Ax = dot(A,x) \end{lstlisting} \end{frame} @@ -168,6 +167,7 @@ array([[ 1.], \begin{frame}[fragile] \frametitle{Let's check!} \begin{lstlisting} +In []: Ax = dot(A,x) In []: Ax Out[]: array([[ 1.00000000e+00], @@ -318,6 +318,7 @@ Out[]: -0.66623943249251527 \item Define a function as below \end{itemize} \begin{lstlisting} +In []: from scipy.integrate import odeint In []: def epid(y, t): .... k, L = 0.00003, 25000 .... return k*y*(L-y) @@ -337,6 +338,14 @@ In []: plot(t, y) %Insert Plot \end{frame} +\begin{frame}[fragile] +\frametitle{Result} +\begin{center} +\includegraphics[height=2in, interpolate=true]{data/image} +\end{center} +\end{frame} + + \begin{frame}[fragile] \frametitle{ODEs - Simple Pendulum} We shall use the simple ODE of a simple pendulum. @@ -392,6 +401,12 @@ In []: pend_sol = odeint(pend_int, \end{lstlisting} \end{frame} +\begin{frame}[fragile] +\frametitle{Result} +\begin{center} +\includegraphics[height=2in, interpolate=true]{data/ode} +\end{center} +\end{frame} \begin{frame} \frametitle{Things we have learned} diff --git a/day2/cheatsheet1.tex b/day2/cheatsheet1.tex index 22289b3..6ddb1ee 100755 --- a/day2/cheatsheet1.tex +++ b/day2/cheatsheet1.tex @@ -108,7 +108,7 @@ In []: x, y = 1, 1.234 #initializing two variables In []: 'x is %s, y is %s' %(x, y) Out[]: 'x is 1, y is 1.234' \end{lstlisting} -\textbf{Note:} \typ{\%s} used in above fomatting specifies \typ{'str'} representation of variables. One can also try:\\ +\textbf{Note:} \typ{\%s} used in above formatting specifies \typ{'str'} representation of variables. One can also try:\\ \typ{\%d} for \typ{int} representation\\ \typ{\%f} for \typ{float} representation \begin{lstlisting} diff --git a/day2/cheatsheet2.tex b/day2/cheatsheet2.tex index bb5762a..ece16b8 100644 --- a/day2/cheatsheet2.tex +++ b/day2/cheatsheet2.tex @@ -193,7 +193,7 @@ Tuples are sequences just like Lists, but they are \textbf{immutable}, or items/ \begin{lstlisting} In []: t = (1, 2, 3, 4, 5, 6, 7, 8) \end{lstlisting} -\textbf{Note:} For tupels we use parantheses in place of square brackets, rest is same as lists. +\textbf{Note:} For tuples we use parentheses in place of square brackets, rest is same as lists. \begin{lstlisting} In []: t[0] + t[3] + t[-1] # elements are accessed via indices Out[]: 13 diff --git a/day2/cheatsheet3.tex b/day2/cheatsheet3.tex index 293b95e..808fa6e 100644 --- a/day2/cheatsheet3.tex +++ b/day2/cheatsheet3.tex @@ -50,7 +50,7 @@ In []: signum(-4) Out[]: -1 In []: signum() # ERROR signum() takes exactly 1 argument(0 given) \end{lstlisting} -\textbf{Note:} Arguments passed to a function are passed by-value \textbf{only if} they are basic Python data type(int, float). In case one passes immutable types(String, tupels), they cant be modified in the function, but objects like \typ{list} and dictionary can be manipulated. +\textbf{Note:} Arguments passed to a function are passed by-value \textbf{only if} they are basic Python data type(int, float). In case one passes immutable types(String, tuples), they cant be modified in the function, but objects like \typ{list} and dictionary can be manipulated. \subsection{Default Arguments} This feature allow the functions to take the arguments optionally. For example: \begin{lstlisting} @@ -80,12 +80,12 @@ In []: welcome("Hi", "Guido") #taking name via argument Hi Guido \end{lstlisting} \subsection{Keyword Arguments} -This feature provides the facility of passing arguments by specifying the name of the parameter as defined in the function definition. You dont have to remember the order of the parameters in function definition. For example: +This feature provides the facility of passing arguments by specifying the name of the parameter as defined in the function definition. You don't have to remember the order of the parameters in function definition. For example: \begin{lstlisting} In []: plot(y, sin(y), 'g', linewidth=2) In []: plot(y, cos(y), linewidth=1, color='g') \end{lstlisting} -Both call to \typ{plot} function will work and paramenters are set accordingly.\\ +Both call to \typ{plot} function will work and parameters are set accordingly.\\ One can define a function such that keyword arguments can be used in following way: \begin{lstlisting} def wish(name='World', greetings='Hello'): @@ -97,8 +97,8 @@ In [13]: wish() #default arguments will work Hello World In [14]: wish(greetings='hey', name='madhu') hey madhu -In [15]: wish(name='vattam', greetings = 'get lost') -get lost vattam +In [15]: wish(name='vattam', greetings = 'bye bye') +bye bye vattam \end{lstlisting} % sorry Vattam just a joke :P \section{Self contained python script} @@ -130,13 +130,13 @@ In Python everything is a object! All variables, lists, tuples, dictionaries and \begin{lstlisting} In []: a = str() # initializing a string object. In []: b = "Hello World" -In []: b.split() # calling funciton on object 'b' +In []: b.split() # calling function on object 'b' Out[]: ['Hello', 'World'] \end{lstlisting} ``.'' is a operator used to call functions defined for given object. \section{Links and References} \begin{itemize} -\item Some of inbult functions available with Python are listed at\\ \url{http://docs.python.org/library/functions.html} +\item Some of inbuilt functions available with Python are listed at\\ \url{http://docs.python.org/library/functions.html} \item Reference manual to describe the standard libraries that are distributed with Python is available at \url{http://docs.python.org/library/} \end{itemize} \end{document} diff --git a/day2/exercises.tex b/day2/exercises.tex index 6c3fd19..d48cf6b 100644 --- a/day2/exercises.tex +++ b/day2/exercises.tex @@ -78,7 +78,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {8 November, 2009\\Day 2} +\date[] {15 December, 2009\\Day 2} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff --git a/day2/session1.tex b/day2/session1.tex index df67b5c..d96a492 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[] {8 November, 2009\\Day 2, Session 1} +\date[] {15 December, 2009\\Day 2, Session 1} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff --git a/day2/session2.tex b/day2/session2.tex index 14fe857..b12da8c 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[] {8 November, 2009\\Day 2, Session 2} +\date[] {15 December, 2009\\Day 2, Session 2} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -535,4 +535,4 @@ def what( n ): \end{itemize} \end{frame} -\end{document} \ No newline at end of file +\end{document} diff --git a/day2/session3.tex b/day2/session3.tex index 068f17e..fabd2bb 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[] {8 November, 2009\\Day 2, Session 3} +\date[] {15 December, 2009\\Day 2, Session 3} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -431,4 +431,4 @@ for line in urllib2.urlopen('http://site.com'): \end{itemize} \end{frame} -\end{document} \ No newline at end of file +\end{document} diff --git a/day2/session4.tex b/day2/session4.tex index f401d8d..fdf7ddd 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[] {8 November, 2009\\Day 2, Session 4} +\date[] {15 December, 2009\\Day 2, Session 4} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitblogo}{iitblogo} @@ -553,4 +553,4 @@ We have covered: % %% \end{block} % % %% \inctime{15} -% %% \end{frame} \ No newline at end of file +% %% \end{frame} diff --git a/day2/session5.tex b/day2/session5.tex index a3e63e8..aba5100 100644 --- a/day2/session5.tex +++ b/day2/session5.tex @@ -100,7 +100,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {8 November, 2009\\Day 2, Session 5} +\date[] {15 December, 2009\\Day 2, Session 5} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -- cgit From 20f85fd6a02c29533c92c631aac2ebaba69fd82e Mon Sep 17 00:00:00 2001 From: Shantanu Date: Wed, 23 Dec 2009 14:17:02 +0530 Subject: Added images of ode results in session 5. --- day1/data/image.png | Bin 0 -> 19554 bytes day1/data/ode.png | Bin 0 -> 59610 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 day1/data/image.png create mode 100644 day1/data/ode.png diff --git a/day1/data/image.png b/day1/data/image.png new file mode 100644 index 0000000..e1c7e08 Binary files /dev/null and b/day1/data/image.png differ diff --git a/day1/data/ode.png b/day1/data/ode.png new file mode 100644 index 0000000..c76a483 Binary files /dev/null and b/day1/data/ode.png differ -- cgit From 0e8e55448f6dfa1505b40be346f6dc043444e8b4 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Tue, 29 Dec 2009 19:01:43 +0530 Subject: Changed few questions in day1quiz1 and added day 2 quiz. --- day1quiz1.tex | 34 ++++----- day2quiz.tex | 217 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 235 insertions(+), 16 deletions(-) create mode 100755 day2quiz.tex diff --git a/day1quiz1.tex b/day1quiz1.tex index e669acf..11e04ce 100644 --- a/day1quiz1.tex +++ b/day1quiz1.tex @@ -40,7 +40,7 @@ \author[FOSSEE Team] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {31, October 2009\\Day 1, Quiz 1} +\date[] {14, December 2009\\Day 1, Quiz 1} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -115,26 +115,14 @@ On the top right hand corner please write down the following: \end{lstlisting} \end{frame} -\begin{frame}[fragile] -\frametitle{\incqno } -What would be the result? -\begin{lstlisting} - In [1]: x - array([[0, 1, 2], - [3, 4, 5], - [6, 7, 8]]) - In [2]: x[::-1,:] -\end{lstlisting} -\end{frame} - \begin{frame} \frametitle{\incqno } -How to read and print each line of a file. +What ipython magic command do you use to obtain the lines of code you have already typed in the interpreter? What command do you use to save them? \end{frame} \begin{frame} \frametitle{\incqno } -How to get list of third column of a data file. +How to read and print each line of a file? \end{frame} \begin{frame}[fragile] @@ -156,5 +144,19 @@ Draw a plot with line width 3. Setting x and y axis limits. \end{frame} -\end{document} +\begin{frame}[fragile] +\frametitle{\incqno } +The following code snippet has an error/bug: +\begin{lstlisting} +In []: l = [0.1, 0.2, 0.3, 0.4] +In []: t = [0.69, 0.90, 1.19, 1.30] +In []: tsq = [] +In []: for time in t: + ....: tsq.append(time*time) + ....: plot(l, tsq) +\end{lstlisting} +What is the error? How do you fix it? +\end{frame} + +\end{document} diff --git a/day2quiz.tex b/day2quiz.tex new file mode 100755 index 0000000..50f40dd --- /dev/null +++ b/day2quiz.tex @@ -0,0 +1,217 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Quiz slides day 1 quiz 1 +% +% Author: FOSSEE +% Copyright (c) 2005-2009, FOSSEE Team +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\documentclass[14pt,compress]{beamer} + +\mode +{ + \useoutertheme{split} + \setbeamercovered{transparent} +} + +\definecolor{darkgreen}{rgb}{0,0.5,0} + +\usepackage{listings} +\lstset{language=Python, + basicstyle=\ttfamily\bfseries, + commentstyle=\color{red}\itshape, + stringstyle=\color{darkgreen}, + showstringspaces=false, + keywordstyle=\color{blue}\bfseries} + +\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} } + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Macros + +\newcounter{qno} +\setcounter{qno}{0} +\newcommand{\incqno}{\addtocounter{qno}{1}{Question \theqno}} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Title page +\title[Basic Python]{Python for science and engineering: Day 2, Quiz 1} + +\author[FOSSEE Team] {FOSSEE} + +\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} +\date[] {\today \\ Day 2, Quiz 1} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +\begin{document} + +\begin{frame} + \titlepage +\end{frame} + +\begin{frame} + \frametitle{Write your details...} +On the top right hand corner please write down the following: + \begin{itemize} + \item Name: + \item University/College/Company: + \item Student/Teacher/Professional: + \end{itemize} +\end{frame} + + +\begin{frame} +\frametitle{\incqno } + What is the largest integer value that can be represented natively by Python? +\end{frame} + +\begin{frame} +\frametitle{\incqno } + What is the result of 17.0 / 2? +\end{frame} + +\begin{frame} +\frametitle{\incqno } + Which of the following is not a type in Python? + \begin{enumerate} + \item int + \item float + \item char + \item string + \end{enumerate} +\end{frame} + +\begin{frame} +\frametitle{\incqno } +How do you create a complex number with real part 2 and imaginary part +0.5. +\end{frame} + +\begin{frame} +\frametitle{\incqno } + What is the difference between \kwrd{print} \emph{x} and \kwrd{print} \emph{x,} ? +\end{frame} + +\begin{frame} +\frametitle{\incqno } + What does '*' * 40 produce? +\end{frame} + +\begin{frame}[fragile] +\frametitle{\incqno } + What is the output of: + \begin{lstlisting} +In []: ', '.join(['a', 'b', 'c']) + \end{lstlisting} +\end{frame} + +\begin{frame} + \frametitle{\incqno} + How do you find the presence of an element \emph{x} in the list \emph{a}? +\end{frame} + +\begin{frame}[fragile] + \frametitle{\incqno} + \begin{lstlisting} +In []: set([1, 2, 8, 2, 13, 8, 9]) + \end{lstlisting} + What is the output? +\end{frame} + +\begin{frame}[fragile] + \frametitle{\incqno} + \begin{lstlisting} +In []: 47 % 3 + \end{lstlisting} + What is the output? +\end{frame} + +\begin{frame}[fragile] + \frametitle{\incqno} + \begin{lstlisting} +In []: a = 12 +In []: a *= 1+1 + \end{lstlisting} + What is the value of a? +\end{frame} + +\begin{frame}[fragile] + \frametitle{\incqno} + \begin{lstlisting} +In []: a = {'a': 1, 'b': 2} +In []: a['a'] = 10 +In []: print a + \end{lstlisting} + What is the output? +\end{frame} + +\begin{frame}[fragile] + \frametitle{\incqno} + \begin{lstlisting} +In []: for i in range(3, 10, 2): + ...: print i + \end{lstlisting} + What is the output? +\end{frame} + +\begin{frame}[fragile] + \frametitle{\incqno} + \begin{lstlisting} +In []: a = [1, 2, 3] +In []: a.extend([5, 6]) + \end{lstlisting} + What is the value of a? +\end{frame} + +\begin{frame}[fragile] + \frametitle{\incqno} + \begin{lstlisting} +In []: a = (1, 2, 3) +In []: a[1] = 10 + \end{lstlisting} + What is the result? +\end{frame} + +\begin{frame}[fragile] + \frametitle{\incqno} + \begin{lstlisting} +def func(x, y=10): + print x+1, y+10 + +func(1) + + \end{lstlisting} + + What is the output? +\end{frame} + +\begin{frame} + \frametitle{\incqno} + How many items can a function return? +\end{frame} + +%% \begin{frame}[fragile] +%% \frametitle{\incqno} +%% Consider a module called \lstinline+gcd.py+ looking like this: +%% \begin{lstlisting} +%% def gcd(a, b): +%% ... + +%% if __name__ == '__main__': +%% print gcd(10, 25) +%% \end{lstlisting} +%% If this module is imported, will it print the gcd of 10 and 25? +%% \end{frame} + +%% \begin{frame}[fragile] +%% \frametitle{\incqno} +%% \begin{lstlisting} +%% In [1]: print hello +%% \end{lstlisting} +%% Exactly what exception will you get if you run this on a fresh +%% interpreter? +%% \end{frame} + +\end{document} + -- cgit From 4921db12e2b0ba6d59cea1619afd791c9e20033f Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Tue, 29 Dec 2009 19:02:01 +0530 Subject: Added schedule tex file. --- schedule.tex | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100755 schedule.tex diff --git a/schedule.tex b/schedule.tex new file mode 100755 index 0000000..02dfc3c --- /dev/null +++ b/schedule.tex @@ -0,0 +1,48 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Tutorial slides on Python. +% +% Author: FOSSEE +% Copyright (c) 2005-2009, FOSSEE Team +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\documentclass[14pt]{article} + +\title{Python for Science and Engineering: Schedule} +\author{FOSSEE Team} +\date{14, 15 December, 2009} + +\begin{document} + \maketitle + Day 1, 14 December, 2009 \\ + \begin{tabular}{| p{.35in} | p{2in} | p{1in} |} + \hline + Session & Title & Time \\\hline + 1 & Interactive Plotting & 09:30 - 10:30 \\\hline + 2 & Plotting experimental data & 10:35 - 11:35 \\\hline + & Tea Break & 11:35 - 11:50 \\\hline + 3 & Statistics & 11:55 - 12:55 \\\hline + & Lunch Break & 12:55 - 13:50 \\\hline + & Quiz 1 & 13:50 - 14:05 \\\hline + 4 & Matrices \& Least Square Fit & 14:10 - 15:10 \\\hline + 5 & Exercises & 15:15 - 16:15 \\\hline + & Tea Break & 16:15 - 16:30 \\\hline + 6 & Matrices \& Least Square Fit & 16:30 - 17:30 \\\hline + & Quiz 2 & 17:30 - 17:45 \\\hline + \end{tabular} + \vspace*{.5in} + \\ Day 2, 15 December, 2009 \\ + \begin{tabular}{| p{.35in} | p{2in} | p{1in} |} + \hline + Session & Title & Time \\\hline + 1 & Python language: Basics & 09:00 - 10:00 \\\hline + 2 & Python language: Data structures and functions & 10:05 - 11:05 \\\hline + & Tea Break & 11:05 - 11:20 \\\hline + 3 & Python language: Functions, modules and objects & 11:25 - 12:25 \\\hline + 4 & Python Development & 12:25 - 13:25 \\\hline + & Lunch Break & 13:25 - 14:20 \\\hline + & Quiz 3 & 14:20 - 14:40 \\\hline + 5 & Exercises & 14:40 - 15:40 \\\hline + & Tea Break & 15:40 - 16:00 \\\hline + 6 & Exercises contd \ldots & 16:00 - 16:30 \\\hline + \end{tabular} +\end{document} -- cgit From 20e18b55da02880ee14268329e64dba6495169a3 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Tue, 29 Dec 2009 19:26:13 +0530 Subject: Added tag scipy.in-v.14122009 for changeset 2214b5dba4d4 --- .hgtags | 1 + 1 file changed, 1 insertion(+) diff --git a/.hgtags b/.hgtags index f10e342..c23b0fb 100644 --- a/.hgtags +++ b/.hgtags @@ -2,3 +2,4 @@ c329c29a9342e46847db19986b638232b573dfb1 iitb-v.25092009 919c93e5aa7113bb111211cfc7fad1ab852fcc4c bprim-v.10102009 896f96b9de3b762e5626a55920b20ccc94d08f8c bprim-v.10102009p1 49bdffe4dca565fed8f7e8ee3899bde0fa2a6b60 goaandcalicut-v.10112009 +2214b5dba4d4ee98f1d7083fee6f34b10111c536 scipy.in-v.14122009 -- cgit From 29684b6ee8ac6cad29898283d192910b056828be Mon Sep 17 00:00:00 2001 From: Shantanu Date: Mon, 4 Jan 2010 19:02:28 +0530 Subject: Added changes to exercise session of day1. --- day1/data/after-filter.png | Bin 0 -> 153004 bytes day1/data/damp.png | Bin 0 -> 22368 bytes day1/data/location.txt | 41 ++++++++++++++ day1/data/neighbour.png | Bin 0 -> 1157 bytes day1/data/points.png | Bin 0 -> 19613 bytes day1/data/pos.txt | 41 -------------- day1/data/smoothing.png | Bin 0 -> 200973 bytes day1/exercises.tex | 138 +++++++++++++++++++++++++++++++++++++++++---- 8 files changed, 168 insertions(+), 52 deletions(-) create mode 100644 day1/data/after-filter.png create mode 100644 day1/data/damp.png create mode 100644 day1/data/location.txt create mode 100755 day1/data/neighbour.png create mode 100644 day1/data/points.png delete mode 100644 day1/data/pos.txt create mode 100644 day1/data/smoothing.png diff --git a/day1/data/after-filter.png b/day1/data/after-filter.png new file mode 100644 index 0000000..ac4d953 Binary files /dev/null and b/day1/data/after-filter.png differ diff --git a/day1/data/damp.png b/day1/data/damp.png new file mode 100644 index 0000000..5307a5d Binary files /dev/null and b/day1/data/damp.png differ diff --git a/day1/data/location.txt b/day1/data/location.txt new file mode 100644 index 0000000..adf92c8 --- /dev/null +++ b/day1/data/location.txt @@ -0,0 +1,41 @@ +0. 0. +0.25 0.47775 +0.5 0.931 +0.75 1.35975 +1. 1.764 +1.25 2.14375 +1.5 2.499 +1.75 2.82975 +2. 3.136 +2.25 3.41775 +2.5 3.675 +2.75 3.90775 +3. 4.116 +3.25 4.29975 +3.5 4.459 +3.75 4.59375 +4. 4.704 +4.25 4.78975 +4.5 4.851 +4.75 4.88775 +5. 4.9 +5.25 4.88775 +5.5 4.851 +5.75 4.78975 +6. 4.704 +6.25 4.59375 +6.5 4.459 +6.75 4.29975 +7. 4.116 +7.25 3.90775 +7.5 3.675 +7.75 3.41775 +8. 3.136 +8.25 2.82975 +8.5 2.499 +8.75 2.14375 +9. 1.764 +9.25 1.35975 +9.5 0.931 +9.75 0.47775 +10. 0. diff --git a/day1/data/neighbour.png b/day1/data/neighbour.png new file mode 100755 index 0000000..1bb69a1 Binary files /dev/null and b/day1/data/neighbour.png differ diff --git a/day1/data/points.png b/day1/data/points.png new file mode 100644 index 0000000..210286e Binary files /dev/null and b/day1/data/points.png differ diff --git a/day1/data/pos.txt b/day1/data/pos.txt deleted file mode 100644 index adf92c8..0000000 --- a/day1/data/pos.txt +++ /dev/null @@ -1,41 +0,0 @@ -0. 0. -0.25 0.47775 -0.5 0.931 -0.75 1.35975 -1. 1.764 -1.25 2.14375 -1.5 2.499 -1.75 2.82975 -2. 3.136 -2.25 3.41775 -2.5 3.675 -2.75 3.90775 -3. 4.116 -3.25 4.29975 -3.5 4.459 -3.75 4.59375 -4. 4.704 -4.25 4.78975 -4.5 4.851 -4.75 4.88775 -5. 4.9 -5.25 4.88775 -5.5 4.851 -5.75 4.78975 -6. 4.704 -6.25 4.59375 -6.5 4.459 -6.75 4.29975 -7. 4.116 -7.25 3.90775 -7.5 3.675 -7.75 3.41775 -8. 3.136 -8.25 2.82975 -8.5 2.499 -8.75 2.14375 -9. 1.764 -9.25 1.35975 -9.5 0.931 -9.75 0.47775 -10. 0. diff --git a/day1/data/smoothing.png b/day1/data/smoothing.png new file mode 100644 index 0000000..8456e77 Binary files /dev/null and b/day1/data/smoothing.png differ diff --git a/day1/exercises.tex b/day1/exercises.tex index 91310ef..3fe435e 100644 --- a/day1/exercises.tex +++ b/day1/exercises.tex @@ -78,7 +78,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {14 December, 2009\\Day 1, Session 5} +\date[] {11 January, 2010\\Day 1, Session 5} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} @@ -111,11 +111,37 @@ \end{frame} -\begin{frame} +\begin{frame}[fragile] \frametitle{Problem 1} + \begin{columns} + \column{0.5\textwidth} + \hspace*{-0.5in} + \includegraphics[height=2in, interpolate=true]{data/L-Tsq.png} + \column{0.45\textwidth} + \begin{block}{Example code} + \tiny + \begin{lstlisting} +l = [] +t = [] +for line in open('pendulum.txt'): + point = line.split() + l.append(float(point[0])) + t.append(float(point[1])) +tsq = [] +for time in t: + tsq.append(time*time) +plot(l, tsq, '.') + \end{lstlisting} + \end{block} + \end{columns} + \begin{block}{Problem Statement} + Tweak above code to plot data in file 'location.txt'. + \end{block} +\end{frame} + +\begin{frame} + \frametitle{Problem 1 cont...} \begin{itemize} - \item Open file 'pos.txt', it has X and Y Coordinate of a particle under motion - \item Plot X vs Y Graph. \item Label both the axes. \item What kind of motion is this? \item Title the graph accordingly. @@ -123,13 +149,49 @@ \end{itemize} \end{frame} -\begin{frame} +\begin{frame}[fragile] \frametitle{Problem 2} -Write a Program that plots a regular n-gon(Let n = 5). + \begin{columns} + \column{0.5\textwidth} + \hspace*{-0.5in} + \includegraphics[height=2in, interpolate=true]{data/points} + \column{0.45\textwidth} + \begin{block}{Line between two points} + \tiny + \begin{lstlisting} +In []: x = [1, 5] +In []: y = [1, 4] +In []: plot(x, y) + \end{lstlisting} + \end{block} + \end{columns} + Line can be plotted using arrays of coordinates. + \pause + \begin{block}{Problem statement} + Write a Program that plots a regular n-gon(Let n = 5). + \end{block} \end{frame} + \begin{frame}[fragile] \frametitle{Problem 3} + \begin{columns} + \column{0.5\textwidth} + \hspace*{-0.5in} + \includegraphics[height=2in, interpolate=true]{data/damp} + \column{0.45\textwidth} + \begin{block}{Damped Oscillation} + \tiny + \begin{lstlisting} +In []: x = linspace(0, 4*pi) +In []: plot(x, exp(x/10)*sin(x)) + \end{lstlisting} + \end{block} + \end{columns} +\end{frame} + +\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. \begin{columns} \column{0.35\textwidth} @@ -147,17 +209,71 @@ savefig('plot'+str(i)+'.png') #i is int variable \end{block} \end{frame} -\begin{frame} +\begin{frame}[fragile] \frametitle{Problem 4} - Legendre polynomials $P_n(x)$ are defined by the following recurrence relation + \begin{lstlisting} +In []: x = imread('smoothing.png') +In []: x.shape +Out[]: (256, 256) +In []: imshow(x,cmap=cm.gray) + \end{lstlisting} +\emphbar{Replace each pixel with mean of neighboring pixels} + \begin{center} + \includegraphics[height=1in, interpolate=true]{data/neighbour} + \end{center} +\end{frame} -\center{$(n+1)P_{n+1}(x) - (2n+1)xP_n(x) + nP_{n-1}(x) = 0$}\\ +\begin{frame} + \begin{center} + \includegraphics[height=3in, interpolate=true]{data/smoothing} + \end{center} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Problem 4: Approach} + For \typ{y} being resultant image: + \begin{lstlisting} +y[1, 1] = x[0, 1]/4 + x[1, 0]/4 + + x[2, 1]/4 + x[1, 2]/4 + \end{lstlisting} + \begin{columns} + \column{0.45\textwidth} + \hspace*{-0.5in} + \includegraphics[height=1.5in, interpolate=true]{data/smoothing} + \column{0.45\textwidth} + \hspace*{-0.5in} + \includegraphics[height=1.5in, interpolate=true]{data/after-filter} + \end{columns} + \begin{block}{Hint:} + Use array Slicing. + \end{block} +\end{frame} -with $P_0(x) = 1$, $P_1(x) = x$ and $P_2(x) = (3x^2 - 1)/2$. Compute the next three - Legendre polynomials and plot all 6 over the interval [-1,1]. +\begin{frame}[fragile] + \frametitle{Solution} + \begin{lstlisting} +In []: y = zeros_like(x) +In []: y[1:-1,1:-1] = x[:-2,1:-1]/4+ + x[2:,1:-1]/4+ + x[1:-1,2:]/4+ + x[1:-1,:-2]/4 +In []: imshow(y,cmap=cm.gray) + \end{lstlisting} \end{frame} + + \end{document} +%% \begin{frame} +%% \frametitle{Problem 4} +%% Legendre polynomials $P_n(x)$ are defined by the following recurrence relation + +%% \center{$(n+1)P_{n+1}(x) - (2n+1)xP_n(x) + nP_{n-1}(x) = 0$}\\ + +%% with $P_0(x) = 1$, $P_1(x) = x$ and $P_2(x) = (3x^2 - 1)/2$. Compute the next three +%% Legendre polynomials and plot all 6 over the interval [-1,1]. +%% \end{frame} + %% \begin{frame}[fragile] %% \frametitle{Problem Set 5} %% \begin{columns} -- cgit From 463892029d45bf1862c88323adaaecbcacf6217f Mon Sep 17 00:00:00 2001 From: Puneeth Chaganti Date: Mon, 4 Jan 2010 19:08:48 +0530 Subject: Changes at scipy.in --- day1/data/four_plot.png | Bin 0 -> 54760 bytes day1/data/fsolve.png | Bin 0 -> 20617 bytes day1/data/roots.png | Bin 0 -> 20654 bytes day1/session1.tex | 21 ++++++++++++++++----- day1/session3.tex | 34 +++++++++++++++++----------------- day1/session4.tex | 9 ++++++++- day1/session6.tex | 11 ++++++++++- 7 files changed, 51 insertions(+), 24 deletions(-) create mode 100644 day1/data/four_plot.png create mode 100644 day1/data/fsolve.png create mode 100644 day1/data/roots.png diff --git a/day1/data/four_plot.png b/day1/data/four_plot.png new file mode 100644 index 0000000..00a3a7a Binary files /dev/null and b/day1/data/four_plot.png differ diff --git a/day1/data/fsolve.png b/day1/data/fsolve.png new file mode 100644 index 0000000..0108215 Binary files /dev/null and b/day1/data/fsolve.png differ diff --git a/day1/data/roots.png b/day1/data/roots.png new file mode 100644 index 0000000..c13a1a4 Binary files /dev/null and b/day1/data/roots.png differ diff --git a/day1/session1.tex b/day1/session1.tex index e3040a0..fef0155 100644 --- a/day1/session1.tex +++ b/day1/session1.tex @@ -447,25 +447,36 @@ In []: ylim(ymin-0.2, ymax+0.2) \item Annotate the origin \item Set axes limits to the range of x \end{enumerate} +\vspace*{-0.1in} +\begin{center} + \includegraphics[height=2.1in, interpolate=true]{data/four_plot} +\end{center} +\end{frame} + +\begin{frame}[fragile] +\frametitle{Review Problem \ldots} +\alert{Plotting \ldots} \begin{lstlisting} In []: x=linspace(-5*pi, 5*pi, 500) In []: plot(x, x, 'b') In []: plot(x, -x, 'b') +In []: plot(x, sin(x), 'g', linewidth=2) +In []: plot(x, x*sin(x), 'r', + linewidth=3) \end{lstlisting} $\vdots$ \end{frame} \begin{frame}[fragile] \frametitle{Review Problem \ldots} -\begin{lstlisting} -In []: plot(x, sin(x), 'g', linewidth=2) -In []: plot(x, x*sin(x), 'r', - linewidth=3) -\end{lstlisting} +\alert{Legend \& Annotation\ldots} \begin{lstlisting} In []: legend(['x', '-x', 'sin(x)', 'xsin(x)']) In []: annotate('origin', xy = (0, 0)) +\end{lstlisting} +\alert{Setting Axes limits\ldots} +\begin{lstlisting} In []: xlim(-5*pi, 5*pi) In []: ylim(-5*pi, 5*pi) \end{lstlisting} diff --git a/day1/session3.tex b/day1/session3.tex index 79f7dc9..e847a3d 100644 --- a/day1/session3.tex +++ b/day1/session3.tex @@ -147,7 +147,7 @@ In []: for line in open('pendulum.txt'): .... point = line.split() .... l = float(point[0]) .... t = float(point[1]) - .... g = 4 * pi * pi * l / t * t + .... g = 4 * pi * pi * l / (t * t) .... G.append(g) \end{lstlisting} \end{frame} @@ -166,8 +166,8 @@ total = 0 for g in G: total += g -g_mean = total / len(g) -print "Mean: ", g_mean +g_mean = total / len(G) +print 'Mean: ', g_mean \end{lstlisting} \end{frame} @@ -175,7 +175,7 @@ print "Mean: ", g_mean \frametitle{Mean ``g''} \begin{lstlisting} g_mean = sum(G) / len(G) -print "Mean: ", g_mean +print 'Mean: ', g_mean \end{lstlisting} \end{frame} @@ -183,7 +183,7 @@ print "Mean: ", g_mean \frametitle{Mean ``g''} \begin{lstlisting} g_mean = mean(G) -print "Mean: ", g_mean +print 'Mean: ', g_mean \end{lstlisting} \inctime{10} \end{frame} @@ -277,11 +277,11 @@ for record in open('sslc1.txt'): \begin{frame}[fragile] \frametitle{Dictionaries \ldots} \begin{lstlisting} -In []: d = {"jpg" : "image file", - "txt" : "text file", - "py" : "python code"} +In []: d = {'jpg' : 'image file', + 'txt' : 'text file', + 'py' : 'python code'} -In []: d["txt"] +In []: d['txt'] Out[]: 'text file' \end{lstlisting} \end{frame} @@ -289,10 +289,10 @@ Out[]: 'text file' \begin{frame}[fragile] \frametitle{Dictionaries \ldots} \begin{lstlisting} -In []: "py" in d +In []: 'py' in d Out[]: True -In []: "cpp" in d +In []: 'cpp' in d Out[]: False \end{lstlisting} \end{frame} @@ -417,11 +417,11 @@ for record in open('sslc1.txt'): \begin{frame}[fragile] \frametitle{Obtaining statistics} \begin{lstlisting} -print "Mean: ", mean(math_scores) +print 'Mean: ', mean(math_scores) -print "Median: ", median(math_scores) +print 'Median: ', median(math_scores) -print "Standard Deviation: ", +print 'Standard Deviation: ', std(math_scores) \end{lstlisting} \inctime{10} @@ -432,11 +432,11 @@ print "Standard Deviation: ", \begin{lstlisting} math_array = array(math_scores) -print "Mean: ", mean(math_array) +print 'Mean: ', mean(math_array) -print "Median: ", median(math_array) +print 'Median: ', median(math_array) -print "Standard Deviation: ", +print 'Standard Deviation: ', std(math_array) \end{lstlisting} \inctime{5} diff --git a/day1/session4.tex b/day1/session4.tex index 33f1f68..78e03a8 100644 --- a/day1/session4.tex +++ b/day1/session4.tex @@ -488,7 +488,14 @@ Out[]: array([-1., 8., -1.]) \frametitle{\typ{lstsq}} \begin{itemize} \item We need to fit a line through points for the equation $T^2 = m \cdot L+c$ -\item In matrix form, the equation can be represented as $T^2 = A \cdot p$, where A is +\item In matrix form, the equation can be represented as $T_{sq} = A \cdot p$, where $T_{sq}$ is + $\begin{bmatrix} + T^2_1 \\ + T^2_2 \\ + \vdots\\ + T^2_N \\ + \end{bmatrix}$ +, A is $\begin{bmatrix} L_1 & 1 \\ L_2 & 1 \\ diff --git a/day1/session6.tex b/day1/session6.tex index 906fb54..05b6134 100755 --- a/day1/session6.tex +++ b/day1/session6.tex @@ -216,11 +216,17 @@ Use \kwrd{solve()} \frametitle{Scipy Methods - \typ{roots}} \begin{itemize} \item Calculates the roots of polynomials +\item To calculate the roots of $x^2-5x+6$ \end{itemize} \begin{lstlisting} - In []: coeffs = [1, 6, 13] + In []: coeffs = [1, -5, 6] In []: roots(coeffs) + Out[]: array([3., 2.]) \end{lstlisting} +\vspace*{-.2in} +\begin{center} +\includegraphics[height=1.6in, interpolate=true]{data/roots} +\end{center} \end{frame} \begin{frame}[fragile] @@ -291,6 +297,9 @@ Find the root of $sin(x)+cos^2(x)$ nearest to $0$ In []: fsolve(f, 0) Out[]: -0.66623943249251527 \end{lstlisting} +\begin{center} +\includegraphics[height=2in, interpolate=true]{data/fsolve} +\end{center} \end{frame} %% \begin{frame}[fragile] -- cgit From 508f280ce50c942f08f8fdb4bc76ee9654d4ffda Mon Sep 17 00:00:00 2001 From: Shantanu Date: Mon, 4 Jan 2010 19:54:26 +0530 Subject: Changed dates in all slides. --- day1/session1.tex | 2 +- day1/session2.tex | 2 +- day1/session3.tex | 2 +- day1/session4.tex | 2 +- day1/session5.tex | 2 +- day1/session6.tex | 2 +- day2/exercises.tex | 2 +- day2/session1.tex | 2 +- day2/session2.tex | 2 +- day2/session3.tex | 2 +- day2/session4.tex | 2 +- day2/session5.tex | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/day1/session1.tex b/day1/session1.tex index fef0155..48cd878 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[] {14 December, 2009\\Day 1, Session 1} +\date[] {11 January, 2010\\Day 1, Session 1} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff --git a/day1/session2.tex b/day1/session2.tex index 884a653..12dbb58 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[] {14 December, 2009\\Day 1, Session 2} +\date[] {11 January, 2010\\Day 1, Session 2} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff --git a/day1/session3.tex b/day1/session3.tex index e847a3d..c769fe5 100644 --- a/day1/session3.tex +++ b/day1/session3.tex @@ -79,7 +79,7 @@ \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {14 December, 2009\\Day 1, Session 3} +\date[] {11 January, 2010\\Day 1, Session 3} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff --git a/day1/session4.tex b/day1/session4.tex index 78e03a8..bfff165 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[] {14 December, 2009\\Day 1, Session 4} +\date[] {11 January, 2010\\Day 1, Session 4} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff --git a/day1/session5.tex b/day1/session5.tex index 22a274d..326e8fe 100644 --- a/day1/session5.tex +++ b/day1/session5.tex @@ -79,7 +79,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {31, October 2009\\Day 1, Session 5} +\date[] {11, January 2010\\Day 1, Session 5} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff --git a/day1/session6.tex b/day1/session6.tex index 05b6134..0f2120f 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[] {14 December, 2009\\Day 1, Session 6} +\date[] {11 January, 2010\\Day 1, Session 6} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff --git a/day2/exercises.tex b/day2/exercises.tex index d48cf6b..7cbf437 100644 --- a/day2/exercises.tex +++ b/day2/exercises.tex @@ -78,7 +78,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {15 December, 2009\\Day 2} +\date[] {12 January, 2010\\Day 2} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff --git a/day2/session1.tex b/day2/session1.tex index d96a492..8d7c70e 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[] {15 December, 2009\\Day 2, Session 1} +\date[] {12 January, 2010\\Day 2, Session 1} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff --git a/day2/session2.tex b/day2/session2.tex index b12da8c..d40f9d2 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[] {15 December, 2009\\Day 2, Session 2} +\date[] {12 January, 2010\\Day 2, Session 2} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff --git a/day2/session3.tex b/day2/session3.tex index fabd2bb..97ecf59 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[] {15 December, 2009\\Day 2, Session 3} +\date[] {12 January, 2010\\Day 2, Session 3} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} diff --git a/day2/session4.tex b/day2/session4.tex index fdf7ddd..7345b7e 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[] {15 December, 2009\\Day 2, Session 4} +\date[] {12 January, 2010\\Day 2, Session 4} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %\pgfdeclareimage[height=0.75cm]{iitblogo}{iitblogo} diff --git a/day2/session5.tex b/day2/session5.tex index aba5100..1d0612c 100644 --- a/day2/session5.tex +++ b/day2/session5.tex @@ -100,7 +100,7 @@ \author[FOSSEE] {FOSSEE} \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} -\date[] {15 December, 2009\\Day 2, Session 5} +\date[] {12 January, 2010\\Day 2, Session 5} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -- cgit