summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantosh G. Vattam2009-10-09 12:10:46 +0530
committerSantosh G. Vattam2009-10-09 12:10:46 +0530
commit8edfaa6a00a5d0f13b57a53d0e1804a94f343a8d (patch)
treec3f8b0baafbba52e00fa80809f0fe7aec6a863c0
parent97fa2f26647b1dc437779aed84b35d3cdb6927c8 (diff)
parent851b06f1ef9c53f64515b02a5f0bc9e584329c8d (diff)
downloadworkshops-more-scipy-8edfaa6a00a5d0f13b57a53d0e1804a94f343a8d.tar.gz
workshops-more-scipy-8edfaa6a00a5d0f13b57a53d0e1804a94f343a8d.tar.bz2
workshops-more-scipy-8edfaa6a00a5d0f13b57a53d0e1804a94f343a8d.zip
Merged branches.
-rw-r--r--day1/links.tex22
-rw-r--r--day2/handout.tex37
-rw-r--r--day2/session1.tex13
-rw-r--r--day2/session2.tex21
-rw-r--r--day2/session3.tex2
-rw-r--r--day2/tda.tex13
6 files changed, 84 insertions, 24 deletions
diff --git a/day1/links.tex b/day1/links.tex
new file mode 100644
index 0000000..7734d47
--- /dev/null
+++ b/day1/links.tex
@@ -0,0 +1,22 @@
+\documentclass[12pt]{article}
+\title{Links and References}
+\author{Asokan Pichai\\Prabhu Ramachandran}
+\begin{document}
+\maketitle
+\begin{itemize}
+ \item Most referred and trusted material for learning \emph{Python} language is available at \url{http://docs.python.org/tutorial/}
+ \item ``may be one of the thinnest programming language books on my shelf, but it's also one of the best.'' -- \emph{Slashdot, AccordianGuy, September 8, 2004}- available at \url{http://diveintopython.org/}
+ \item How to Think Like a Computer Scientist: Learning with Python available at \url{http://www.openbookproject.net/thinkcs/python/english/}\\``The concepts covered here apply to all programming languages and to problem solving in general.'' -- \emph{Guido van Rossum, creator of Python}
+ \item Some assorted articles related to Python \url{http://effbot.org/zone/index.htm}
+ \item To read more on strings refer to: \\ \url{http://docs.python.org/library/stdtypes.html#string-methods}
+ \item For documentation on IPython refer: \\ \url{http://ipython.scipy.org/moin/Documentation}
+ \item Documentation for Numpy and Scipy is available at: \url{http://docs.scipy.org/doc/}
+ \item For "recipes" or worked examples of commonly-done tasks in SciPy explore: \url{http://www.scipy.org/Cookbook/}
+ \item User Guide for Mayavi is the best place to look for Mayavi Documentation, available at: \\ \url{http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/}
+ \item Explore examples and plots based on matplotlib at \\ \url{http://matplotlib.sourceforge.net/examples/index.html}
+ \item One stop go for Sage is \url{http://www.sagemath.org/doc/}
+ \item Central page for all SymPy’s documentation is at \\ \url{http://docs.sympy.org/}
+ \item For videos from basics to advanced Python check out: \\ \url{http://www.archive.org/search.php?query=scipy09}
+
+\end{itemize}
+\end{document}
diff --git a/day2/handout.tex b/day2/handout.tex
index d7df544..7d56088 100644
--- a/day2/handout.tex
+++ b/day2/handout.tex
@@ -7,6 +7,7 @@
\section{Matrices and Arrays \& 2D Plotting}
\subsection{Matrices and Arrays}
+\subsubsection{Basic Numpy}
\begin{verbatim}
# Simple array math example
>>> import numpy as np
@@ -54,7 +55,10 @@ array([10,11,12,-1])
>>> np.greater(a,4)
>>> np.sqrt(a)
+\end{verbatim}
+\subsubsection{Array Creation}
+\begin{verbatim}
>>> np.array([2,3,4])
array([2, 3, 4])
@@ -69,7 +73,9 @@ array([[ 1., 1.],
>>>np.ones_like(a)
array([[1, 1, 1],
[1, 1, 1]])
-
+\end{verbatim}
+\subsubsection{Slicing, Striding Arrays}
+\begin{verbatim}
>>> a = np.array([[1,2,3], [4,5,6],
[7,8,9]])
>>> a[0,1:3]
@@ -87,7 +93,9 @@ array([[1, 3],
[7, 9]])
# Slices are references to the
# same memory!
-
+\end{verbatim}
+\subsubsection{Random Numbers}
+\begin{verbatim}
>>> np.random.rand(3,2)
array([[ 0.96276665, 0.77174861],
[ 0.35138557, 0.61462271],
@@ -96,7 +104,7 @@ array([[ 0.96276665, 0.77174861],
42
\end{verbatim}
-\subsection{Problem Set}
+\subsubsection{Problem Set}
\begin{verbatim}
>>> from scipy import misc
>>> A=misc.imread(name)
@@ -112,6 +120,7 @@ array([[ 0.96276665, 0.77174861],
\end{enumerate}
\subsection{2D Plotting}
+\subsubsection{Basic 2D Plotting}
\begin{verbatim}
$ ipython -pylab
>>> x = linspace(0, 2*pi, 1000)
@@ -122,7 +131,9 @@ $ ipython -pylab
>>> ylabel(r'sin($\chi$)', color='r')
>>> title('Simple figure', fontsize=20)
>>> savefig('/tmp/test.eps')
-
+\end{verbatim}
+\subsubsection{Tweaking plots}
+\begin{verbatim}
# Set properties of objects:
>>> l, = plot(x, sin(x))
# Why "l,"?
@@ -132,7 +143,10 @@ $ ipython -pylab
>>> setp(l) # Print properties.
>>> clf() # Clear figure.
>>> close() # Close figure.
+\end{verbatim}
+\subsubsection{Working with text}
+\begin{verbatim}
>>> w = arange(-2,2,.1)
>>> plot(w,exp(-(w*w))*cos)
>>> ylabel('$f(\omega)$')
@@ -144,7 +158,10 @@ $ ipython -pylab
arrowprops=dict(
facecolor='black',
shrink=0.05))
+\end{verbatim}
+\subsubsection{Legends}
+\begin{verbatim}
>>> x = linspace(0, 2*np.pi, 1000)
>>> plot(x, cos(5*x), 'r--',
label='cosine')
@@ -153,7 +170,10 @@ $ ipython -pylab
>>> legend()
# Or use:
>>> legend(['cosine', 'sine'])
+\end{verbatim}
+\subsubsection{Multiple figures}
+\begin{verbatim}
>>> figure(1)
>>> plot(x, sin(x))
>>> figure(2)
@@ -163,7 +183,7 @@ $ ipython -pylab
\end{verbatim}
-\subsection{Problem Set}
+\subsubsection{Problem Set}
\begin{enumerate}
\item Write a function that plots any regular n-gon given n.
\item Consider the logistic map, $f(x) = kx(1-x)$, plot it for
@@ -187,11 +207,12 @@ $ ipython -pylab
\begin{verbatim}
>>> a = np.arange(4)
>>> b = np.arange(5)
->>> a+b
+>>> a+b #Does this work?
>>> a+3
>>> c=np.array([3])
->>> a+c
->>> b+c
+>>> a+c #Works!
+>>> b+c #But how?
+>>> a.shape, b.shape, c.shape
>>> a = np.arange(4)
>>> a+3
diff --git a/day2/session1.tex b/day2/session1.tex
index 1d80bd4..357f18c 100644
--- a/day2/session1.tex
+++ b/day2/session1.tex
@@ -134,10 +134,8 @@
\item Why?
\item What:
\begin{itemize}
- \item An efficient and powerful array type for various common data
- types
- \item Abstracts out the most commonly used standard operations on
- arrays
+ \item An efficient and powerful array type for various common data types
+ \item Abstracts out the most commonly used standard operations on arrays
\end{itemize}
\end{itemize}
\end{frame}
@@ -803,4 +801,11 @@ title('triangular head; scale '\
\end{columns}
\inctime{20}
\end{frame}
+\begin{frame}{Summary}
+ \begin{itemize}
+ \item Basics of Numpy.
+ \item Array operations.
+ \item Plotting in 2D.
+ \end{itemize}
+\end{frame}
\end{document}
diff --git a/day2/session2.tex b/day2/session2.tex
index 9a02146..3f0184d 100644
--- a/day2/session2.tex
+++ b/day2/session2.tex
@@ -124,11 +124,12 @@
\begin{lstlisting}
>>> a = np.arange(4)
>>> b = np.arange(5)
- >>> a+b
+ >>> a+b #Does this work?
>>> a+3
>>> c=np.array([3])
- >>> a+c
- >>> b+c
+ >>> a+c #Works!
+ >>> b+c #But how?
+ >>> a.shape, b.shape, c.shape
\end{lstlisting}
\begin{itemize}
\item Enter Broadcasting!
@@ -426,8 +427,18 @@
Make a plot of $\frac{dx}{dt}$ vs. $x$.
\inctime{30}
\end{frame}
-
-
+\begin{frame}{Summary}
+ \begin{itemize}
+ \item Advanced NumPy
+ \item SciPy
+ \begin{itemize}
+ \item Linear Algebra
+ \item Integration
+ \item Interpolation
+ \item Signal and Image processing
+ \end{itemize}
+ \end{itemize}
+\end{frame}
\end{document}
- Numpy arrays (30 mins)
diff --git a/day2/session3.tex b/day2/session3.tex
index 8154c74..b1221e5 100644
--- a/day2/session3.tex
+++ b/day2/session3.tex
@@ -194,7 +194,7 @@
\section{Tools at your disposal}
-\subsection{Mayavi2.0}
+\subsection{Mayavi2}
\begin{frame}
\frametitle{Introduction to Mayavi}
diff --git a/day2/tda.tex b/day2/tda.tex
index ae39f4a..664eed3 100644
--- a/day2/tda.tex
+++ b/day2/tda.tex
@@ -261,7 +261,7 @@ def test_function_ignore_cases_words():
\begin{frame}[fragile]
\frametitle{Exercise}
- Based on Euclid's theorem:
+ Based on Euclid's algorithm:
$gcd(a,b)=gcd(b,b\%a)$\\
gcd function can be written as:
\begin{lstlisting}
@@ -269,14 +269,15 @@ def test_function_ignore_cases_words():
if a%b == 0: return b
return gcd(b, a%b)
\end{lstlisting}
+ \vspace*{-0.15in}
\begin{block}{Task}
- For given gcd implementation write
- at least two tests.
- \end{block}
- \begin{block}{Task}
- Write a non recursive implementation
+ \begin{itemize}
+ \item Write at least
+ two tests for above mentioned function.
+ \item Write a non recursive implementation
of gcd(), and test it using already
written tests.
+ \end{itemize}
\end{block}
\inctime{15}