# HG changeset patch # User Puneeth Chaganti # Date 1254579463 -19800 # Node ID 84c3f600045f0450a97355e69aed84c2a05f1eae # Parent 2281002b579b396b28252d2292a293a55185961d# Parent 41bdf277c7557c1d33a328c0db1916ffb56270a2 Merged Heads. diff -r 41bdf277c755 -r 84c3f600045f day2/session1.tex --- a/day2/session1.tex Sat Oct 03 19:39:49 2009 +0530 +++ b/day2/session1.tex Sat Oct 03 19:47:43 2009 +0530 @@ -170,7 +170,6 @@ \item \alert{Note:} \typ{len(arr) != arr.size} in general \item \alert{Note:} By default array operations are performed \alert{elementwise} - \item Indices, slicing: just like lists \end{itemize} \end{frame} @@ -192,8 +191,6 @@ >>> print x[0], x[-1] 10.0 4.0 \end{lstlisting} - -\inctime{10} \end{frame} \begin{frame}[fragile] @@ -223,8 +220,7 @@ \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)} - \item \typ{dot(a, bp)} + \item \typ{sum(x, axis=0), product(x, axis=0), dot(a, bp)} \inctime{10} \end{itemize} \inctime{10} \end{frame} @@ -257,6 +253,8 @@ [8, 9]]) >>> a[:,2] array([3, 6, 9]) +>>> a[...,2] +array([3, 6, 9]) \end{lstlisting} \end{frame} @@ -293,6 +291,8 @@ \end{lstlisting} \begin{enumerate} \item Convert an RGB image to Grayscale. $ Y = 0.5R + 0.25G + 0.25B $ + \item Scale the image to 50\% + \item Introduce some random noise? \end{enumerate} \inctime{15} \end{frame} @@ -327,10 +327,9 @@ \begin{itemize} \item Also: PNG, PDF, PS, EPS, SVG, PDF \end{itemize} -\inctime{5} \end{frame} -\subsection{Plots - Lines, Labels, Legend} +\subsection{Plots - Lines, Labels and Legends} \begin{frame}[fragile] \frametitle{Basic plotting} \begin{lstlisting} @@ -347,7 +346,7 @@ \end{frame} \begin{frame}[fragile] - \frametitle{Working with text \ldots} + \frametitle{Working with text \ldots} %\begin{itemize} % \item We already saw LaTeX markup support! %\end{itemize} @@ -364,12 +363,12 @@ facecolor='black', shrink=0.05)) \end{lstlisting} + \end{frame} \begin{frame}[fragile] \frametitle{Legends} \begin{lstlisting} ->>> x = linspace(0, 2*pi, 1000) >>> plot(x, cos(5*x), 'r--', label='cosine') >>> plot(x, sin(5*x), 'g--', @@ -377,6 +376,8 @@ >>> legend() # Or use: >>> legend(['cosine', 'sine']) +# Annotation: +>>> text(1,0, '(1,0)') \end{lstlisting} \end{frame} @@ -392,6 +393,7 @@ >>> title('Easy as 1,2,3') \end{lstlisting} + \end{frame} \begin{frame}[fragile] @@ -404,7 +406,6 @@ # Can also use: from pylab import linspace, sin, plot \end{lstlisting} -\inctime{5} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -702,7 +703,6 @@ \tiny For details see \url{http://matplotlib.sourceforge.net/screenshots/plotmap.py} \end{center} -\inctime{5} \end{frame} @@ -714,10 +714,11 @@ \item \url{http://matplotlib.sf.net/screenshots.html} \end{itemize} + \inctime{25} \end{frame} \begin{frame} - \frametitle{Problem set 1.0} + \frametitle{Problem Set} \begin{enumerate} \item Write a function that plots any n-gon given \typ{n}. \item Consider the logistic map, $f(x) = kx(1-x)$, plot it for @@ -725,9 +726,12 @@ \end{enumerate} \end{frame} -\begin{frame} - \frametitle{Problem set 1.1} - \begin{enumerate} +\begin{frame}[fragile] +\frametitle{Problem Set} + \begin{columns} + \column{0.6\textwidth} + \small{ + \begin{enumerate} \item Consider the iteration $x_{n+1} = f(x_n)$ where $f(x) = kx(1-x)$. Plot the successive iterates of this process. \item Plot this using a cobweb plot as follows: @@ -738,28 +742,12 @@ \item Draw line to $(x_i, x_i)$ \item Repeat from 2 for as long as you want \end{enumerate} - \end{enumerate} + \end{enumerate}} + \column{0.35\textwidth} + \hspace*{-0.5in} + \includegraphics[height=1.6in, interpolate=true]{data/cobweb} +\end{columns} +\inctime{20} \end{frame} -\begin{frame} - \frametitle{Problem set 1.2} - \begin{enumerate} - - \item Plot the Koch snowflake. Write a function to generate the - necessary points given the two points constituting a line. - \pause - \begin{enumerate} - \item Split the line into 4 segments. - \item The first and last segments are trivial. - \item To rotate the point you can use complex numbers, - recall that $z e^{j \theta}$ rotates a point $z$ in 2D - by $\theta$. - \item Do this for all line segments till everything is - done. - \end{enumerate} - \item Show rate of convergence for a first and second order finite - difference of sin(x) -\end{enumerate} -\inctime{20} -\end{frame} \end{document}