diff options
author | Santosh G. Vattam | 2010-01-25 17:53:03 +0530 |
---|---|---|
committer | Santosh G. Vattam | 2010-01-25 17:53:03 +0530 |
commit | 27fba3297e33331039fbae3caff26a0a4b385f46 (patch) | |
tree | 2c5744db9b8a97881cc48cc68dddaa2f88ef1318 /day1/session4.tex | |
parent | 6bd23550d9a318d62c9570f32c23674e0a19b435 (diff) | |
parent | d805f82a51cf85c2ff20dd1c3bb2052dd7a22173 (diff) | |
download | workshops-more-scipy-27fba3297e33331039fbae3caff26a0a4b385f46.tar.gz workshops-more-scipy-27fba3297e33331039fbae3caff26a0a4b385f46.tar.bz2 workshops-more-scipy-27fba3297e33331039fbae3caff26a0a4b385f46.zip |
Branches merged.
Diffstat (limited to 'day1/session4.tex')
-rw-r--r-- | day1/session4.tex | 77 |
1 files changed, 41 insertions, 36 deletions
diff --git a/day1/session4.tex b/day1/session4.tex index 257fd54..9195ff6 100644 --- a/day1/session4.tex +++ b/day1/session4.tex @@ -134,15 +134,15 @@ \begin{frame}[fragile] \frametitle{Matrices: Initializing} \begin{lstlisting} -In []: c = array([[1,1,2], - [2,4,1], - [-1,3,7]]) +In [23]: c = array([[11,12,13], + [21,22,23], + [31,32,33]]) In []: c Out[]: -array([[1,1,2], - [2,4,1], - [-1,3,7]]) +array([[11, 12, 13], + [21, 22, 23], + [31, 32, 33]]) \end{lstlisting} \end{frame} @@ -174,16 +174,16 @@ Also available \alert{\typ{zeros, zeros_like, empty, empty_like}} \begin{lstlisting} In []: c Out[]: -array([[1,1,2], - [2,4,1], - [-1,3,7]]) +array([[11, 12, 13], + [21, 22, 23], + [31, 32, 33]]) In []: c[1][2] -Out[]: 1 +Out[]: 23 In []: c[1,2] -Out[]: 1 +Out[]: 23 In []: c[1] -Out[]: array([2, 4, 1]) +Out[]: array([21, 22, 23]) \end{lstlisting} \end{frame} @@ -191,19 +191,19 @@ Out[]: array([2, 4, 1]) \frametitle{Changing elements} \begin{small} \begin{lstlisting} -In []: c[1,1] = -2 +In []: c[1,1] = -22 In []: c Out[]: -array([[ 1, 1, 2], - [ 2, -2, 1], - [-1, 3, 7]]) +array([[ 11, 12, 13], + [ 21, -22, 23], + [ 31, 32, 33]]) -In []: c[1] = [0,0,0] +In []: c[1] = 0 In []: c Out[]: -array([[ 1, 1, 2], +array([[11, 12, 13], [ 0, 0, 0], - [-1, 3, 7]]) + [31, 32, 33]]) \end{lstlisting} \end{small} How to change one \alert{column}? @@ -214,20 +214,20 @@ How to change one \alert{column}? \begin{small} \begin{lstlisting} In []: c[:,1] -Out[]: array([1, 0, 3]) +Out[]: array([12, 0, 32]) In []: c[1,:] Out[]: array([0, 0, 0]) In []: c[0:2,:] Out[]: -array([[1, 1, 2], - [0, 0, 0]]) +array([[11, 12, 13], + [ 0, 0, 0]]) In []: c[1:3,:] Out[]: array([[ 0, 0, 0], - [-1, 3, 7]]) + [31, 32, 33]]) \end{lstlisting} \end{small} \end{frame} @@ -238,18 +238,18 @@ array([[ 0, 0, 0], \begin{lstlisting} In []: c[:2,:] Out[]: -array([[1, 1, 2], - [0, 0, 0]]) +array([[11, 12, 13], + [ 0, 0, 0]]) In []: c[1:,:] Out[]: array([[ 0, 0, 0], - [-1, 3, 7]]) + [31, 32, 33]]) In []: c[1:,:2] Out[]: array([[ 0, 0], - [-1, 3]]) + [31, 32]]) \end{lstlisting} \end{small} @@ -261,19 +261,19 @@ array([[ 0, 0], \begin{lstlisting} In []: c[::2,:] Out[]: -array([[ 1, 1, 2], - [-1, 3, 7]]) +array([[11, 12, 13], + [31, 32, 33]]) In []: c[:,::2] Out[]: -xarray([[ 1, 2], +array([[11, 13], [ 0, 0], - [-1, 7]]) + [31, 33]]) In []: c[::2,::2] Out[]: -array([[ 1, 2], - [-1, 7]]) +array([[11, 13], + [31, 33]]) \end{lstlisting} \end{small} \end{frame} @@ -477,11 +477,16 @@ Out[]: array([-1., 8., -1.]) \begin{frame} \frametitle{Least Square Fit Curve} +\begin{center} \begin{itemize} -\item $T^2$ and $L$ have a linear relationship -\item Hence, Least Square Fit Curve is a line -\item we shall use the \typ{lstsq} function +\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] |