diff options
author | Shantanu Choudhary | 2009-12-22 14:10:37 +0530 |
---|---|---|
committer | Shantanu Choudhary | 2009-12-22 14:10:37 +0530 |
commit | 534604c38b300b6b419362c487cbf779e7f76ea8 (patch) | |
tree | 1521217ba931f93a96ad98c3019110c89a720b8a /day1 | |
parent | b902fbdf147a74f1c38b6f00208d753e7021e4ae (diff) | |
download | workshops-534604c38b300b6b419362c487cbf779e7f76ea8.tar.gz workshops-534604c38b300b6b419362c487cbf779e7f76ea8.tar.bz2 workshops-534604c38b300b6b419362c487cbf779e7f76ea8.zip |
commited changes made for scipy and cheatsheats.
Diffstat (limited to 'day1')
-rwxr-xr-x | day1/cheatsheet1.tex | 6 | ||||
-rwxr-xr-x | day1/cheatsheet2.tex | 2 | ||||
-rwxr-xr-x | day1/cheatsheet3.tex | 4 | ||||
-rwxr-xr-x | day1/cheatsheet4.tex | 6 | ||||
-rwxr-xr-x | day1/cheatsheet6.tex | 2 | ||||
-rw-r--r-- | day1/exercises.tex | 2 | ||||
-rw-r--r-- | day1/session1.tex | 39 | ||||
-rw-r--r-- | day1/session2.tex | 6 | ||||
-rw-r--r-- | day1/session3.tex | 2 | ||||
-rw-r--r-- | day1/session4.tex | 9 | ||||
-rwxr-xr-x | day1/session6.tex | 19 |
11 files changed, 57 insertions, 40 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[]: <matplotlib.image.AxesImage object at 0xa0384cc> -In []: a.shape -Out[]: (512, 512, 4) \end{lstlisting} \end{small} \begin{itemize} @@ -317,6 +315,11 @@ Out[]: <matplotlib.image.AxesImage object at 0xb765c8c> \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) @@ -338,6 +339,14 @@ In []: plot(t, y) \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. \begin{equation*} @@ -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} |