summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPuneeth Chaganti2010-12-09 18:46:09 +0530
committerPuneeth Chaganti2010-12-09 18:46:09 +0530
commit20b0ac376b85534e6fc7723912777b6081f639e5 (patch)
tree99e3cf33c8d94d3bdef399905b5199b59656c728
parentdc751adb7676810b2d1a897f17700c3cea03a6f5 (diff)
downloadworkshops-20b0ac376b85534e6fc7723912777b6081f639e5.tar.gz
workshops-20b0ac376b85534e6fc7723912777b6081f639e5.tar.bz2
workshops-20b0ac376b85534e6fc7723912777b6081f639e5.zip
Renamed session4.tex to session3.tex
--HG-- branch : scipyin2010 rename : day1/session4.tex => day1/session3.tex
-rw-r--r--day1/session3.tex (renamed from day1/session4.tex)137
1 files changed, 2 insertions, 135 deletions
diff --git a/day1/session4.tex b/day1/session3.tex
index 66dd049..a0fbf26 100644
--- a/day1/session4.tex
+++ b/day1/session3.tex
@@ -74,13 +74,12 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Title page
-\title[Matrices \& Curve Fitting]{Python for Science and Engg: Matrices
-\& Least Squares Fit}
+\title[Arrays]{Python for Science and Engg: Arrays}
\author[FOSSEE] {FOSSEE}
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
-\date[] {SciPy 2010, Introductory tutorials\\Day 1, Session 4}
+\date[] {SciPy 2010, Tutorials}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
@@ -471,138 +470,6 @@ Out[]:
\end{small}
\end{frame}
-\section{Least Squares Fit}
-\begin{frame}[fragile]
-\frametitle{$L$ vs. $T^2$ - Scatter}
-Linear trend visible.
-\vspace{-0.1in}
-\begin{figure}
-\includegraphics[width=4in]{data/L-Tsq-points}
-\end{figure}
-\end{frame}
-
-\begin{frame}[fragile]
-\frametitle{$L$ vs. $T^2$ - Line}
-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$ - Least Square Fit}
-This is what our intention is.
-\vspace{-0.1in}
-\begin{figure}
-\includegraphics[width=4in]{data/least-sq-fit}
-\end{figure}
-\end{frame}
-
-\begin{frame}[fragile]
-\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
- $\begin{bmatrix}
- T^2_1 \\
- T^2_2 \\
- \vdots\\
- T^2_N \\
- \end{bmatrix}$
-, A is
- $\begin{bmatrix}
- L_1 & 1 \\
- L_2 & 1 \\
- \vdots & \vdots\\
- L_N & 1 \\
- \end{bmatrix}$
- and p is
- $\begin{bmatrix}
- m\\
- c\\
- \end{bmatrix}$
-\item We need to find $p$ to plot the line
-\end{itemize}
-\end{frame}
-
-\begin{frame}[fragile]
-\frametitle{Getting $L$ and $T^2$}
-%If you \alert{closed} IPython after session 2
-\begin{lstlisting}
-In []: L = []
-In []: t = []
-In []: for line in open('pendulum.txt'):
- .... point = line.split()
- .... L.append(float(point[0]))
- .... t.append(float(point[1]))
- ....
- ....
-\end{lstlisting}
-\end{frame}
-
-\begin{frame}[fragile]
-\frametitle{Getting $L$ and $T^2$ \dots}
-\begin{lstlisting}
-In []: L = array(L)
-In []: t = array(t)
-\end{lstlisting}
-\alert{\typ{In []: tsq = t*t}}
-\end{frame}
-
-\begin{frame}[fragile]
-\frametitle{Generating $A$}
-\begin{lstlisting}
-In []: A = array([L, ones_like(L)])
-In []: A = A.T
-\end{lstlisting}
-%% \begin{itemize}
-%% \item A is also called a Van der Monde matrix
-%% \item It can also be generated using \typ{vander}
-%% \end{itemize}
-%% \begin{lstlisting}
-%% In []: A = vander(L, 2)
-%% \end{lstlisting}
-\end{frame}
-
-\begin{frame}[fragile]
-\frametitle{\typ{lstsq} \ldots}
-\begin{itemize}
-\item Now use the \typ{lstsq} function
-\item Along with a lot of things, it returns the least squares solution
-\end{itemize}
-\begin{lstlisting}
-In []: result = lstsq(A,tsq)
-In []: coef = result[0]
-\end{lstlisting}
-\end{frame}
-
-\begin{frame}[fragile]
-\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.shape
-\end{lstlisting}
-\begin{itemize}
-\item Now plot \typ{Tline} vs. \typ{L}, to get the Least squares fit line.
-\end{itemize}
-\begin{lstlisting}
-In []: plot(L, Tline, 'r')
-
-In []: plot(L, tsq, 'o')
-\end{lstlisting}
-\end{frame}
-
-\begin{frame}[fragile]
-\frametitle{Least Squares Fit}
-\vspace{-0.15in}
-\begin{figure}
-\includegraphics[width=4in]{data/least-sq-fit}
-\end{figure}
-\end{frame}
-
\section{Summary}
\begin{frame}
\frametitle{What did we learn?}