168 \item arbitrary dimensionality |
168 \item arbitrary dimensionality |
169 \item \typ{arr.shape}: size in each dimension |
169 \item \typ{arr.shape}: size in each dimension |
170 \item \alert{Note:} \typ{len(arr) != arr.size} in general |
170 \item \alert{Note:} \typ{len(arr) != arr.size} in general |
171 \item \alert{Note:} By default array operations are performed |
171 \item \alert{Note:} By default array operations are performed |
172 \alert{elementwise} |
172 \alert{elementwise} |
173 \item Indices, slicing: just like lists |
|
174 \end{itemize} |
173 \end{itemize} |
175 \end{frame} |
174 \end{frame} |
176 |
175 |
177 |
176 |
178 \begin{frame}[fragile] |
177 \begin{frame}[fragile] |
221 a)} etc. |
218 a)} etc. |
222 \item Logical operations: \typ{equal (==)}, \typ{not\_equal (!=)}, |
219 \item Logical operations: \typ{equal (==)}, \typ{not\_equal (!=)}, |
223 \typ{less (<)}, \typ{greater (>)} etc. |
220 \typ{less (<)}, \typ{greater (>)} etc. |
224 \item Trig and other functions: \typ{sin(x), arcsin(x), sinh(x), |
221 \item Trig and other functions: \typ{sin(x), arcsin(x), sinh(x), |
225 exp(x), sqrt(x)} etc. |
222 exp(x), sqrt(x)} etc. |
226 \item \typ{sum(x, axis=0), product(x, axis=0)} |
223 \item \typ{sum(x, axis=0), product(x, axis=0), dot(a, bp)} \inctime{10} |
227 \item \typ{dot(a, bp)} |
|
228 \end{itemize} |
224 \end{itemize} |
229 \inctime{10} |
225 |
230 \end{frame} |
226 \end{frame} |
231 |
227 |
232 \subsection{Array Creation \& Slicing, Striding Arrays} |
228 \subsection{Array Creation \& Slicing, Striding Arrays} |
233 \begin{frame}[fragile] |
229 \begin{frame}[fragile] |
234 \frametitle{Array creation functions} |
230 \frametitle{Array creation functions} |
721 |
721 |
722 \inctime{25} |
722 \inctime{25} |
723 \end{frame} |
723 \end{frame} |
724 |
724 |
725 \begin{frame} |
725 \begin{frame} |
726 \frametitle{Problem set 1.0} |
726 \frametitle{Problem Set} |
727 \begin{enumerate} |
727 \begin{enumerate} |
728 \item Write a function that plots any n-gon given \typ{n}. |
728 \item Write a function that plots any n-gon given \typ{n}. |
729 \item Consider the logistic map, $f(x) = kx(1-x)$, plot it for |
729 \item Consider the logistic map, $f(x) = kx(1-x)$, plot it for |
730 $k=2.5, 3.5$ and $4$ |
730 $k=2.5, 3.5$ and $4$ |
731 \end{enumerate} |
731 \end{enumerate} |
732 \end{frame} |
732 \end{frame} |
733 |
733 |
734 \begin{frame} |
734 \begin{frame}[fragile] |
735 \frametitle{Problem set 1.1} |
735 \frametitle{Problem Set} |
736 \begin{enumerate} |
736 \begin{columns} |
|
737 \column{0.6\textwidth} |
|
738 \small{ |
|
739 \begin{enumerate} |
737 \item Consider the iteration $x_{n+1} = f(x_n)$ where $f(x) = |
740 \item Consider the iteration $x_{n+1} = f(x_n)$ where $f(x) = |
738 kx(1-x)$. Plot the successive iterates of this process. |
741 kx(1-x)$. Plot the successive iterates of this process. |
739 \item Plot this using a cobweb plot as follows: |
742 \item Plot this using a cobweb plot as follows: |
740 \begin{enumerate} |
743 \begin{enumerate} |
741 \item Start at $(x_0, 0)$ |
744 \item Start at $(x_0, 0)$ |
742 \item Draw line to $(x_i, f(x_i))$; |
745 \item Draw line to $(x_i, f(x_i))$; |
743 \item Set $x_{i+1} = f(x_i)$ |
746 \item Set $x_{i+1} = f(x_i)$ |
744 \item Draw line to $(x_i, x_i)$ |
747 \item Draw line to $(x_i, x_i)$ |
745 \item Repeat from 2 for as long as you want |
748 \item Repeat from 2 for as long as you want |
746 \end{enumerate} |
749 \end{enumerate} |
747 \end{enumerate} |
750 \end{enumerate}} |
748 \end{frame} |
751 \column{0.35\textwidth} |
749 |
752 \hspace*{-0.5in} |
750 \begin{frame} |
753 \includegraphics[height=1.6in, interpolate=true]{data/cobweb} |
751 \frametitle{Problem set 1.2} |
754 \end{columns} |
752 \begin{enumerate} |
755 \inctime{20} |
753 |
756 \end{frame} |
754 \item Plot the Koch snowflake. Write a function to generate the |
757 |
755 necessary points given the two points constituting a line. |
|
756 \pause |
|
757 \begin{enumerate} |
|
758 \item Split the line into 4 segments. |
|
759 \item The first and last segments are trivial. |
|
760 \item To rotate the point you can use complex numbers, |
|
761 recall that $z e^{j \theta}$ rotates a point $z$ in 2D |
|
762 by $\theta$. |
|
763 \item Do this for all line segments till everything is |
|
764 done. |
|
765 \end{enumerate} |
|
766 \item Show rate of convergence for a first and second order finite |
|
767 difference of sin(x) |
|
768 \end{enumerate} |
|
769 \inctime{30} |
|
770 \end{frame} |
|
771 \end{document} |
758 \end{document} |