day1/session4.tex
changeset 197 8c42ffdaaeec
parent 185 e59ab9ab1a89
child 201 c81ebcd9e397
equal deleted inserted replaced
196:59138cb18119 197:8c42ffdaaeec
   122   \frametitle{Outline}
   122   \frametitle{Outline}
   123   \tableofcontents
   123   \tableofcontents
   124 %  \pausesections
   124 %  \pausesections
   125 \end{frame}
   125 \end{frame}
   126 
   126 
       
   127 \section{Matrices}
       
   128 
       
   129 \begin{frame}
       
   130 \frametitle{Matrices: Introduction}
       
   131 We looked at the Van der Monde matrix in the previous session,\\ 
       
   132 let us now look at matrices in a little more detail.
       
   133 \end{frame}
       
   134 
       
   135 \subsection{Initializing}
       
   136 \begin{frame}[fragile]
       
   137 \frametitle{Matrices: Initializing}
       
   138 \begin{lstlisting}
       
   139   In []: a = matrix([[1,2,3],
       
   140                      [4,5,6],
       
   141                      [7,8,9]])
       
   142 
       
   143   In []: a
       
   144   Out[]: 
       
   145   matrix([[1, 2, 3],
       
   146          [4, 5, 6],
       
   147          [7, 8, 9]])
       
   148 \end{lstlisting}
       
   149 \end{frame}
       
   150 
       
   151 \subsection{Basic Operations}
       
   152 \begin{frame}[fragile]
       
   153 \frametitle{Inverse of a Matrix}
       
   154 
       
   155 \begin{small}
       
   156 \begin{lstlisting}
       
   157 In []: linalg.inv(A)
       
   158 Out[]: 
       
   159 matrix([[ 0.07734807,  0.01657459,  0.32044199],
       
   160         [ 0.09944751, -0.12154696, -0.01657459],
       
   161         [-0.02762431, -0.07734807,  0.17127072]])
       
   162 
       
   163 \end{lstlisting}
       
   164 \end{small}
       
   165 \end{frame}
       
   166 
       
   167 \begin{frame}[fragile]
       
   168 \frametitle{Determinant}
       
   169 \begin{lstlisting}
       
   170   In []: linalg.det(a)
       
   171   Out[]: -9.5171266700777579e-16
       
   172 \end{lstlisting}
       
   173 \end{frame}
       
   174 
       
   175 \begin{frame}[fragile]
       
   176 \frametitle{Computing Norms}
       
   177 \begin{lstlisting}
       
   178   In []: linalg.norm(a)
       
   179   Out[]: 16.881943016134134
       
   180 \end{lstlisting}
       
   181 \end{frame}
       
   182 
       
   183 \begin{frame}[fragile]
       
   184 \frametitle{Eigen Values and Eigen Matrix}
       
   185 \begin{small}
       
   186 \begin{lstlisting}
       
   187   In []: linalg.eigvals(a)
       
   188   Out[]: array([1.61168440e+01, -1.11684397e+00, -1.22196337e-15])
       
   189 
       
   190   In []: linalg.eig(a)
       
   191   Out[]: 
       
   192   (array([ 1.61168440e+01, -1.11684397e+00, -1.22196337e-15]),
       
   193    matrix([[-0.23197069, -0.78583024,  0.40824829],
       
   194           [-0.52532209, -0.08675134, -0.81649658],
       
   195           [-0.8186735 ,  0.61232756,  0.40824829]]))
       
   196 \end{lstlisting}
       
   197 \end{small}
       
   198 \end{frame}
       
   199 
   127 \section{Solving linear equations}
   200 \section{Solving linear equations}
       
   201 
   128 \begin{frame}[fragile]
   202 \begin{frame}[fragile]
   129 \frametitle{Solution of equations}
   203 \frametitle{Solution of equations}
   130 Consider,
   204 Consider,
   131   \begin{align*}
   205   \begin{align*}
   132     3x + 2y - z  & = 1 \\
   206     3x + 2y - z  & = 1 \\
   168 matrix([[  1.00000000e+00],
   242 matrix([[  1.00000000e+00],
   169         [ -2.00000000e+00],
   243         [ -2.00000000e+00],
   170         [  2.22044605e-16]])
   244         [  2.22044605e-16]])
   171 \end{lstlisting}
   245 \end{lstlisting}
   172 \end{frame}
   246 \end{frame}
   173 
       
   174 \section{Matrices}
       
   175 \subsection{Initializing}
       
   176 \begin{frame}[fragile]
       
   177 \frametitle{Matrices: Initializing}
       
   178 \begin{lstlisting}
       
   179   In []: a = matrix([[1,2,3],
       
   180                      [4,5,6],
       
   181                      [7,8,9]])
       
   182 
       
   183   In []: a
       
   184   Out[]: 
       
   185   matrix([[1, 2, 3],
       
   186          [4, 5, 6],
       
   187          [7, 8, 9]])
       
   188 \end{lstlisting}
       
   189 \end{frame}
       
   190 
       
   191 \subsection{Basic Operations}
       
   192 \begin{frame}[fragile]
       
   193 \frametitle{Inverse of a Matrix}
       
   194 
       
   195 \begin{small}
       
   196 \begin{lstlisting}
       
   197 In []: linalg.inv(A)
       
   198 Out[]: 
       
   199 matrix([[ 0.07734807,  0.01657459,  0.32044199],
       
   200         [ 0.09944751, -0.12154696, -0.01657459],
       
   201         [-0.02762431, -0.07734807,  0.17127072]])
       
   202 
       
   203 \end{lstlisting}
       
   204 \end{small}
       
   205 \end{frame}
       
   206 
       
   207 \begin{frame}[fragile]
       
   208 \frametitle{Determinant}
       
   209 \begin{lstlisting}
       
   210   In []: linalg.det(a)
       
   211   Out[]: -9.5171266700777579e-16
       
   212 \end{lstlisting}
       
   213 \end{frame}
       
   214 
       
   215 \begin{frame}[fragile]
       
   216 \frametitle{Computing Norms}
       
   217 \begin{lstlisting}
       
   218   In []: linalg.norm(a)
       
   219   Out[]: 16.881943016134134
       
   220 \end{lstlisting}
       
   221 \end{frame}
       
   222 
       
   223 \begin{frame}[fragile]
       
   224 \frametitle{Eigen Values and Eigen Matrix}
       
   225 \begin{small}
       
   226 \begin{lstlisting}
       
   227   In []: linalg.eigvals(a)
       
   228   Out[]: array([1.61168440e+01, -1.11684397e+00, -1.22196337e-15])
       
   229 
       
   230   In []: linalg.eig(a)
       
   231   Out[]: 
       
   232   (array([ 1.61168440e+01, -1.11684397e+00, -1.22196337e-15]),
       
   233    matrix([[-0.23197069, -0.78583024,  0.40824829],
       
   234           [-0.52532209, -0.08675134, -0.81649658],
       
   235           [-0.8186735 ,  0.61232756,  0.40824829]]))
       
   236 \end{lstlisting}
       
   237 \end{small}
       
   238 \end{frame}
       
   239 
       
   240 
   247 
   241 \section{Integration}
   248 \section{Integration}
   242 
   249 
   243 \subsection{Quadrature}
   250 \subsection{Quadrature}
   244 
   251