diff options
author | Puneeth Chaganti | 2009-10-03 23:35:39 +0530 |
---|---|---|
committer | Puneeth Chaganti | 2009-10-03 23:35:39 +0530 |
commit | 9742cfcc663cdfb4310b06cbd171a5e14caed13a (patch) | |
tree | 8366e80b523547344ef3e1acf114d3090579339f /day2 | |
parent | 77fc727b7e7bdcddb9748da4acc7c46df230b60d (diff) | |
parent | ac1f681846575b25ef481034225de8de40ce0f02 (diff) | |
download | workshops-9742cfcc663cdfb4310b06cbd171a5e14caed13a.tar.gz workshops-9742cfcc663cdfb4310b06cbd171a5e14caed13a.tar.bz2 workshops-9742cfcc663cdfb4310b06cbd171a5e14caed13a.zip |
Merged mainline with Puneeth.
Diffstat (limited to 'day2')
-rw-r--r-- | day2/session1.tex | 79 |
1 files changed, 58 insertions, 21 deletions
diff --git a/day2/session1.tex b/day2/session1.tex index 9fce148..47a6a76 100644 --- a/day2/session1.tex +++ b/day2/session1.tex @@ -51,7 +51,7 @@ \setcounter{time}{0} \newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}} -\newcommand{\typ}[1]{\texttt{#1}} +\newcommand{\typ}[1]{\lstinline{#1}} \newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} } @@ -74,7 +74,7 @@ % Title page \title[]{Matrices and Arrays\\ \& \\2D Plotting} -\author[Asokan \& Prabhu] {Asokan Pichai\\Prabhu Ramachandran} +\author[FOSSEE Team] {Asokan Pichai\\Prabhu Ramachandran} \institute[FOSSEE] {FOSSEE Team} \date[] {11, October 2009} @@ -214,29 +214,64 @@ array([10,11,12,-1]) \begin{itemize} \item Basic \alert{elementwise} math (given two arrays \typ{a, b}): \typ{+, -, *, /, \%} - \item Inplace operators: \typ{a += b}, or \typ{add(a, b, - a)} etc. + \item Inplace operators: \typ{a += b}, or \typ{add(a, b, a)} etc. + \item \typ{sum(x, axis=0)}, + \typ{product(x, axis=0)}, + \typ{dot(a, bp)} + \end{itemize} +\end{frame} + +\end{frame} +\begin{frame}[fragile] + \frametitle{Array math cont.} + \begin{itemize} \item Logical operations: \typ{equal (==)}, \typ{not\_equal (!=)}, \typ{less (<)}, \typ{greater (>)} etc. - \item Trig and other functions: \typ{sin(x), arcsin(x), sinh(x), - exp(x), sqrt(x)} etc. - \item \typ{sum(x, axis=0), product(x, axis=0), dot(a, bp)} \inctime{10} + \item Trig and other functions: \typ{sin(x),} + \typ{arcsin(x), sinh(x),} + \typ{exp(x), sqrt(x)} etc. \end{itemize} +\inctime{10} \end{frame} \subsection{Array Creation \& Slicing, Striding Arrays} \begin{frame}[fragile] \frametitle{Array creation functions} + \begin {block}{\typ{array(object, dtype=None, ...)}} + \begin{lstlisting} + >>> array( [2,3,4] ) + array([2, 3, 4]) + \end{lstlisting} + \end {block} + \begin{block}{\typ{linspace(start, stop, num=50, ...)}} + \begin{lstlisting} + >>> linspace( 0, 2, 4 ) + array([0.,0.6666667,1.3333333,2.]) + \end{lstlisting} + \end{block} \begin{itemize} - \item \typ{array(object, dtype=None, \ldots)} - \item \typ{arange(start, stop=None, step=1 \ldots)} - \item \typ{linspace(start, stop, num=50, \ldots)} - \item \typ{ones(shape, dtype=None, \ldots)} - \item \typ{zeros(shape, dtype=float,\ldots)} - \item \typ{identity(n)} - \item \typ{empty(shape, dtype=float,\ldots)} - \item \typ{ones\_like(x)}, - \item \typ{zeros\_like(x)}, \typ{empty\_like(x)} + \item also try \typ{arange} command + \end{itemize} +\end{frame} + +\begin{frame}[fragile] + \frametitle{Array creation functions cont.} + \begin{itemize} + \item \typ{ones(shape, dtype=None, ...)} + \begin{lstlisting} + >>>ones([2,2]) + array([[ 1., 1.], + [ 1., 1.]]) + \end{lstlisting} + \item \typ{identity(n)} + \item \typ{ones\_like(x)} + \begin{lstlisting} + >>>a = array([[1,2,3],[4,5,6]]) + >>>ones_like(a) + array([[1, 1, 1], + [1, 1, 1]]) + \end{lstlisting} + \item check out \typ{zeros, zeros\_like, empty} \end{itemize} \end{frame} @@ -302,9 +337,11 @@ array([[ 0.96276665, 0.77174861], \begin{frame} {IPython's \typ{pylab} mode} +\begin{block}{Immediate use:} + \typ{\$ ipython -pylab} +\end{block} \begin{itemize} - \item \typ{pylab}: convenient 2D plotting interface to MPL - \item Immediate use: \typ{ipython -pylab} + \item \typ{pylab}: convenient 2D plotting interface to MPL \item Imports all of pylab for you! \item Allows for interactive plotting \end{itemize} @@ -339,7 +376,7 @@ array([[ 0.96276665, 0.77174861], >>> setp(l, linewidth=2.0, color='r') >>> l.set_linewidth(2.0) >>> draw() # Redraw. ->>> setp(l) # Print properties +>>> setp(l) # Print properties. >>> clf() # Clear figure. >>> close() # Close figure. \end{lstlisting} @@ -719,9 +756,9 @@ title('triangular head; scale '\ \begin{frame} \frametitle{Problem Set} \begin{enumerate} - \item Write a function that plots any n-gon given \typ{n}. + \item Write a function that plots any regular n-gon given \typ{n}. \item Consider the logistic map, $f(x) = kx(1-x)$, plot it for - $k=2.5, 3.5$ and $4$ + $k=2.5, 3.5$ and $4$ in the same plot. \end{enumerate} \end{frame} |