From c98b90fe1a9ea076167277b341989daca59da2af Mon Sep 17 00:00:00 2001 From: Puneeth Chaganti Date: Mon, 4 Jan 2010 19:08:48 +0530 Subject: Changes at scipy.in --- day1/data/four_plot.png | Bin 0 -> 54760 bytes day1/data/fsolve.png | Bin 0 -> 20617 bytes day1/data/roots.png | Bin 0 -> 20654 bytes day1/session1.tex | 21 ++++++++++++++++----- day1/session3.tex | 34 +++++++++++++++++----------------- day1/session4.tex | 9 ++++++++- day1/session6.tex | 11 ++++++++++- 7 files changed, 51 insertions(+), 24 deletions(-) create mode 100644 day1/data/four_plot.png create mode 100644 day1/data/fsolve.png create mode 100644 day1/data/roots.png (limited to 'day1') diff --git a/day1/data/four_plot.png b/day1/data/four_plot.png new file mode 100644 index 0000000..00a3a7a Binary files /dev/null and b/day1/data/four_plot.png differ diff --git a/day1/data/fsolve.png b/day1/data/fsolve.png new file mode 100644 index 0000000..0108215 Binary files /dev/null and b/day1/data/fsolve.png differ diff --git a/day1/data/roots.png b/day1/data/roots.png new file mode 100644 index 0000000..c13a1a4 Binary files /dev/null and b/day1/data/roots.png differ diff --git a/day1/session1.tex b/day1/session1.tex index e3040a0..fef0155 100644 --- a/day1/session1.tex +++ b/day1/session1.tex @@ -447,25 +447,36 @@ In []: ylim(ymin-0.2, ymax+0.2) \item Annotate the origin \item Set axes limits to the range of x \end{enumerate} +\vspace*{-0.1in} +\begin{center} + \includegraphics[height=2.1in, interpolate=true]{data/four_plot} +\end{center} +\end{frame} + +\begin{frame}[fragile] +\frametitle{Review Problem \ldots} +\alert{Plotting \ldots} \begin{lstlisting} In []: x=linspace(-5*pi, 5*pi, 500) In []: plot(x, x, 'b') In []: plot(x, -x, 'b') +In []: plot(x, sin(x), 'g', linewidth=2) +In []: plot(x, x*sin(x), 'r', + linewidth=3) \end{lstlisting} $\vdots$ \end{frame} \begin{frame}[fragile] \frametitle{Review Problem \ldots} -\begin{lstlisting} -In []: plot(x, sin(x), 'g', linewidth=2) -In []: plot(x, x*sin(x), 'r', - linewidth=3) -\end{lstlisting} +\alert{Legend \& Annotation\ldots} \begin{lstlisting} In []: legend(['x', '-x', 'sin(x)', 'xsin(x)']) In []: annotate('origin', xy = (0, 0)) +\end{lstlisting} +\alert{Setting Axes limits\ldots} +\begin{lstlisting} In []: xlim(-5*pi, 5*pi) In []: ylim(-5*pi, 5*pi) \end{lstlisting} diff --git a/day1/session3.tex b/day1/session3.tex index 79f7dc9..e847a3d 100644 --- a/day1/session3.tex +++ b/day1/session3.tex @@ -147,7 +147,7 @@ In []: for line in open('pendulum.txt'): .... point = line.split() .... l = float(point[0]) .... t = float(point[1]) - .... g = 4 * pi * pi * l / t * t + .... g = 4 * pi * pi * l / (t * t) .... G.append(g) \end{lstlisting} \end{frame} @@ -166,8 +166,8 @@ total = 0 for g in G: total += g -g_mean = total / len(g) -print "Mean: ", g_mean +g_mean = total / len(G) +print 'Mean: ', g_mean \end{lstlisting} \end{frame} @@ -175,7 +175,7 @@ print "Mean: ", g_mean \frametitle{Mean ``g''} \begin{lstlisting} g_mean = sum(G) / len(G) -print "Mean: ", g_mean +print 'Mean: ', g_mean \end{lstlisting} \end{frame} @@ -183,7 +183,7 @@ print "Mean: ", g_mean \frametitle{Mean ``g''} \begin{lstlisting} g_mean = mean(G) -print "Mean: ", g_mean +print 'Mean: ', g_mean \end{lstlisting} \inctime{10} \end{frame} @@ -277,11 +277,11 @@ for record in open('sslc1.txt'): \begin{frame}[fragile] \frametitle{Dictionaries \ldots} \begin{lstlisting} -In []: d = {"jpg" : "image file", - "txt" : "text file", - "py" : "python code"} +In []: d = {'jpg' : 'image file', + 'txt' : 'text file', + 'py' : 'python code'} -In []: d["txt"] +In []: d['txt'] Out[]: 'text file' \end{lstlisting} \end{frame} @@ -289,10 +289,10 @@ Out[]: 'text file' \begin{frame}[fragile] \frametitle{Dictionaries \ldots} \begin{lstlisting} -In []: "py" in d +In []: 'py' in d Out[]: True -In []: "cpp" in d +In []: 'cpp' in d Out[]: False \end{lstlisting} \end{frame} @@ -417,11 +417,11 @@ for record in open('sslc1.txt'): \begin{frame}[fragile] \frametitle{Obtaining statistics} \begin{lstlisting} -print "Mean: ", mean(math_scores) +print 'Mean: ', mean(math_scores) -print "Median: ", median(math_scores) +print 'Median: ', median(math_scores) -print "Standard Deviation: ", +print 'Standard Deviation: ', std(math_scores) \end{lstlisting} \inctime{10} @@ -432,11 +432,11 @@ print "Standard Deviation: ", \begin{lstlisting} math_array = array(math_scores) -print "Mean: ", mean(math_array) +print 'Mean: ', mean(math_array) -print "Median: ", median(math_array) +print 'Median: ', median(math_array) -print "Standard Deviation: ", +print 'Standard Deviation: ', std(math_array) \end{lstlisting} \inctime{5} diff --git a/day1/session4.tex b/day1/session4.tex index 33f1f68..78e03a8 100644 --- a/day1/session4.tex +++ b/day1/session4.tex @@ -488,7 +488,14 @@ Out[]: array([-1., 8., -1.]) \frametitle{\typ{lstsq}} \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^2 = A \cdot p$, where A is +\item In matrix form, the equation can be represented as $T_{sq} = A \cdot p$, where $T_{sq}$ is + $\begin{bmatrix} + T^2_1 \\ + T^2_2 \\ + \vdots\\ + T^2_N \\ + \end{bmatrix}$ +, A is $\begin{bmatrix} L_1 & 1 \\ L_2 & 1 \\ diff --git a/day1/session6.tex b/day1/session6.tex index 906fb54..05b6134 100755 --- a/day1/session6.tex +++ b/day1/session6.tex @@ -216,11 +216,17 @@ Use \kwrd{solve()} \frametitle{Scipy Methods - \typ{roots}} \begin{itemize} \item Calculates the roots of polynomials +\item To calculate the roots of $x^2-5x+6$ \end{itemize} \begin{lstlisting} - In []: coeffs = [1, 6, 13] + In []: coeffs = [1, -5, 6] In []: roots(coeffs) + Out[]: array([3., 2.]) \end{lstlisting} +\vspace*{-.2in} +\begin{center} +\includegraphics[height=1.6in, interpolate=true]{data/roots} +\end{center} \end{frame} \begin{frame}[fragile] @@ -291,6 +297,9 @@ Find the root of $sin(x)+cos^2(x)$ nearest to $0$ In []: fsolve(f, 0) Out[]: -0.66623943249251527 \end{lstlisting} +\begin{center} +\includegraphics[height=2in, interpolate=true]{data/fsolve} +\end{center} \end{frame} %% \begin{frame}[fragile] -- cgit