diff options
-rw-r--r-- | matrices/script.rst | 193 | ||||
-rw-r--r-- | matrices/slides.org | 115 | ||||
-rw-r--r-- | matrices/slides.tex | 280 |
3 files changed, 278 insertions, 310 deletions
diff --git a/matrices/script.rst b/matrices/script.rst index 30a2856..a337605 100644 --- a/matrices/script.rst +++ b/matrices/script.rst @@ -31,36 +31,44 @@ Language Reviewer : Bhanukiran Checklist OK? : <11-11-2010, Anand, OK> [2010-10-05] -.. #[punch: please mark the exercises, using the syntax we decided upon.] ======== Matrices ======== -{{{ show the welcome slide }}} -Welcome to the spoken tutorial on Matrices. +{{{ Show the first slide containing title, name of the production +team along with the logo of MHRD }}} -{{{ switch to next slide, outline slide }}} +Hello friends and welcome to the tutorial on 'Matrices'. -In this tutorial we will learn about matrices, creating matrices using -direct data, converting a list and matrix operations. Finding -inverse of a matrix, determinant of a matrix, eigen values and eigen -vectors of a matrix, norm and singular value decomposition of -matrices. +{{{ switch to slide with objectives }}} -{{{ creating a matrix }}} +At the end of this tutorial, you will be able to, + + 1. Create matrices using data. + #. Create matrices from lists. + #. Do basic matrix operations like addition,multiplication. + #. Perform operations to find out the -- + - inverse of a matrix + - determinant of a matrix + - eigen values and eigen vectors of a matrix + - norm of a matrix + - singular value decomposition of a matrix. + +{{{ Switch to the pre-requisite slide }}} + +Before beginning this tutorial,we would suggest you to complete the +tutorial on "Getting started with lists", "Getting started with arrays", +"Accessing parts of arrays". All matrix operations are done using arrays. Thus all the operations on arrays are valid on matrices also. A matrix may be created as, :: + ipython -pylab m1 = array([1,2,3,4]) - -.. #[Puneeth: don't use ``matrix``. Use ``array``. The whole script will -.. have to be fixed.] - -Using the method ``shape`` we can find out the shape or size of the +Using the method ``shape``, we can find out the shape or size of the matrix, :: @@ -75,12 +83,12 @@ A list can be converted to a matrix as follows, l1 = [[1,2,3,4],[5,6,7,8]] m2 = array(l1) -{{{ switch to next slide, exercise 1}}} +Pause the video here, try out the following exercise and resume the video. -Pause here and create a two dimensional matrix m3 of order 2 by 4 with -elements 5, 6, 7, 8, 9, 10, 11, 12. +{{{ switch to slide, exercise 1}}} -{{{ switch to next slide, solution }}} +Create a two dimensional matrix m3 of order 2 by 4 with +elements 5, 6, 7, 8, 9, 10, 11, 12. m3 can be created as, :: @@ -89,22 +97,21 @@ m3 can be created as, {{{ switch to next slide, matrix operations }}} -We can do matrix addition and subtraction as, +We can do matrix addition and subtraction easily. :: m3 + m2 -does element by element addition, thus matrix addition. +m3+m2 does element by element addition, that is matrix addition. Similarly, :: m3 - m2 -it does matrix subtraction, that is element by element -subtraction. Now let us try, - -{{{ Switch to next slide, Matrix multiplication }}} +Similarly,m3-m2 does matrix subtraction, that is element by element +subtraction. +Now let us try,matrix multiplication :: m3 * m2 @@ -120,8 +127,6 @@ And matrix multiplication in matrices are done using the function ``dot()`` but due to size mismatch the multiplication could not be done and it returned an error, -{{{ switch to next slide, Matrix multiplication (cont'd) }}} - Now let us see an example for matrix multiplication. For doing matrix multiplication we need to have two matrices of the order n by m and m by r and the resulting matrix will be of the order n by r. Thus let us @@ -130,7 +135,7 @@ first create two matrices which are compatible for multiplication. m1.shape -matrix m1 is of the shape one by four, let us create another one of +matrix m1 is of the shape one by four, let us create another one, of the order four by two, :: @@ -141,15 +146,14 @@ thus the function ``dot()`` can be used for matrix multiplication. {{{ switch to next slide, recall from arrays }}} -As we already saw in arrays, the functions ``identity()`` which -creates an identity matrix of the order n by n, ``zeros()`` which -creates a matrix of the order m by n with all zeros, ``zeros_like()`` -which creates a matrix with zeros with the shape of the matrix passed, -``ones()`` which creates a matrix of order m by n with all ones, -``ones_like()`` which creates a matrix with ones with the shape of the -matrix passed. These functions can also be used with matrices. - -{{{ switch to next slide, more matrix operations }}} +As we already learnt in arrays, the function ``identity()`` which +creates an identity matrix of the order n by n, the function ``zeros()`` +which creates a matrix of the order m by n with all zeros, the function +``zeros_like()`` which creates a matrix with zeros with the shape of +the matrix passed, the function ``ones()`` which creates a matrix of +order m by n with all ones, the function ``ones_like()`` which creates a +matrix with ones with the shape of the matrix passed; all these +functions can also be used with matrices. To find out the transpose of a matrix we can do, :: @@ -161,8 +165,6 @@ Matrix name dot capital T will give the transpose of a matrix {{{ switch to next slide, Frobenius norm of inverse of matrix }}} -.. #[punch: arange has not been introduced.] - Now let us try to find out the Frobenius norm of inverse of a 4 by 4 matrix, the matrix being, :: @@ -170,23 +172,17 @@ matrix, the matrix being, m5 = arange(1,17).reshape(4,4) print m5 -The inverse of a matrix A, A raise to minus one is also called the -reciprocal matrix such that A multiplied by A inverse will give 1. The +The inverse of a matrix A, A raise to minus one, is also called the +reciprocal matrix, such that A multiplied by A inverse will give 1. The Frobenius norm of a matrix is defined as square root of sum of squares -of elements in the matrix. Pause here and try to solve the problem -yourself, the inverse of a matrix can be found using the function -``inv(A)``. +of elements in the matrix. The inverse of a matrix can be found using the +function ``inv(A)``. And here is the solution, first let us find the inverse of matrix m5. :: im5 = inv(m5) -.. #[punch: we don't need to show this way of calculating the norm, do -.. we? even if we do, we should show it in the "array style". -.. something like: -.. sqrt(sum(each * each))] - And the Frobenius norm of the matrix ``im5`` can be found out as, :: @@ -196,11 +192,10 @@ And the Frobenius norm of the matrix ``im5`` can be found out as, print sqrt(sum) {{{ switch to next slide, infinity norm }}} -.. #[punch: similarly for this section.] -Now try to find out the infinity norm of the matrix im5. The infinity -norm of a matrix is defined as the maximum value of sum of the -absolute of elements in each row. Pause here and try to solve the +Now let us move on to find out the infinity norm of the matrix im5. +The infinity norm of a matrix is defined as the maximum value of sum of +the absolute of elements in each row. Pause here and try to solve the problem yourself. @@ -229,42 +224,39 @@ And to find out the Infinity norm of the matrix im5, we do, norm(im5,ord=inf) -This is easier when compared to the code we wrote. Do ``norm`` -question mark to read up more about ord and the possible type of norms +This is easier when compared to the code we wrote. Read the documentation +of ``norm`` to read up more about ord and the possible type of norms the norm function produces. -{{{ switch to next slide, determinant }}} - Now let us find out the determinant of a the matrix m5. -The determinant of a square matrix can be obtained using the function +The determinant of a square matrix can be obtained by using the function ``det()`` and the determinant of m5 can be found out as, :: det(m5) +Hence we get the determinant. + {{{ switch to next slide, eigen vectors and eigen values }}} The eigen values and eigen vector of a square matrix can be computed using the function ``eig()`` and ``eigvals()``. Let us find out the eigen values and eigen vectors of the matrix -m5. We can do it as, +m5. We find them as, :: eig(m5) - -.. #[punch: has the tuple word been introduced?] - Note that it returned a tuple of two matrices. The first element in the tuple are the eigen values and the second element in the tuple are -the eigen vectors. Thus the eigen values are, +the eigen vectors. Thus the eigen values are given by, :: eig(m5)[0] -and the eigen vectors are, +and the eigen vectors are given by, :: eig(m5)[1] @@ -279,15 +271,15 @@ The eigen values can also be computed using the function ``eigvals()`` as, Now let us learn how to do the singular value decomposition or S V D of a matrix. -Suppose M is an m×n matrix whose entries come from the field K, which +Suppose M is an m×n matrix, whose entries come from the field K, which is either the field of real numbers or the field of complex numbers. Then there exists a factorization of the form M = U\Sigma V star where U is an (m by m) unitary matrix over K, the matrix \Sigma is an -(m by n) diagonal matrix with nonnegative real numbers on the -diagonal, and V*, an (n by n) unitary matrix over K, denotes the +(m by n) diagonal matrix with non-negative real numbers on the +diagonal, and V* is an (n by n) unitary matrix over K,which denotes the conjugate transpose of V. Such a factorization is called the singular-value decomposition of M. @@ -299,21 +291,62 @@ The SVD of matrix m5 can be found as Notice that it returned a tuple of 3 elements. The first one U the next one Sigma and the third one V star. -{{{ switch to next slide, recap slide }}} +{{{ switch to summary slide }}} -So this brings us to the end of this tutorial. In this tutorial, we -learned about matrices, creating matrices, matrix operations, inverse -of matrices, determinant, norm, eigen values and vectors and singular -value decomposition of matrices. +This brings us to the end of the end of this tutorial.In this tutorial, +we have learnt to, -{{{ switch to next slide, thank you }}} + 1. Create matrices using arrays. + #. Add,subtract and multiply the elements of matrix. + #. Find out the inverse of a matrix,using the function ``inv()``. + #. Use the function ``det()`` to find the determinant of a matrix. + #. Calculate the norm of a matrix using the for loop and also using + the function ``norm()``. + #. Find out the eigen vectors and eigen values of a matrix, using + functions ``eig()`` and ``eigvals()``. + #. Calculate singular value decomposition(SVD) of a matrix using the + function ``svd()``. +{{{Show self assessment questions slide}}} + +Here are some self assessment questions for you to solve + +1. A and B are two array objects. Element wise multiplication in + matrices are done by, + + - A * B + - ``multiply(A, B)`` + - ``dot(A, B)`` + - ``element_multiply(A,B)`` + +2. ``eig(A)[1]`` and ``eigvals(A)`` are the same. + + - True + - False + +3. ``norm(A,ord='fro')`` is the same as ``norm(A)`` ? + + - True + - False + +{{{solution of self assessment questions on slide}}} + +And the answers, + +1. Element wise multiplication between two matrices, A and B is done as, + A * B + +2. False. + ``eig(A)[0]`` and ``eigvals(A)`` are same, that is both will give the + eigen values of matrrix A. + +3. ``norm(A,ord='fro')`` and ``norm(A)`` are same, since the order='fro' + stands for frobenius norm. Hence true. + + +{{{ switch to Thank you slide }}} + +Hope you have enjoyed this tutorial and found it useful. Thank you! -.. - Local Variables: - mode: rst - indent-tabs-mode: nil - sentence-end-double-space: nil - fill-column: 70 - End: + diff --git a/matrices/slides.org b/matrices/slides.org index b7f56f2..4be93d2 100644 --- a/matrices/slides.org +++ b/matrices/slides.org @@ -18,9 +18,9 @@ #+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, #+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries} -#+TITLE: Matrices -#+AUTHOR: FOSSEE -#+EMAIL: +#+TITLE: +#+AUTHOR: FOSSEE +#+EMAIL: info@fossee.in #+DATE: #+DESCRIPTION: @@ -29,17 +29,40 @@ #+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t #+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc -* Outline - - Creating Matrices - - using direct data - - converting a list - - Matrix operations - - Inverse of matrix - - Determinant of matrix - - Eigen values and Eigen vectors of matrices - - Norm of matrix - - Singular Value Decomposition of matrices +* +#+begin_latex +\begin{center} +\vspace{12pt} +\textcolor{blue}{\huge Matrices} +\end{center} +\vspace{18pt} +\begin{center} +\vspace{10pt} +\includegraphics[scale=0.95]{../images/fossee-logo.png}\\ +\vspace{5pt} +\scriptsize Developed by FOSSEE Team, IIT-Bombay. \\ +\scriptsize Funded by National Mission on Education through ICT\\ +\scriptsize MHRD,Govt. of India\\ +\includegraphics[scale=0.30]{../images/iitb-logo.png}\\ +\end{center} +#+end_latex +* Objectives + At the end of this tutorial, you will be able to, + - Create matrices using data. + - Create matrices from lists. + - Do basic matrix operations like addition,multiplication. + - Perform operations to find out the -- + - inverse of a matrix + - determinant of a matrix + - eigen values and eigen vectors of a matrix + - norm of a matrix + - singular value decomposition of a matrix. +* Pre-requisite + Spoken tutorial on - + - Getting started with Lists. + - Getting started with Arrays. + - Accessing parts of Arrays. * Creating a matrix - Creating a matrix using direct data : In []: m1 = array([1, 2, 3, 4]) @@ -49,31 +72,13 @@ * Exercise 1 Create a (2, 4) matrix ~m3~ : m3 = [[5, 6, 7, 8], - : [9, 10, 11, 12]] -* Solution 1 - - m3 can be created as, - : In []: m3 = array([[5,6,7,8],[9,10,11,12]]) - + : [9, 10, 11, 12 * Matrix operations - Element-wise addition (both matrix should be of order ~mXn~) : In []: m3 + m2 - Element-wise subtraction (both matrix should be of order ~mXn~) : In []: m3 - m2 -* Matrix Multiplication - - Element-wise multiplication using ~m3 * m2~ - : In []: m3 * m2 - - Matrix Multiplication using ~dot(m3, m2)~ - : In []: dot(m3, m2) - : Out []: ValueError: objects are not aligned -* Matrix Multiplication (cont'd) - - Create two compatible matrices of order ~nXm~ and ~mXr~ - : In []: m1.shape - - matrix m1 is of order ~1 X 4~ - - Creating another matrix of order ~4 X 2~ - : In []: m4 = array([[1,2],[3,4],[5,6],[7,8]]) - - Matrix multiplication - : In []: dot(m1, m4) * Recall from ~array~ - The functions - ~identity(n)~ - @@ -87,12 +92,8 @@ - ~ones_like(A)~ creates a matrix with 1's similar to the shape of matrix ~A~ Can also be used with matrices - -* More matrix operations - Transpose of a matrix - : In []: m4.T * Exercise 2 : Frobenius norm \& inverse - Find out the Frobenius norm of inverse of a ~4 X 4~ matrix. + Find out the Frobenius norm of inverse of a ~4 X 4~ matrix. : The matrix is : m5 = arange(1,17).reshape(4,4) @@ -106,7 +107,6 @@ #+begin_latex $||A||_F = [\sum_{i,j} abs(a_{i,j})^2]^{1/2}$ #+end_latex - * Exercise 3 : Infinity norm Find the infinity norm of the matrix ~im5~ : @@ -119,11 +119,6 @@ : In []: norm(im5) - Infinity norm : In []: norm(im5, ord=inf) -* Determinant - Find out the determinant of the matrix m5 - : - - determinant can be found out using - - ~det(A)~ - returns the determinant of matrix ~A~ * eigen values \& eigen vectors Find out the eigen values and eigen vectors of the matrix ~m5~. : @@ -154,28 +149,30 @@ - SVD of matrix ~m5~ can be found out as, : In []: svd(m5) * Summary - - Matrices - - creating matrices - - Matrix operations - - Inverse (~inv()~) - - Determinant (~det()~) - - Norm (~norm()~) - - Eigen values \& vectors (~eig(), eigvals()~) - - Singular Value Decomposition (~svd()~) + In this tutorial, we have learnt to, -* Thank you! + - Create matrices using arrays. + - Add and multiply the elements of matrix. + - Find out the inverse of a matrix,using the function ``inv()``. + - Use the function ``det()`` to find the determinant of a matrix. + - Calculate the norm of a matrix using the for loop and also using + the function ``norm()``. + - Find out the eigen vectors and eigen values of a matrix, using + functions ``eig()`` and ``eigvals()``. + - Calculate singular value decomposition(SVD) of a matrix using the + function ``svd()``. + +* #+begin_latex \begin{block}{} \begin{center} - This spoken tutorial has been produced by the - \textcolor{blue}{FOSSEE} team, which is funded by the + \textcolor{blue}{\Large THANK YOU!} \end{center} + \end{block} +\begin{block}{} \begin{center} - \textcolor{blue}{National Mission on Education through \\ - Information \& Communication Technology \\ - MHRD, Govt. of India}. + For more Information, visit our website\\ + \url{http://fossee.in/} \end{center} \end{block} #+end_latex - - diff --git a/matrices/slides.tex b/matrices/slides.tex index e0e8acd..47ab0ad 100644 --- a/matrices/slides.tex +++ b/matrices/slides.tex @@ -1,4 +1,4 @@ -% Created 2010-11-07 Sun 16:18 +% Created 2011-06-06 Mon 13:56 \documentclass[presentation]{beamer} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} @@ -8,7 +8,6 @@ \usepackage{float} \usepackage{wrapfig} \usepackage{soul} -\usepackage{t1enc} \usepackage{textcomp} \usepackage{marvosym} \usepackage{wasysym} @@ -24,14 +23,14 @@ commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, showstringspaces=false, keywordstyle=\color{blue}\bfseries} \providecommand{\alert}[1]{\textbf{#1}} -\title{Matrices} +\title{} \author{FOSSEE} \date{} \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} \begin{document} -\maketitle + @@ -42,41 +41,71 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \begin{frame} -\frametitle{Outline} -\label{sec-1} -\begin{itemize} -\item Creating Matrices +\begin{center} +\vspace{12pt} +\textcolor{blue}{\huge Matrices} +\end{center} +\vspace{18pt} +\begin{center} +\vspace{10pt} +\includegraphics[scale=0.95]{../images/fossee-logo.png}\\ +\vspace{5pt} +\scriptsize Developed by FOSSEE Team, IIT-Bombay. \\ +\scriptsize Funded by National Mission on Education through ICT\\ +\scriptsize MHRD,Govt. of India\\ +\includegraphics[scale=0.30]{../images/iitb-logo.png}\\ +\end{center} +\end{frame} +\begin{frame} +\frametitle{Objectives} +\label{sec-2} + + At the end of this tutorial, you will be able to, + +\begin{itemize} +\item Create matrices using data. +\item Create matrices from lists. +\item Do basic matrix operations like addition,multiplication. +\item Perform operations to find out the -- \begin{itemize} -\item using direct data -\item converting a list +\item inverse of a matrix +\item determinant of a matrix +\item eigen values and eigen vectors of a matrix +\item norm of a matrix +\item singular value decomposition of a matrix. \end{itemize} +\end{itemize} +\end{frame} +\begin{frame} +\frametitle{Pre-requisite} +\label{sec-3} -\item Matrix operations -\item Inverse of matrix -\item Determinant of matrix -\item Eigen values and Eigen vectors of matrices -\item Norm of matrix -\item Singular Value Decomposition of matrices + Spoken tutorial on - + +\begin{itemize} +\item Getting started with Lists. +\item Getting started with Arrays. +\item Accessing parts of Arrays. \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Creating a matrix} -\label{sec-2} +\label{sec-4} + \begin{itemize} \item Creating a matrix using direct data \end{itemize} - \begin{verbatim} In []: m1 = array([1, 2, 3, 4]) \end{verbatim} + \begin{itemize} \item Creating a matrix using lists \end{itemize} - \begin{verbatim} In []: l1 = [[1,2,3,4],[5,6,7,8]] In []: m2 = array(l1) @@ -84,126 +113,59 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \end{frame} \begin{frame}[fragile] \frametitle{Exercise 1} -\label{sec-3} +\label{sec-5} - Create a (2, 4) matrix \texttt{m3} + Create a (2, 4) matrix \verb~m3~ \begin{verbatim} m3 = [[5, 6, 7, 8], - [9, 10, 11, 12]] -\end{verbatim} -\end{frame} -\begin{frame}[fragile] -\frametitle{Solution 1} -\label{sec-4} - -\begin{itemize} -\item m3 can be created as, -\end{itemize} - -\begin{verbatim} - In []: m3 = array([[5,6,7,8],[9,10,11,12]]) + [9, 10, 11, 12 \end{verbatim} \end{frame} \begin{frame}[fragile] \frametitle{Matrix operations} -\label{sec-5} +\label{sec-6} + \begin{itemize} -\item Element-wise addition (both matrix should be of order \texttt{mXn}) +\item Element-wise addition (both matrix should be of order \verb~mXn~) \begin{verbatim} In []: m3 + m2 \end{verbatim} -\item Element-wise subtraction (both matrix should be of order \texttt{mXn}) +\item Element-wise subtraction (both matrix should be of order \verb~mXn~) \begin{verbatim} In []: m3 - m2 \end{verbatim} \end{itemize} \end{frame} -\begin{frame}[fragile] -\frametitle{Matrix Multiplication} -\label{sec-6} - -\begin{itemize} -\item Element-wise multiplication using \texttt{m3 * m2} -\begin{verbatim} - In []: m3 * m2 -\end{verbatim} - -\item Matrix Multiplication using \texttt{dot(m3, m2)} -\begin{verbatim} - In []: dot(m3, m2) - Out []: ValueError: objects are not aligned -\end{verbatim} - -\end{itemize} -\end{frame} -\begin{frame}[fragile] -\frametitle{Matrix Multiplication (cont'd)} +\begin{frame} +\frametitle{Recall from \verb~array~} \label{sec-7} -\begin{itemize} -\item Create two compatible matrices of order \texttt{nXm} and \texttt{mXr} -\begin{verbatim} - In []: m1.shape -\end{verbatim} - - -\begin{itemize} -\item matrix m1 is of order \texttt{1 X 4} -\end{itemize} - -\item Creating another matrix of order \texttt{4 X 2} -\begin{verbatim} - In []: m4 = array([[1,2],[3,4],[5,6],[7,8]]) -\end{verbatim} - -\item Matrix multiplication -\begin{verbatim} - In []: dot(m1, m4) -\end{verbatim} - -\end{itemize} -\end{frame} -\begin{frame} -\frametitle{Recall from \texttt{array}} -\label{sec-8} \begin{itemize} \item The functions - \begin{itemize} -\item \texttt{identity(n)} - - creates an identity matrix of order \texttt{nXn} -\item \texttt{zeros((m,n))} - - creates a matrix of order \texttt{mXn} with 0's -\item \texttt{zeros\_like(A)} - - creates a matrix with 0's similar to the shape of matrix \texttt{A} -\item \texttt{ones((m,n))} - creates a matrix of order \texttt{mXn} with 1's -\item \texttt{ones\_like(A)} - creates a matrix with 1's similar to the shape of matrix \texttt{A} +\item \verb~identity(n)~ - + creates an identity matrix of order \verb~nXn~ +\item \verb~zeros((m,n))~ - + creates a matrix of order \verb~mXn~ with 0's +\item \verb~zeros_like(A)~ - + creates a matrix with 0's similar to the shape of matrix \verb~A~ +\item \verb~ones((m,n))~ + creates a matrix of order \verb~mXn~ with 1's +\item \verb~ones_like(A)~ + creates a matrix with 1's similar to the shape of matrix \verb~A~ \end{itemize} - \end{itemize} - Can also be used with matrices \end{frame} \begin{frame}[fragile] -\frametitle{More matrix operations} -\label{sec-9} - - Transpose of a matrix -\begin{verbatim} - In []: m4.T -\end{verbatim} -\end{frame} -\begin{frame}[fragile] \frametitle{Exercise 2 : Frobenius norm \& inverse} -\label{sec-10} +\label{sec-8} - Find out the Frobenius norm of inverse of a \texttt{4 X 4} matrix. + Find out the Frobenius norm of inverse of a \verb~4 X 4~ matrix. \begin{verbatim} \end{verbatim} @@ -213,38 +175,37 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} m5 = arange(1,17).reshape(4,4) \end{verbatim} + \begin{itemize} \item Inverse of A, - \begin{itemize} \item $A^{-1} = inv(A)$ \end{itemize} - \item Frobenius norm is defined as, - \begin{itemize} \item $||A||_F = [\sum_{i,j} abs(a_{i,j})^2]^{1/2}$ \end{itemize} - \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Exercise 3 : Infinity norm} -\label{sec-11} +\label{sec-9} - Find the infinity norm of the matrix \texttt{im5} + Find the infinity norm of the matrix \verb~im5~ \begin{verbatim} \end{verbatim} + \begin{itemize} \item Infinity norm is defined as, $max([\sum_{i} abs(a_{i})^2])$ \end{itemize} \end{frame} \begin{frame}[fragile] -\frametitle{\texttt{norm()} method} -\label{sec-12} +\frametitle{\verb~norm()~ method} +\label{sec-10} + \begin{itemize} \item Frobenius norm @@ -260,32 +221,15 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \end{itemize} \end{frame} \begin{frame}[fragile] -\frametitle{Determinant} -\label{sec-13} - - Find out the determinant of the matrix m5 -\begin{verbatim} - -\end{verbatim} - -\begin{itemize} -\item determinant can be found out using - -\begin{itemize} -\item \texttt{det(A)} - returns the determinant of matrix \texttt{A} -\end{itemize} - -\end{itemize} -\end{frame} -\begin{frame}[fragile] \frametitle{eigen values \& eigen vectors} -\label{sec-14} +\label{sec-11} - Find out the eigen values and eigen vectors of the matrix \texttt{m5}. + Find out the eigen values and eigen vectors of the matrix \verb~m5~. \begin{verbatim} \end{verbatim} + \begin{itemize} \item eigen values and vectors can be found out using \begin{verbatim} @@ -294,18 +238,14 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} returns a tuple of \emph{eigen values} and \emph{eigen vectors} \item \emph{eigen values} in tuple - \begin{itemize} -\item \texttt{In []: eig(m5)[0]} +\item \verb~In []: eig(m5)[0]~ \end{itemize} - \item \emph{eigen vectors} in tuple - \begin{itemize} -\item \texttt{In []: eig(m5)[1]} +\item \verb~In []: eig(m5)[1]~ \end{itemize} - -\item Computing \emph{eigen values} using \texttt{eigvals()} +\item Computing \emph{eigen values} using \verb~eigvals()~ \begin{verbatim} In []: eigvals(m5) \end{verbatim} @@ -313,59 +253,57 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \end{itemize} \end{frame} \begin{frame}[fragile] -\frametitle{Singular Value Decomposition (\texttt{svd})} -\label{sec-15} +\frametitle{Singular Value Decomposition (\verb~svd~)} +\label{sec-12} $M = U \Sigma V^*$ + \begin{itemize} -\item U, an \texttt{mXm} unitary matrix over K. +\item U, an \verb~mXm~ unitary matrix over K. \item $\Sigma$ - , an \texttt{mXn} diagonal matrix with non-negative real numbers on diagonal. + , an \verb~mXn~ diagonal matrix with non-negative real numbers on diagonal. \item $V^*$ - , an \texttt{nXn} unitary matrix over K, denotes the conjugate transpose of V. -\item SVD of matrix \texttt{m5} can be found out as, + , an \verb~nXn~ unitary matrix over K, denotes the conjugate transpose of V. +\item SVD of matrix \verb~m5~ can be found out as, \end{itemize} - \begin{verbatim} In []: svd(m5) \end{verbatim} \end{frame} \begin{frame} \frametitle{Summary} -\label{sec-16} +\label{sec-13} -\begin{itemize} -\item Matrices + In this tutorial, we have learnt to, -\begin{itemize} -\item creating matrices -\end{itemize} -\item Matrix operations -\item Inverse (\texttt{inv()}) -\item Determinant (\texttt{det()}) -\item Norm (\texttt{norm()}) -\item Eigen values \& vectors (\texttt{eig(), eigvals()}) -\item Singular Value Decomposition (\texttt{svd()}) +\begin{itemize} +\item Create matrices using arrays. +\item Add and multiply the elements of matrix. +\item Find out the inverse of a matrix,using the function ``inv()``. +\item Use the function ``det()`` to find the determinant of a matrix. +\item Calculate the norm of a matrix using the for loop and also using + the function ``norm()``. +\item Find out the eigen vectors and eigen values of a matrix, using + functions ``eig()`` and ``eigvals()``. +\item Calculate singular value decomposition(SVD) of a matrix using the + function ``svd()``. \end{itemize} + \end{frame} \begin{frame} -\frametitle{Thank you!} -\label{sec-17} \begin{block}{} \begin{center} - This spoken tutorial has been produced by the - \textcolor{blue}{FOSSEE} team, which is funded by the + \textcolor{blue}{\Large THANK YOU!} \end{center} + \end{block} +\begin{block}{} \begin{center} - \textcolor{blue}{National Mission on Education through \\ - Information \& Communication Technology \\ - MHRD, Govt. of India}. + For more Information, visit our website\\ + \url{http://fossee.in/} \end{center} \end{block} - - \end{frame} -\end{document} +\end{document}
\ No newline at end of file |