Changes at scipy.in
authorPuneeth Chaganti <punchagan@fossee.in>
Mon, 04 Jan 2010 19:08:48 +0530
changeset 337 56aa2efbf7d9
parent 335 45bcdc34bf73
child 338 63b69ed765d0
Changes at scipy.in
day1/data/four_plot.png
day1/data/fsolve.png
day1/data/roots.png
day1/session1.tex
day1/session3.tex
day1/session4.tex
day1/session6.tex
Binary file day1/data/four_plot.png has changed
Binary file day1/data/fsolve.png has changed
Binary file day1/data/roots.png has changed
--- a/day1/session1.tex	Tue Dec 29 19:26:13 2009 +0530
+++ b/day1/session1.tex	Mon Jan 04 19:08:48 2010 +0530
@@ -447,25 +447,36 @@
 \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}
--- a/day1/session3.tex	Tue Dec 29 19:26:13 2009 +0530
+++ b/day1/session3.tex	Mon Jan 04 19:08:48 2010 +0530
@@ -147,7 +147,7 @@
   ....     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 @@
 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 @@
   \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 @@
   \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 @@
 \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 @@
 \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 @@
 \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 @@
   \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}
--- a/day1/session4.tex	Tue Dec 29 19:26:13 2009 +0530
+++ b/day1/session4.tex	Mon Jan 04 19:08:48 2010 +0530
@@ -488,7 +488,14 @@
 \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 \\
--- a/day1/session6.tex	Tue Dec 29 19:26:13 2009 +0530
+++ b/day1/session6.tex	Mon Jan 04 19:08:48 2010 +0530
@@ -216,11 +216,17 @@
 \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 @@
 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]