summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantosh G. Vattam2010-03-08 20:45:33 +0530
committerSantosh G. Vattam2010-03-08 20:45:33 +0530
commitfb965a5047dca69c518543440c2a6fd5647555c4 (patch)
treebac9712c676e4f47ef6d5f58eda077cc3270ddcb
parentf256121c515b6335a1d46568ca8e2d79859204d7 (diff)
downloadworkshops-more-scipy-fb965a5047dca69c518543440c2a6fd5647555c4.tar.gz
workshops-more-scipy-fb965a5047dca69c518543440c2a6fd5647555c4.tar.bz2
workshops-more-scipy-fb965a5047dca69c518543440c2a6fd5647555c4.zip
Updated for day1 of GRD workshop.
-rw-r--r--day1/day1quiz1.tex21
-rw-r--r--day1/day1quiz2.tex9
-rw-r--r--day1/session1.tex106
-rw-r--r--day1/session2.tex26
-rw-r--r--day1/session3.tex51
-rw-r--r--day1/session4.tex79
-rw-r--r--day1/session5.tex9
-rwxr-xr-xday1/session6.tex19
8 files changed, 180 insertions, 140 deletions
diff --git a/day1/day1quiz1.tex b/day1/day1quiz1.tex
index 331eb57..75801f9 100644
--- a/day1/day1quiz1.tex
+++ b/day1/day1quiz1.tex
@@ -55,6 +55,7 @@ On the top right hand corner please write down the following:
\item Name:
\item University/College/Company:
\item Student/Teacher/Professional:
+ \item Field of interest/study:
\end{itemize}
\end{frame}
@@ -204,17 +205,17 @@ pie-chart?
In []: marks = [10, 20, 30, 50, 55,
75, 83]
\end{lstlisting}
-Given the above marks, how will you calculate the \alert{mean} and
-\alert{standard deviation}?
+Given the above marks, how will you calculate the \alert{mean}?%% and
+%% \alert{standard deviation}?
\end{frame}
-\begin{frame}[fragile]
-\frametitle{\incqno }
-\begin{lstlisting}
-In []: marks = [10, 20, 30, 50, 55,
- 75, 83]
-\end{lstlisting}
-How will you convert the list \texttt{marks} to an \alert{array}?
-\end{frame}
+%% \begin{frame}[fragile]
+%% \frametitle{\incqno }
+%% \begin{lstlisting}
+%% In []: marks = [10, 20, 30, 50, 55,
+%% 75, 83]
+%% \end{lstlisting}
+%% How will you convert the list \texttt{marks} to an \alert{array}?
+%% \end{frame}
\end{document}
diff --git a/day1/day1quiz2.tex b/day1/day1quiz2.tex
index 64bc265..17452ac 100644
--- a/day1/day1quiz2.tex
+++ b/day1/day1quiz2.tex
@@ -58,6 +58,7 @@ On the top right hand corner please write down the following:
\item Name:
\item University/College/Company:
\item Student/Teacher/Professional:
+ \item Field of interest/study:
\end{itemize}
\end{frame}
@@ -170,10 +171,10 @@ you use to solve for the equation \\
\texttt{Ax = b}?
\end{frame}
-\begin{frame}
-\frametitle{\incqno }
-What command will you use if you wish to integrate a system of ODEs?
-\end{frame}
+%% \begin{frame}
+%% \frametitle{\incqno }
+%% What command will you use if you wish to integrate a system of ODEs?
+%% \end{frame}
\begin{frame}
\frametitle{\incqno }
diff --git a/day1/session1.tex b/day1/session1.tex
index 491a897..11126bf 100644
--- a/day1/session1.tex
+++ b/day1/session1.tex
@@ -154,24 +154,24 @@
\frametitle{Checklist}
\begin{enumerate}
\item IPython
- \item Editor
+ \item Editor - we recommend \alert{scite}
\item Data files:
\begin{itemize}
- \item \typ{sslc1.txt}
- \item \typ{pendulum.txt}
- \item \typ{points.txt}
- \item \typ{pos.txt}
- \item \typ{holmes.txt}
+ \item \typ{sslc/sslc1.txt}
+ \item \typ{pendulum/pendulum.txt}
+ \item \typ{motion-plot/pos.txt}
+ \item \typ{word-freq/holmes.txt}
+ \item \typ{anagrams/anag.txt}
\end{itemize}
\item Python scripts:
\begin{itemize}
- \item \typ{sslc_allreg.py}
- \item \typ{sslc_science.py}
+ \item \typ{sslc/sslc_allreg.py}
+ \item \typ{sslc/sslc_science.py}
\end{itemize}
\item Images
\begin{itemize}
- \item \typ{lena.png}
- \item \typ{smoothing.gif}
+ \item \typ{lena/lena.png}
+ \item \typ{smoothing/smoothing.gif}
\end{itemize}
\end{enumerate}
\end{frame}
@@ -210,8 +210,6 @@ Exiting
>>> ^D(Ctrl-D)
$
\end{lstlisting} %$
-\alert{Note the change in the prompt}\\
-\alert{IPython provides many additional features}\\
\end{frame}
\section{Starting up Ipython}
@@ -231,13 +229,16 @@ Exiting
In []: ^D(Ctrl-D)
Do you really want to exit([y]/n)? y
\end{lstlisting}
-\alert{IPython is an improved interpreter}\\
-\alert{Recommended for use in Scientific Computing work}\\
+An alternative to IPython is bpython
\end{frame}
\section{Ipython with magic}
\begin{frame}[fragile]
\frametitle{Let the magic begin \ldots}
+\begin{itemize}
+\item \alert{IPython is an improved interpreter}\\
+\item \alert{Recommended for Scientific and Computing work}\\
+\end{itemize}
\begin{block}{}
\begin{lstlisting}
$ ipython -pylab
@@ -397,6 +398,17 @@ In []: savefig('sin.png')
In []: close()
\end{lstlisting}
+Supported formats to store images:
+\begin{itemize}
+\item png
+\item eps - Easy to embed in Latex files
+\item emf
+\item pdf
+\item ps
+\item raw
+\item rgba
+\item svg
+\end{itemize}
\end{frame}
\section{Multiple plots}
@@ -459,16 +471,23 @@ In []: annotate('local max', xy=(1.5, 1))
\end{frame}
\begin{frame}[fragile]
-\frametitle{Axes lengths}
-\emphbar{Get the axes limits}
+\frametitle{Getting axes lengths}
\begin{lstlisting}
-In []: xmin, xmax = xlim()
-In []: ymin, ymax = ylim()
+In []: orig_xmin, orig_xmax = xlim()
+In []: orig_ymin, orig_ymax = ylim()
\end{lstlisting}
-\emphbar{Set the axes limits}
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{Set the axes limits}
\begin{lstlisting}
-In []: xlim(xmin, 2*pi)
-In []: ylim(ymin-0.2, ymax+0.2)
+In []: up_xmin = orig_xmin
+In []: up_xmax = 2*pi
+In []: up_ymin = ymin-0.2
+In []: up_ymax = ymax+0.2
+
+In []: xlim(up_xmin, up_xmax)
+In []: ylim(up_ymin, up_ymax)
\end{lstlisting}
\end{frame}
@@ -516,40 +535,55 @@ In []: ylim(-5*pi, 5*pi)
\end{frame}
\begin{frame}[fragile]
-\frametitle{Saving Commands}
-Save commands of review problem into file
-\begin{itemize}
-\item Use \typ{\%hist} command of IPython
-\item Identify the required line numbers
-\item Then, use \typ{\%save} command of IPython
-\end{itemize}
+\frametitle{Command History}
+Use the \typ{\%hist} \alert{magic} command of IPython
\typ{In []: \%hist}\\
-\typ{In []: \%save four_plot.py} \alert{\typ{16 18-27}}
+This displays all the commands typed in so far aka Command History.
\begin{block}{Careful about errors!}
- \kwrd{\%hist} will contain the errors as well,\\
- so be careful while selecting line numbers.
+ \kwrd{\%hist} will contain the errors as well.\\
+\end{block}
+\begin{block}{Magic Commands?}
+ Magic commands are commands provided by IPython to make our life easier.
+\end{block}
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{Saving commands into script}
+Use the \typ{\%save} \alert{magic} command of IPython
+\begin{block}{}
+\typ{In []: \%save script_name line_numbers}
\end{block}
+Line numbers can be specified individually separated by commas or as a range separated by a dash.\\
+\begin{block}{}
+\typ{In []: \%save four_plot.py} \alert{\typ{16 18-27}} \\
+\end{block}
+This saves from the history the commands entered on line numbers \alert{16, 18, 19, 20, \ldots 27}
\end{frame}
\begin{frame}
\frametitle{Python Scripts\ldots}
- This is called a Python Script.
+Now, four\_plot.py is called a Python Script.
\begin{itemize}
- \item run the script in IPython using \typ{\%run -i four_plot.py}\\
+ \item run the script in IPython using \typ{\%run four_plot.py}\\
\end{itemize}
+\pause
+\alert{\typ{NameError: name 'linspace' is not defined}}
+\begin{block}{}
+To avoid this, run using \alert{\typ{\%run -i four_plot.py}}\\
+\end{block}
\end{frame}
\begin{frame}[fragile]
\frametitle{What did we learn?}
\begin{itemize}
\item Starting up IPython
- \item \kwrd{\%hist} - History of commands
- \item \kwrd{\%save} - Saving commands
- \item Running a script using \kwrd{\%run -i}
\item Creating simple plots.
\item Adding labels and legends.
\item Annotating plots.
\item Changing the looks: size, linewidth
+ \item \kwrd{\%hist} - History of commands
+ \item \kwrd{\%save} - Saving commands
+ \item Running a script using \kwrd{\%run -i}
\end{itemize}
\end{frame}
diff --git a/day1/session2.tex b/day1/session2.tex
index 8f3f509..9666fd0 100644
--- a/day1/session2.tex
+++ b/day1/session2.tex
@@ -210,6 +210,9 @@ In []: mtlist = []
\begin{lstlisting}
In []: p = [ 2, 3, 5, 7]
+In []: p[1]
+Out[]: 3
+
In []: p[0]+p[1]+p[-1]
Out[]: 12
\end{lstlisting}
@@ -301,19 +304,12 @@ In []: t = [0.69, 0.90, 1.19,
\begin{lstlisting}
In []: tsq = []
-In []: len(l)
-Out[]: 9
-
-In []: len(t)
-Out[]: 9
-
In []: for time in t:
....: tsq.append(time*time)
....:
....:
-In []: plot(l, tsq)
-Out[]: [<matplotlib.lines.Line2D object at 0xa5b05ac>]
+In []: print len(l), len(t), len(tsq)
\end{lstlisting}
This gives \kwrd{tsq} which is the list of squares of \typ{t} values.
\end{frame}
@@ -327,7 +323,6 @@ This gives \kwrd{tsq} which is the list of squares of \typ{t} values.
....:
....:
- In []: print tsq, len(tsq)
In []: plot(l, tsq)
\end{lstlisting}
\end{frame}
@@ -343,26 +338,23 @@ This gives \kwrd{tsq} which is the list of squares of \typ{t} values.
\alert{Data is usually present in a file!} \\
Lets look at the \typ{pendulum.txt} file.
\begin{lstlisting}
-$ cat pendulum.txt
+In []: cd circulate/pendulum/
+In []: cat pendulum.txt
1.0000e-01 6.9004e-01
1.1000e-01 6.9497e-01
1.2000e-01 7.4252e-01
1.3000e-01 7.5360e-01
-1.4000e-01 8.3568e-01
-1.5000e-01 8.6789e-01
\end{lstlisting} %$
\ldots
-\begin{block}{Windows users:}
- C:> type pendulum.txt
-\end{block}
\end{frame}
\begin{frame}[fragile]
\frametitle{Reading \typ{pendulum.txt}}
\begin{itemize}
- \item Let us generate a plot from the data file
\item File contains L vs. T values
- \item L - Column1; T - Column2
+ \item First Column - L values
+ \item Second Column - T values
+ \item Let us generate a plot from the data file
\end{itemize}
\end{frame}
diff --git a/day1/session3.tex b/day1/session3.tex
index 617d2c6..e92ebed 100644
--- a/day1/session3.tex
+++ b/day1/session3.tex
@@ -73,7 +73,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title page
-\title[Statistics]{Python for Science and Engg: Statistics}
+\title[Statistics]{Python for Scienc and Engg: Statistics}
\author[FOSSEE] {FOSSEE}
@@ -152,15 +152,8 @@ In []: for line in open('pendulum.txt'):
\end{lstlisting}
\end{frame}
-\begin{frame}
- \frametitle{Computing mean ``g''}
- \begin{block}{Exercise}
- Obtain the mean of ``g''
- \end{block}
-\end{frame}
-
\begin{frame}[fragile]
- \frametitle{Mean ``g''}
+ \frametitle{Mean ``g'' - Classical method}
\begin{lstlisting}
In []: total = 0
In []: for g in g_list:
@@ -173,7 +166,7 @@ In []: print 'Mean: ', g_mean
\end{frame}
\begin{frame}[fragile]
- \frametitle{Mean ``g''}
+ \frametitle{Mean ``g'' - Slightly improved method}
\begin{lstlisting}
In []: g_mean = sum(g_list) / len(g_list)
In []: print 'Mean: ', g_mean
@@ -181,7 +174,7 @@ In []: print 'Mean: ', g_mean
\end{frame}
\begin{frame}[fragile]
- \frametitle{Mean ``g''}
+ \frametitle{Mean ``g'' - One liner}
\begin{lstlisting}
In []: g_mean = mean(g_list)
In []: print 'Mean: ', g_mean
@@ -215,7 +208,7 @@ In []: print 'Mean: ', g_mean
\item Region Code
\item Roll Number
\item Name
- \item Marks of 5 subjects: English, Hindi, Maths, Science, Social
+ \item Marks of 5 subjects: SLang, Flang Maths, Science, Social
\item Total marks
\item Pass/Fail (P/F)
\item Withheld (W)
@@ -257,30 +250,33 @@ In []: print 'Mean: ', g_mean
\subsection{Data processing}
\begin{frame}[fragile]
\frametitle{File reading and parsing \ldots}
+\emphbar{Reading files line by line is the same as we had done with the pendulum example.}
+
\begin{lstlisting}
for record in open('sslc1.txt'):
fields = record.split(';')
\end{lstlisting}
-\begin{block}{}
-\centerline{Recall pendulum example!}
-\end{block}
\end{frame}
\subsection{Dictionaries}
\begin{frame}[fragile]
\frametitle{Dictionaries: Introduction}
\begin{itemize}
- \item lists index: 0 \ldots n
- \item dictionaries index using strings
+ \item Lists index using integers\\
+Recall \typ{p = [2, 3, 5, 7]} and\\
+\typ{p[1]} is equal to \typ{3}
+ \item Dictionaries index using strings
\end{itemize}
\end{frame}
\begin{frame}[fragile]
\frametitle{Dictionaries \ldots}
\begin{lstlisting}
-In []: d = {'jpg' : 'image file',
+In []: d = {'png' : 'image file',
'txt' : 'text file',
- 'py' : 'python code'}
+ 'py' : 'python code'
+ 'java': 'bad code',
+ 'cpp': 'complex code'}
In []: d['txt']
Out[]: 'text file'
@@ -293,7 +289,7 @@ Out[]: 'text file'
In []: 'py' in d
Out[]: True
-In []: 'cpp' in d
+In []: 'jpg' in d
Out[]: False
\end{lstlisting}
\end{frame}
@@ -366,6 +362,14 @@ print science.values()
\subsection{Visualizing data}
\begin{frame}[fragile]
+ \frametitle{Pie Chart}
+ \begin{lstlisting}
+ pie(science.values())
+ \end{lstlisting}
+\includegraphics[height=2in, interpolate=true]{data/science_nolabel}
+\end{frame}
+
+\begin{frame}[fragile]
\frametitle{Pie chart}
\small
\begin{lstlisting}
@@ -408,13 +412,6 @@ for record in open('sslc1.txt'):
\subsection{Obtaining statistics}
\begin{frame}[fragile]
\frametitle{Obtaining statistics}
- \begin{block}{Exercise}
- Obtain the mean of Math scores
- \end{block}
-\end{frame}
-
-\begin{frame}[fragile]
- \frametitle{Obtaining statistics}
\begin{lstlisting}
print 'Mean: ', mean(math_scores)
diff --git a/day1/session4.tex b/day1/session4.tex
index 99ca05b..42227f1 100644
--- a/day1/session4.tex
+++ b/day1/session4.tex
@@ -164,7 +164,7 @@ Out[]:
array([[ 1., 0.],
[ 0., 1.]])
\end{lstlisting}
-Also available \alert{\typ{zeros, zeros_like, empty, empty_like}}
+Also available \alert{\typ{zeros, zeros_like}}
\end{small}
\end{frame}
@@ -182,8 +182,6 @@ In []: c[1][2]
Out[]: 23
In []: c[1,2]
Out[]: 23
-In []: c[1]
-Out[]: array([21, 22, 23])
\end{lstlisting}
\end{frame}
@@ -191,6 +189,9 @@ Out[]: array([21, 22, 23])
\frametitle{Changing elements}
\begin{small}
\begin{lstlisting}
+In []: c[1]
+Out[]: array([21, 22, 23])
+
In []: c[1,1] = -22
In []: c
Out[]:
@@ -206,7 +207,7 @@ array([[11, 12, 13],
[31, 32, 33]])
\end{lstlisting}
\end{small}
-How to change one \alert{column}?
+How to access one \alert{column}?
\end{frame}
\begin{frame}[fragile]
@@ -294,23 +295,28 @@ Out[]: (3, 3)
\end{frame}
\begin{frame}[fragile]
- \frametitle{Slicing \& Striding Exercises}
+ \frametitle{Elementary image processing}
\begin{small}
\begin{lstlisting}
In []: a = imread('lena.png')
In []: imshow(a)
Out[]: <matplotlib.image.AxesImage object at 0xa0384cc>
-
\end{lstlisting}
-\end{small}
+ \end{small}
+\typ{imread} returns an array of shape (512, 512, 4) which represents an image of 512x512 pixels and 4 shades.\\
+\typ{imshow} renders the array as an image.
+\end{frame}
+
+\begin{frame}[fragile]
+\frametitle{Slicing \& Striding Exercises}
\begin{itemize}
\item Crop the image to get the top-left quarter
\item Crop the image to get only the face
\item Resize image to half by dropping alternate pixels
\end{itemize}
-\end{frame}
+\end{frame}
\begin{frame}[fragile]
\frametitle{Solutions}
\begin{small}
@@ -345,14 +351,6 @@ array([[ 1, 2, 2, 1],
\end{frame}
\begin{frame}[fragile]
- \frametitle{Sum of all elements}
- \begin{lstlisting}
-In []: sum(a)
-Out[]: 12
- \end{lstlisting}
-\end{frame}
-
-\begin{frame}[fragile]
\frametitle{Matrix Addition}
\begin{lstlisting}
In []: b = array([[3,2,-1,5],
@@ -410,11 +408,16 @@ array([[-0.5 , 0.55, -0.15, 0.7 ],
\end{frame}
\begin{frame}[fragile]
-\frametitle{Determinant}
+\frametitle{Determinant and sum of all elements}
\begin{lstlisting}
In []: det(a)
Out[]: 80.0
\end{lstlisting}
+ \begin{lstlisting}
+In []: sum(a)
+Out[]: 12
+ \end{lstlisting}
+
\end{frame}
%%use S=array(X,Y)
@@ -467,7 +470,8 @@ Out[]: array([-1., 8., -1.])
\section{Least Squares Fit}
\begin{frame}[fragile]
\frametitle{$L$ vs. $T^2$ - Scatter}
-\vspace{-0.15in}
+Linear trend visible.
+\vspace{-0.1in}
\begin{figure}
\includegraphics[width=4in]{data/L-Tsq-points}
\end{figure}
@@ -475,37 +479,24 @@ Out[]: array([-1., 8., -1.])
\begin{frame}[fragile]
\frametitle{$L$ vs. $T^2$ - Line}
-\vspace{-0.15in}
+This line does not make any mathematical sense.
+\vspace{-0.1in}
\begin{figure}
\includegraphics[width=4in]{data/L-Tsq-Line}
\end{figure}
\end{frame}
\begin{frame}[fragile]
-\frametitle{$L$ vs. $T^2$ }
\frametitle{$L$ vs. $T^2$ - Least Square Fit}
-\vspace{-0.15in}
+This is what our intention is.
+\vspace{-0.1in}
\begin{figure}
\includegraphics[width=4in]{data/least-sq-fit}
\end{figure}
\end{frame}
-\begin{frame}
-\frametitle{Least Square Fit Curve}
-\begin{center}
-\begin{itemize}
-\item $L \alpha T^2$
-\item Best Fit Curve $\rightarrow$ Linear
- \begin{itemize}
- \item Least Square Fit
- \end{itemize}
-\item \typ{lstsq()}
-\end{itemize}
-\end{center}
-\end{frame}
-
\begin{frame}[fragile]
-\frametitle{\typ{lstsq}}
+\frametitle{Matrix Formulation}
\begin{itemize}
\item We need to fit a line through points for the equation $T^2 = m \cdot L+c$
\item In matrix form, the equation can be represented as $T_{sq} = A \cdot p$, where $T_{sq}$ is
@@ -535,11 +526,11 @@ Out[]: array([-1., 8., -1.])
\frametitle{Getting $L$ and $T^2$}
%If you \alert{closed} IPython after session 2
\begin{lstlisting}
-In []: l = []
+In []: L = []
In []: t = []
In []: for line in open('pendulum.txt'):
.... point = line.split()
- .... l.append(float(point[0]))
+ .... L.append(float(point[0]))
.... t.append(float(point[1]))
....
....
@@ -549,7 +540,7 @@ In []: for line in open('pendulum.txt'):
\begin{frame}[fragile]
\frametitle{Getting $L$ and $T^2$ \dots}
\begin{lstlisting}
-In []: l = array(l)
+In []: L = array(L)
In []: t = array(t)
\end{lstlisting}
\alert{\typ{In []: tsq = t*t}}
@@ -558,7 +549,7 @@ In []: t = array(t)
\begin{frame}[fragile]
\frametitle{Generating $A$}
\begin{lstlisting}
-In []: A = array([l, ones_like(l)])
+In []: A = array([L, ones_like(L)])
In []: A = A.T
\end{lstlisting}
%% \begin{itemize}
@@ -586,13 +577,15 @@ In []: coef = result[0]
\frametitle{Least Square Fit Line \ldots}
We get the points of the line from \typ{coef}
\begin{lstlisting}
-In []: Tline = coef[0]*l + coef[1]
+In []: Tline = coef[0]*L + coef[1]
+
+In []: Tline.shape
\end{lstlisting}
\begin{itemize}
-\item Now plot \typ{Tline} vs. \typ{l}, to get the Least squares fit line.
+\item Now plot \typ{Tline} vs. \typ{L}, to get the Least squares fit line.
\end{itemize}
\begin{lstlisting}
-In []: plot(l, Tline)
+In []: plot(L, Tline)
\end{lstlisting}
\end{frame}
diff --git a/day1/session5.tex b/day1/session5.tex
index 8865438..46726cc 100644
--- a/day1/session5.tex
+++ b/day1/session5.tex
@@ -151,14 +151,17 @@ plot(l, t, '.')
\begin{columns}
\column{0.5\textwidth}
\hspace*{-0.5in}
- \includegraphics[height=2in, interpolate=true]{data/points}
+ \includegraphics[height=2in, interpolate=true]{data/triangle}
\column{0.45\textwidth}
\begin{block}{Line between two points}
\tiny
\begin{lstlisting}
-In []: x = [1, 5]
-In []: y = [1, 4]
+In []: x = [3, 1]
+In []: y = [2, -3]
+In []: z = [-2, 4]
In []: plot(x, y)
+In []: plot(y, z)
+In []: plot(x, z)
\end{lstlisting}
\end{block}
\end{columns}
diff --git a/day1/session6.tex b/day1/session6.tex
index b7d1422..61b536c 100755
--- a/day1/session6.tex
+++ b/day1/session6.tex
@@ -311,6 +311,25 @@ Out[]: -0.66623943249251527
\end{center}
\end{frame}
+\begin{frame}[fragile]
+ \frametitle{Exercise Problem}
+ Find the root of the equation $x^2 - sin(x) + cos^2(x)$ nearest to $0$
+\end{frame}
+
+\begin{frame}[fragile]
+ \frametitle{Solution}
+ \begin{small}
+ \begin{lstlisting}
+ def f(x):
+ return x**2 - sin(x) + cos(x)*cos(x)
+ fsolve(f, 0)
+ \end{lstlisting}
+ \end{small}
+ \begin{center}
+\includegraphics[height=2in, interpolate=true]{data/fsolve_tanx}
+ \end{center}
+\end{frame}
+
%% \begin{frame}[fragile]
%% \frametitle{Scipy Methods \dots}
%% \begin{small}