equal
deleted
inserted
replaced
124 %% \frametitle{Outline} |
124 %% \frametitle{Outline} |
125 %% \tableofcontents |
125 %% \tableofcontents |
126 %% % You might wish to add the option [pausesections] |
126 %% % You might wish to add the option [pausesections] |
127 %% \end{frame} |
127 %% \end{frame} |
128 |
128 |
|
129 |
129 \begin{frame} |
130 \begin{frame} |
130 \frametitle{Least Squares Fit} |
131 \frametitle{Least Squares Fit} |
131 In this session - |
132 \begin{itemize} |
132 \begin{itemize} |
133 \item Plot a least squares fit line |
133 \item We shall plot a least squares fit curve for time-period(T) squared vs. length(L) plot of a Simple Pendulum. |
|
134 \item Given a file containing L and T values |
|
135 \end{itemize} |
134 \end{itemize} |
136 \end{frame} |
135 \end{frame} |
137 |
136 |
138 \begin{frame}[fragile] |
137 \begin{frame}[fragile] |
139 \frametitle{Least Squares Fit \ldots} |
138 \frametitle{Least Squares Fit \ldots} |
146 \item Arrays |
145 \item Arrays |
147 \end{itemize} |
146 \end{itemize} |
148 \end{itemize} |
147 \end{itemize} |
149 \end{frame} |
148 \end{frame} |
150 |
149 |
151 \begin{frame}[fragile] |
|
152 \frametitle{Reading pendulum.txt} |
|
153 \begin{itemize} |
|
154 \item The file has two columns |
|
155 \item Column1 - L; Column2 - T |
|
156 \end{itemize} |
|
157 \begin{lstlisting} |
|
158 In []: L = [] |
|
159 In []: T = [] |
|
160 In []: for line in open('pendulum.txt'): |
|
161 .... ln, t = line.split() |
|
162 .... L.append(float(ln)) |
|
163 .... T.append(float(t)) |
|
164 \end{lstlisting} |
|
165 We now have two lists L and T |
|
166 \end{frame} |
|
167 |
150 |
168 \begin{frame}[fragile] |
151 \begin{frame}[fragile] |
169 \frametitle{Calculating $T^2$} |
152 \frametitle{Calculating $T^2$} |
170 \begin{itemize} |
153 \begin{itemize} |
171 \item Each element of the list T must be squared |
154 \item Each element of the list T must be squared |