day1/session4.tex
author Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
Sun, 20 Jun 2010 18:23:34 -0400
branchscipy2010
changeset 410 ec4b97af33e1
parent 389 aa392117454f
permissions -rw-r--r--
Updating session4, adding example for computation of norm and SVD.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     2
%Tutorial slides on Python.
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     3
%
141
fccf675946bf Made usage of FOSSEE consistent; removed all instances of Team, Group.
Puneeth Chaganti <punchagan@fossee.in>
parents: 131
diff changeset
     4
% Author: FOSSEE 
fccf675946bf Made usage of FOSSEE consistent; removed all instances of Team, Group.
Puneeth Chaganti <punchagan@fossee.in>
parents: 131
diff changeset
     5
% Copyright (c) 2009, FOSSEE, IIT Bombay
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     7
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     8
\documentclass[14pt,compress]{beamer}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
     9
%\documentclass[draft]{beamer}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    10
%\documentclass[compress,handout]{beamer}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    11
%\usepackage{pgfpages} 
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    12
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    13
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    14
% Modified from: generic-ornate-15min-45min.de.tex
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    15
\mode<presentation>
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    16
{
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    17
  \usetheme{Warsaw}
239
8953675dc056 Added slide numbers.
Puneeth Chaganti <punchagan@fossee.in>
parents: 235
diff changeset
    18
  \useoutertheme{infolines}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    19
  \setbeamercovered{transparent}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    20
}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    21
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    22
\usepackage[english]{babel}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    23
\usepackage[latin1]{inputenc}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    24
%\usepackage{times}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    25
\usepackage[T1]{fontenc}
123
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
    26
\usepackage{amsmath}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    27
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    28
% Taken from Fernando's slides.
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    29
\usepackage{ae,aecompl}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    30
\usepackage{mathpazo,courier,euler}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    31
\usepackage[scaled=.95]{helvet}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    32
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    33
\definecolor{darkgreen}{rgb}{0,0.5,0}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    34
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    35
\usepackage{listings}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    36
\lstset{language=Python,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    37
    basicstyle=\ttfamily\bfseries,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    38
    commentstyle=\color{red}\itshape,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    39
  stringstyle=\color{darkgreen},
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    40
  showstringspaces=false,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    41
  keywordstyle=\color{blue}\bfseries}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    42
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    43
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    44
% Macros
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    45
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    46
\newcommand{\emphbar}[1]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    47
{\begin{beamercolorbox}[rounded=true]{emphbar} 
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    48
      {#1}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    49
 \end{beamercolorbox}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    50
}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    51
\newcounter{time}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    52
\setcounter{time}{0}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    53
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    54
127
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
    55
\newcommand{\typ}[1]{\lstinline{#1}}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    56
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    57
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    58
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    59
%%% This is from Fernando's setup.
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    60
% \usepackage{color}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    61
% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    62
% % Use and configure listings package for nicely formatted code
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    63
% \usepackage{listings}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    64
% \lstset{
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    65
%    language=Python,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    66
%    basicstyle=\small\ttfamily,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    67
%    commentstyle=\ttfamily\color{blue},
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    68
%    stringstyle=\ttfamily\color{orange},
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    69
%    showstringspaces=false,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    70
%    breaklines=true,
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    71
%    postbreak = \space\dots
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    72
% }
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    73
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    74
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    75
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    76
% Title page
410
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
    77
\title[Matrices \& Curve Fitting]{Python for Science and Engg: Matrices
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
    78
\& Least Squares Fit}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    79
141
fccf675946bf Made usage of FOSSEE consistent; removed all instances of Team, Group.
Puneeth Chaganti <punchagan@fossee.in>
parents: 131
diff changeset
    80
\author[FOSSEE] {FOSSEE}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    81
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    82
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
410
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
    83
\date[] {SciPy 2010, Introductory tutorials\\Day 1, Session 4}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    84
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    85
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    86
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    87
%\logo{\pgfuseimage{iitmlogo}}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    88
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    89
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    90
%% Delete this, if you do not want the table of contents to pop up at
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    91
%% the beginning of each subsection:
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    92
\AtBeginSubsection[]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    93
{
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    94
  \begin{frame}<beamer>
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    95
    \frametitle{Outline}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    96
    \tableofcontents[currentsection,currentsubsection]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    97
  \end{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    98
}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
    99
213
ce62706cf870 Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 203
diff changeset
   100
\AtBeginSection[]
ce62706cf870 Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 203
diff changeset
   101
{
ce62706cf870 Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 203
diff changeset
   102
  \begin{frame}<beamer>
ce62706cf870 Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 203
diff changeset
   103
    \frametitle{Outline}
ce62706cf870 Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 203
diff changeset
   104
    \tableofcontents[currentsection,currentsubsection]
ce62706cf870 Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 203
diff changeset
   105
  \end{frame}
ce62706cf870 Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 203
diff changeset
   106
}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   107
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   108
% If you wish to uncover everything in a step-wise fashion, uncomment
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   109
% the following command: 
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   110
%\beamerdefaultoverlayspecification{<+->}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   111
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   112
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   113
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   114
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   115
% DOCUMENT STARTS
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   116
\begin{document}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   117
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   118
\begin{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   119
  \titlepage
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   120
\end{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   121
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   122
\begin{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   123
  \frametitle{Outline}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   124
  \tableofcontents
123
d2f4053a2e85 Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents: 118
diff changeset
   125
%  \pausesections
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   126
\end{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   127
197
8c42ffdaaeec Updated session 4 slides based on review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 185
diff changeset
   128
\section{Matrices}
8c42ffdaaeec Updated session 4 slides based on review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 185
diff changeset
   129
8c42ffdaaeec Updated session 4 slides based on review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 185
diff changeset
   130
\begin{frame}
8c42ffdaaeec Updated session 4 slides based on review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 185
diff changeset
   131
\frametitle{Matrices: Introduction}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   132
\alert{All matrix operations are done using \kwrd{arrays}}
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 178
diff changeset
   133
\end{frame}
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 178
diff changeset
   134
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   135
\begin{frame}[fragile]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   136
\frametitle{Matrices: Initializing}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   137
\begin{lstlisting}
384
9f9fddf7e37c MNIT Jaipur changes.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 382
diff changeset
   138
In []: c = array([[11,12,13],
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   139
                  [21,22,23],
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   140
                  [31,32,33]])
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   141
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   142
In []: c
235
8eab0fee0fc2 Updated session 4 day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 233
diff changeset
   143
Out[]: 
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   144
array([[11, 12, 13],
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   145
       [21, 22, 23],
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   146
       [31, 32, 33]])
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   147
\end{lstlisting}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   148
\end{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   149
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 253
diff changeset
   150
\begin{frame}[fragile]
293
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   151
\frametitle{Initializing some special matrices}
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   152
\begin{small}
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   153
  \begin{lstlisting}
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   154
In []: ones((3,5))
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   155
Out[]: 
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   156
array([[ 1.,  1.,  1.,  1.,  1.],
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   157
       [ 1.,  1.,  1.,  1.,  1.],
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   158
       [ 1.,  1.,  1.,  1.,  1.]])
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   159
319
cef948318842 Minor edits to sessions 2, 4, 6 on day1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 318
diff changeset
   160
In []: ones_like([1, 2, 3, 4]) 
cef948318842 Minor edits to sessions 2, 4, 6 on day1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 318
diff changeset
   161
Out[]: array([1, 1, 1, 1])   
293
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   162
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   163
In []: identity(2)
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   164
Out[]: 
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   165
array([[ 1.,  0.],
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   166
       [ 0.,  1.]])
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   167
  \end{lstlisting}
410
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   168
Also available \alert{\typ{zeros, zeros_like, empty, empty_like}}
293
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   169
\end{small}
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   170
\end{frame}
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   171
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   172
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   173
\begin{frame}[fragile]
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   174
  \frametitle{Accessing elements}
382
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   175
  \begin{small}
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 253
diff changeset
   176
  \begin{lstlisting}
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   177
In []: c
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   178
Out[]: 
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   179
array([[11, 12, 13],
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   180
       [21, 22, 23],
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   181
       [31, 32, 33]])
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   182
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   183
In []: c[1][2]
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   184
Out[]: 23
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   185
In []: c[1,2]
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   186
Out[]: 23
382
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   187
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   188
In []: c[1]
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   189
Out[]: array([21, 22, 23])
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   190
  \end{lstlisting}
382
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   191
  \end{small}
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   192
\end{frame}
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 253
diff changeset
   193
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   194
\begin{frame}[fragile]
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   195
  \frametitle{Changing elements}
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   196
  \begin{small}
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   197
  \begin{lstlisting}
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   198
In []: c[1,1] = -22
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   199
In []: c
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 253
diff changeset
   200
Out[]: 
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   201
array([[ 11,  12,  13],
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   202
       [ 21, -22,  23],
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   203
       [ 31,  32,  33]])
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   204
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   205
In []: c[1] = 0
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   206
In []: c
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   207
Out[]: 
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   208
array([[11, 12, 13],
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   209
       [ 0,  0,  0],
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   210
       [31, 32, 33]])
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   211
  \end{lstlisting}
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   212
  \end{small}
410
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   213
How do you access one \alert{column}?
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   214
\end{frame}
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   215
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   216
\begin{frame}[fragile]
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   217
  \frametitle{Slicing}
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   218
\begin{small}
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   219
  \begin{lstlisting}
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   220
In []: c[:,1]
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   221
Out[]: array([12,  0, 32])
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   222
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   223
In []: c[1,:]
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   224
Out[]: array([0, 0, 0])
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   225
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   226
In []: c[0:2,:]
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   227
Out[]: 
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   228
array([[11, 12, 13],
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   229
       [ 0,  0,  0]])
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   230
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   231
In []: c[1:3,:]
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   232
Out[]: 
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   233
array([[ 0,  0,  0],
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   234
       [31, 32, 33]])
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 253
diff changeset
   235
  \end{lstlisting}
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 253
diff changeset
   236
\end{small}
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 253
diff changeset
   237
\end{frame}
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 253
diff changeset
   238
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   239
\begin{frame}[fragile]
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   240
  \frametitle{Slicing \ldots}
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   241
\begin{small}
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   242
  \begin{lstlisting}
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   243
In []: c[:2,:]
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   244
Out[]: 
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   245
array([[11, 12, 13],
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   246
       [ 0,  0,  0]])
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   247
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   248
In []: c[1:,:]
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   249
Out[]: 
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   250
array([[ 0,  0,  0],
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   251
       [31, 32, 33]])
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   252
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   253
In []: c[1:,:2]
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   254
Out[]: 
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   255
array([[ 0,  0],
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   256
       [31, 32]])
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   257
  \end{lstlisting}
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   258
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   259
\end{small}
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   260
\end{frame}
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   261
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   262
\begin{frame}[fragile]
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   263
  \frametitle{Striding}
279
e7ce6f9d7e15 Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 278
diff changeset
   264
  \begin{small}
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   265
  \begin{lstlisting}
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   266
In []: c[::2,:]
279
e7ce6f9d7e15 Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 278
diff changeset
   267
Out[]: 
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   268
array([[11, 12, 13],
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   269
       [31, 32, 33]])
279
e7ce6f9d7e15 Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 278
diff changeset
   270
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   271
In []: c[:,::2]
279
e7ce6f9d7e15 Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 278
diff changeset
   272
Out[]: 
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   273
array([[11, 13],
279
e7ce6f9d7e15 Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 278
diff changeset
   274
       [ 0,  0],
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   275
       [31, 33]])
279
e7ce6f9d7e15 Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 278
diff changeset
   276
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   277
In []: c[::2,::2]
279
e7ce6f9d7e15 Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 278
diff changeset
   278
Out[]: 
361
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   279
array([[11, 13],
a1ee950f3d6d Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 354
diff changeset
   280
       [31, 33]])
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   281
  \end{lstlisting}
279
e7ce6f9d7e15 Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 278
diff changeset
   282
  \end{small}
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   283
\end{frame}
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   284
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   285
\begin{frame}[fragile]
373
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   286
  \frametitle{Shape of a matrix}
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   287
  \begin{lstlisting}
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   288
In []: c
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   289
Out[]: 
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   290
array([[11, 12, 13],
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   291
       [ 0,  0,  0],
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   292
       [31, 32, 33]])
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   293
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   294
In []: c.shape
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   295
Out[]: (3, 3)
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   296
  \end{lstlisting}
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   297
\emphbar{Shape specifies shape or dimensions of a matrix}
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   298
\end{frame}
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   299
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   300
\begin{frame}[fragile]
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   301
  \frametitle{Elementary image processing}
282
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   302
\begin{small}
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   303
  \begin{lstlisting}
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   304
In []: a = imread('lena.png')
282
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   305
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   306
In []: imshow(a)
282
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   307
Out[]: <matplotlib.image.AxesImage object at 0xa0384cc>
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   308
  \end{lstlisting}
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   309
  \end{small}
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   310
\typ{imread} returns an array of shape (512, 512, 4) which represents an image of 512x512 pixels and 4 shades.\\
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   311
\typ{imshow} renders the array as an image.
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   312
\end{frame}
282
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   313
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   314
\begin{frame}[fragile]
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   315
\frametitle{Slicing \& Striding Exercises}
282
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   316
  \begin{itemize}
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   317
  \item Crop the image to get the top-left quarter
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   318
  \item Crop the image to get only the face
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   319
  \item Resize image to half by dropping alternate pixels
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   320
  \end{itemize}
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   321
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   322
\end{frame}
282
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   323
\begin{frame}[fragile]
285
e072cadee389 Minor edits to session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 282
diff changeset
   324
  \frametitle{Solutions}
282
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   325
\begin{small}
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   326
  \begin{lstlisting}
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   327
In []: imshow(a[:256,:256])
282
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   328
Out[]: <matplotlib.image.AxesImage object at 0xb6f658c>
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   329
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   330
In []: imshow(a[200:400,200:400])
282
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   331
Out[]: <matplotlib.image.AxesImage object at 0xb757c2c>
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   332
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   333
In []: imshow(a[::2,::2])
282
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   334
Out[]: <matplotlib.image.AxesImage object at 0xb765c8c>
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   335
  \end{lstlisting}
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   336
\end{small}
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   337
\end{frame}
214
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   338
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   339
\begin{frame}[fragile]
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   340
\frametitle{Transpose of a Matrix}
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   341
\begin{lstlisting}
330
46533051b9d3 commited changes made for scipy and cheatsheats.
Shantanu <shantanu@fossee.in>
parents: 319
diff changeset
   342
In []: a = array([[ 1,  1,  2, -1],
46533051b9d3 commited changes made for scipy and cheatsheats.
Shantanu <shantanu@fossee.in>
parents: 319
diff changeset
   343
  ...:            [ 2,  5, -1, -9],
46533051b9d3 commited changes made for scipy and cheatsheats.
Shantanu <shantanu@fossee.in>
parents: 319
diff changeset
   344
  ...:            [ 2,  1, -1,  3],
46533051b9d3 commited changes made for scipy and cheatsheats.
Shantanu <shantanu@fossee.in>
parents: 319
diff changeset
   345
  ...:            [ 1, -3,  2,  7]])
46533051b9d3 commited changes made for scipy and cheatsheats.
Shantanu <shantanu@fossee.in>
parents: 319
diff changeset
   346
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   347
In []: a.T
235
8eab0fee0fc2 Updated session 4 day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 233
diff changeset
   348
Out[]:
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   349
array([[ 1,  2,  2,  1],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   350
       [ 1,  5,  1, -3],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   351
       [ 2, -1, -1,  2],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   352
       [-1, -9,  3,  7]])
214
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   353
\end{lstlisting}
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   354
\end{frame}
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   355
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   356
\begin{frame}[fragile]
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   357
  \frametitle{Matrix Addition}
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   358
  \begin{lstlisting}
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   359
In []: b = array([[3,2,-1,5],
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   360
                  [2,-2,4,9],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   361
                  [-1,0.5,-1,-7],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   362
                  [9,-5,7,3]])
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   363
In []: a + b
214
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   364
Out[]: 
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   365
array([[  4. ,   3. ,   1. ,   4. ],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   366
       [  4. ,   3. ,   3. ,   0. ],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   367
       [  1. ,   1.5,  -2. ,  -4. ],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   368
       [ 10. ,  -8. ,   9. ,  10. ]])
214
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   369
  \end{lstlisting}
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   370
\end{frame}
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   371
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   372
\begin{frame}[fragile]
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   373
\frametitle{Elementwise Multiplication}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   374
\begin{lstlisting}
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   375
In []: a*b
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   376
Out[]: 
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   377
array([[  3. ,   2. ,  -2. ,  -5. ],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   378
       [  4. , -10. ,  -4. , -81. ],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   379
       [ -2. ,   0.5,   1. , -21. ],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   380
       [  9. ,  15. ,  14. ,  21. ]])
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   381
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   382
\end{lstlisting}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   383
\end{frame}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   384
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   385
\begin{frame}[fragile]
214
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   386
\frametitle{Matrix Multiplication}
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   387
\begin{lstlisting}
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   388
In []: dot(a, b)
214
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   389
Out[]: 
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   390
array([[ -6. ,   6. ,  -6. ,  -3. ],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   391
       [-64. ,  38.5, -44. ,  35. ],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   392
       [ 36. , -13.5,  24. ,  35. ],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   393
       [ 58. , -26. ,  34. , -15. ]])
214
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   394
\end{lstlisting}
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   395
\end{frame}
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   396
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   397
\begin{frame}[fragile]
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   398
\frametitle{Inverse of a Matrix}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   399
\begin{lstlisting}
382
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   400
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   401
\end{lstlisting}
131
b3a78754c4a9 Minor edits to day1 session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 127
diff changeset
   402
\begin{small}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   403
\begin{lstlisting}
382
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   404
In []: inv(a)
179
eea01ca072ff Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 178
diff changeset
   405
Out[]: 
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   406
array([[-0.5 ,  0.55, -0.15,  0.7 ],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   407
       [ 0.75, -0.5 ,  0.5 , -0.75],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   408
       [ 0.5 , -0.15, -0.05, -0.1 ],
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   409
       [ 0.25, -0.25,  0.25, -0.25]])
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   410
\end{lstlisting}
131
b3a78754c4a9 Minor edits to day1 session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 127
diff changeset
   411
\end{small}
382
41c34770d63a Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 379
diff changeset
   412
\emphbar{Try this: \typ{I = dot(a, inv(a))}}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   413
\end{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   414
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   415
\begin{frame}[fragile]
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   416
\frametitle{Determinant and sum of all elements}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   417
\begin{lstlisting}
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   418
In []: det(a)
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   419
Out[]: 80.0
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   420
\end{lstlisting}
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   421
  \begin{lstlisting}
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   422
In []: sum(a)
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   423
Out[]: 12
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   424
  \end{lstlisting}
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   425
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   426
\end{frame}
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   427
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 253
diff changeset
   428
%%use S=array(X,Y)
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   429
\begin{frame}[fragile]
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   430
\frametitle{Eigenvalues and Eigen Vectors}
131
b3a78754c4a9 Minor edits to day1 session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 127
diff changeset
   431
\begin{small}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   432
\begin{lstlisting}
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   433
In []: e = array([[3,2,4],[2,0,2],[4,2,3]])
253
e446ed7287d7 Updated session 2 and session 4 slides of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 240
diff changeset
   434
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   435
In []: eig(e)
214
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   436
Out[]: 
253
e446ed7287d7 Updated session 2 and session 4 slides of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 240
diff changeset
   437
(array([-1.,  8., -1.]),
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   438
 array([[-0.74535599,  0.66666667, -0.1931126 ],
253
e446ed7287d7 Updated session 2 and session 4 slides of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 240
diff changeset
   439
        [ 0.2981424 ,  0.33333333, -0.78664085],
e446ed7287d7 Updated session 2 and session 4 slides of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 240
diff changeset
   440
        [ 0.59628479,  0.66666667,  0.58643303]]))
e446ed7287d7 Updated session 2 and session 4 slides of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 240
diff changeset
   441
318
e75d3c993ed5 Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents: 304
diff changeset
   442
In []: eigvals(e)
253
e446ed7287d7 Updated session 2 and session 4 slides of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 240
diff changeset
   443
Out[]: array([-1.,  8., -1.])
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   444
\end{lstlisting}
131
b3a78754c4a9 Minor edits to day1 session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 127
diff changeset
   445
\end{small}
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   446
\end{frame}
127
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   447
410
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   448
\begin{frame}[fragile]
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   449
\frametitle{Computing Norms}
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   450
\begin{lstlisting}
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   451
In []: norm(e)
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   452
Out[]: 8.1240384046359608
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   453
\end{lstlisting}
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   454
\end{frame}
214
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   455
410
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   456
\begin{frame}[fragile]
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   457
  \frametitle{Singular Value Decomposition}
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   458
  \begin{small}
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   459
  \begin{lstlisting}
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   460
In []: svd(e)
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   461
Out[]: 
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   462
(array(
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   463
[[ -6.66666667e-01,  -1.23702565e-16,   7.45355992e-01],
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   464
 [ -3.33333333e-01,  -8.94427191e-01,  -2.98142397e-01],
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   465
 [ -6.66666667e-01,   4.47213595e-01,  -5.96284794e-01]]),
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   466
 array([ 8.,  1.,  1.]),
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   467
 array([[-0.66666667, -0.33333333, -0.66666667],
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   468
        [-0.        ,  0.89442719, -0.4472136 ],
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   469
        [-0.74535599,  0.2981424 ,  0.59628479]]))
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   470
  \end{lstlisting}
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   471
  \end{small}
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   472
\end{frame}
214
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   473
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   474
\section{Least Squares Fit}
214
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   475
\begin{frame}[fragile]
293
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   476
\frametitle{$L$ vs. $T^2$ - Scatter}
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   477
Linear trend visible.
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   478
\vspace{-0.1in}
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   479
\begin{figure}
282
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   480
\includegraphics[width=4in]{data/L-Tsq-points}
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   481
\end{figure}
178
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 172
diff changeset
   482
\end{frame}
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 172
diff changeset
   483
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 172
diff changeset
   484
\begin{frame}[fragile]
293
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   485
\frametitle{$L$ vs. $T^2$ - Line}
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   486
This line does not make any mathematical sense.
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   487
\vspace{-0.1in}
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   488
\begin{figure}
282
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   489
\includegraphics[width=4in]{data/L-Tsq-Line}
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   490
\end{figure}
232
b9748af050c4 Updated the session 4, day 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 214
diff changeset
   491
\end{frame}
127
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   492
232
b9748af050c4 Updated the session 4, day 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 214
diff changeset
   493
\begin{frame}[fragile]
293
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   494
\frametitle{$L$ vs. $T^2$ - Least Square Fit}
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   495
This is what our intention is.
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   496
\vspace{-0.1in}
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   497
\begin{figure}
282
b2dafce03b8d Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents: 281
diff changeset
   498
\includegraphics[width=4in]{data/least-sq-fit}
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   499
\end{figure}
232
b9748af050c4 Updated the session 4, day 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 214
diff changeset
   500
\end{frame}
b9748af050c4 Updated the session 4, day 1 slides.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 214
diff changeset
   501
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   502
\begin{frame}[fragile]
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   503
\frametitle{Matrix Formulation}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   504
\begin{itemize}
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   505
\item We need to fit a line through points for the equation $T^2 = m \cdot L+c$
337
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   506
\item In matrix form, the equation can be represented as $T_{sq} = A \cdot p$, where $T_{sq}$ is
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   507
  $\begin{bmatrix}
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   508
  T^2_1 \\
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   509
  T^2_2 \\
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   510
  \vdots\\
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   511
  T^2_N \\
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   512
  \end{bmatrix}$
56aa2efbf7d9 Changes at scipy.in
Puneeth Chaganti <punchagan@fossee.in>
parents: 330
diff changeset
   513
, A is   
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   514
  $\begin{bmatrix}
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   515
  L_1 & 1 \\
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   516
  L_2 & 1 \\
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   517
  \vdots & \vdots\\
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   518
  L_N & 1 \\
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   519
  \end{bmatrix}$
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   520
  and p is 
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   521
  $\begin{bmatrix}
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   522
  m\\
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   523
  c\\
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   524
  \end{bmatrix}$
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   525
\item We need to find $p$ to plot the line
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   526
\end{itemize}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   527
\end{frame}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   528
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   529
\begin{frame}[fragile]
304
c53251e506cc Updated session 4 of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 293
diff changeset
   530
\frametitle{Getting $L$ and $T^2$}
373
f04eca8b2f3d Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 366
diff changeset
   531
%If you \alert{closed} IPython after session 2
304
c53251e506cc Updated session 4 of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 293
diff changeset
   532
\begin{lstlisting}
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   533
In []: L = []
304
c53251e506cc Updated session 4 of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 293
diff changeset
   534
In []: t = []
c53251e506cc Updated session 4 of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 293
diff changeset
   535
In []: for line in open('pendulum.txt'):
c53251e506cc Updated session 4 of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 293
diff changeset
   536
  ....     point = line.split()
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   537
  ....     L.append(float(point[0]))
304
c53251e506cc Updated session 4 of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 293
diff changeset
   538
  ....     t.append(float(point[1]))
c53251e506cc Updated session 4 of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 293
diff changeset
   539
  ....
c53251e506cc Updated session 4 of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 293
diff changeset
   540
  ....
c53251e506cc Updated session 4 of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 293
diff changeset
   541
\end{lstlisting}
c53251e506cc Updated session 4 of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 293
diff changeset
   542
\end{frame}
319
cef948318842 Minor edits to sessions 2, 4, 6 on day1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 318
diff changeset
   543
cef948318842 Minor edits to sessions 2, 4, 6 on day1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 318
diff changeset
   544
\begin{frame}[fragile]
cef948318842 Minor edits to sessions 2, 4, 6 on day1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 318
diff changeset
   545
\frametitle{Getting $L$ and $T^2$ \dots}
cef948318842 Minor edits to sessions 2, 4, 6 on day1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 318
diff changeset
   546
\begin{lstlisting}
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   547
In []: L = array(L)
319
cef948318842 Minor edits to sessions 2, 4, 6 on day1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 318
diff changeset
   548
In []: t = array(t)
cef948318842 Minor edits to sessions 2, 4, 6 on day1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 318
diff changeset
   549
\end{lstlisting}
cef948318842 Minor edits to sessions 2, 4, 6 on day1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 318
diff changeset
   550
\alert{\typ{In []: tsq = t*t}}
cef948318842 Minor edits to sessions 2, 4, 6 on day1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 318
diff changeset
   551
\end{frame}
304
c53251e506cc Updated session 4 of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 293
diff changeset
   552
 
c53251e506cc Updated session 4 of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 293
diff changeset
   553
\begin{frame}[fragile]
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   554
\frametitle{Generating $A$}
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   555
\begin{lstlisting}
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   556
In []: A = array([L, ones_like(L)])
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   557
In []: A = A.T
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   558
\end{lstlisting}
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   559
%% \begin{itemize}
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   560
%% \item A is also called a Van der Monde matrix
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   561
%% \item It can also be generated using \typ{vander}
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   562
%% \end{itemize}
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   563
%% \begin{lstlisting}
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   564
%% In []: A = vander(L, 2)
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   565
%% \end{lstlisting}
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   566
\end{frame}
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   567
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   568
\begin{frame}[fragile]
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   569
\frametitle{\typ{lstsq} \ldots}
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   570
\begin{itemize}
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   571
\item Now use the \typ{lstsq} function
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   572
\item Along with a lot of things, it returns the least squares solution
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   573
\end{itemize}
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   574
\begin{lstlisting}
319
cef948318842 Minor edits to sessions 2, 4, 6 on day1.
Puneeth Chaganti <punchagan@fossee.in>
parents: 318
diff changeset
   575
In []: result = lstsq(A,tsq)
272
e5fc37a9ca96 Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 268
diff changeset
   576
In []: coef = result[0]
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   577
\end{lstlisting}
253
e446ed7287d7 Updated session 2 and session 4 slides of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 240
diff changeset
   578
\end{frame}
e446ed7287d7 Updated session 2 and session 4 slides of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 240
diff changeset
   579
e446ed7287d7 Updated session 2 and session 4 slides of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 240
diff changeset
   580
\begin{frame}[fragile]
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   581
\frametitle{Least Square Fit Line \ldots}
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   582
We get the points of the line from \typ{coef}
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   583
\begin{lstlisting}
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   584
In []: Tline = coef[0]*L + coef[1]
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   585
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   586
In []: Tline.shape
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   587
\end{lstlisting}
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   588
\begin{itemize}
379
682b6f66fe11 Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 378
diff changeset
   589
\item Now plot \typ{Tline} vs. \typ{L}, to get the Least squares fit line. 
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   590
\end{itemize}
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   591
\begin{lstlisting}
387
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   592
In []: plot(L, Tline, 'r')
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   593
5e485a5d8ac4 Minor corrections post SVCE.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 385
diff changeset
   594
In []: plot(L, tsq, 'o')
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   595
\end{lstlisting}
127
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   596
\end{frame}
44c2f614e321 Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 124
diff changeset
   597
285
e072cadee389 Minor edits to session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 282
diff changeset
   598
\begin{frame}[fragile]
e072cadee389 Minor edits to session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 282
diff changeset
   599
\frametitle{Least Squares Fit}
e072cadee389 Minor edits to session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 282
diff changeset
   600
\vspace{-0.15in}
e072cadee389 Minor edits to session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 282
diff changeset
   601
\begin{figure}
e072cadee389 Minor edits to session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 282
diff changeset
   602
\includegraphics[width=4in]{data/least-sq-fit}
e072cadee389 Minor edits to session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 282
diff changeset
   603
\end{figure}
e072cadee389 Minor edits to session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 282
diff changeset
   604
\end{frame}
e072cadee389 Minor edits to session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 282
diff changeset
   605
213
ce62706cf870 Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 203
diff changeset
   606
\section{Summary}
185
e59ab9ab1a89 Manual Merge with Mainline.
Puneeth Chaganti <punchagan@fossee.in>
parents: 179
diff changeset
   607
\begin{frame}
285
e072cadee389 Minor edits to session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 282
diff changeset
   608
  \frametitle{What did we learn?}
185
e59ab9ab1a89 Manual Merge with Mainline.
Puneeth Chaganti <punchagan@fossee.in>
parents: 179
diff changeset
   609
  \begin{itemize}
213
ce62706cf870 Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 203
diff changeset
   610
  \item Matrices
214
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   611
    \begin{itemize}
293
f7d7b5565232 Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents: 286
diff changeset
   612
      \item Initializing
263
8a4a1e5aec85 Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents: 253
diff changeset
   613
      \item Accessing elements
285
e072cadee389 Minor edits to session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 282
diff changeset
   614
      \item Slicing and Striding
214
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   615
      \item Transpose
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   616
      \item Addition
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   617
      \item Multiplication
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   618
      \item Inverse of a matrix
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   619
      \item Determinant
274
34f71bdd0263 Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 253
diff changeset
   620
      \item Eigenvalues and Eigen vector
410
ec4b97af33e1 Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents: 389
diff changeset
   621
      \item Singular Value Decomposition
214
19592f802dde Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents: 213
diff changeset
   622
    \end{itemize}
268
f978ddc90960 Moved least square fitting to session 4; removed vander function.
Puneeth Chaganti <punchagan@fossee.in>
parents: 263
diff changeset
   623
  \item Least Square Curve fitting
185
e59ab9ab1a89 Manual Merge with Mainline.
Puneeth Chaganti <punchagan@fossee.in>
parents: 179
diff changeset
   624
  \end{itemize}
e59ab9ab1a89 Manual Merge with Mainline.
Puneeth Chaganti <punchagan@fossee.in>
parents: 179
diff changeset
   625
\end{frame}
e59ab9ab1a89 Manual Merge with Mainline.
Puneeth Chaganti <punchagan@fossee.in>
parents: 179
diff changeset
   626
118
c7f85ba59af3 Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff changeset
   627
\end{document}
343
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   628
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   629
%% Questions for Quiz %%
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   630
%% ------------------ %%
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   631
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   632
\begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   633
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   634
\begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   635
In []: a = array([[1, 2],
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   636
                  [3, 4]])
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   637
In []: a[1,0] = 0
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   638
\end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   639
What is the resulting array?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   640
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   641
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   642
\begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   643
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   644
\begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   645
  In []: x = array(([1,2,3,4],
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   646
                    [2,3,4,5]))
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   647
  In []: x[-2][-3] = 4
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   648
  In []: print x
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   649
\end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   650
What will be printed?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   651
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   652
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   653
%% \begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   654
%% \frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   655
%% \begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   656
%%   In []: x = array([[1,2,3,4],
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   657
%%                     [3,4,2,5]])
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   658
%% \end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   659
%% What is the \lstinline+shape+ of this array?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   660
%% \end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   661
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   662
\begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   663
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   664
\begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   665
  In []: x = array([[1,2,3,4]])
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   666
\end{lstlisting}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   667
How to change \lstinline+x+ to \lstinline+array([[1,2,0,4]])+?
343
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   668
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   669
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   670
\begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   671
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   672
\begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   673
  In []: x = array([[1,2,3,4],
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   674
                    [3,4,2,5]])
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   675
\end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   676
How do you get the following slice of \lstinline+x+?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   677
\begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   678
array([[2,3],
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   679
       [4,2]])
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   680
\end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   681
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   682
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   683
\begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   684
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   685
\begin{lstlisting}
354
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   686
  In []: x = array([[9,18,27],
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   687
                    [30,60,90],
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   688
                    [14,7,1]])
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   689
\end{lstlisting}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   690
What is the output of \lstinline+x[::3,::3]+
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   691
\end{frame}
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   692
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   693
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   694
\begin{frame}[fragile]
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   695
\frametitle{\incqno }
5dc6c3673f9d Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents: 343
diff changeset
   696
\begin{lstlisting}
343
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   697
In []: a = array([[1, 2],
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   698
                  [3, 4]])
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   699
\end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   700
How do you get the transpose of this array?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   701
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   702
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   703
\begin{frame}[fragile]
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   704
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   705
\begin{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   706
In []: a = array([[1, 2],
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   707
                  [3, 4]])
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   708
In []: b = array([[1, 1],
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   709
                  [2, 2]])
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   710
In []: a*b
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   711
\end{lstlisting}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   712
What does this produce?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   713
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   714
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   715
\begin{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   716
\frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   717
What command do you use to find the inverse of a matrix and its
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   718
eigenvalues?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   719
\end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   720
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   721
%% \begin{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   722
%% \frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   723
%% The file \lstinline+datafile.txt+ contains 3 columns of data.  What
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   724
%% command will you use to read the entire data file into an array?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   725
%% \end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   726
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   727
%% \begin{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   728
%% \frametitle{\incqno }
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   729
%% If the contents of the file \lstinline+datafile.txt+ is read into an
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   730
%% $N\times3$ array called \lstinline+data+, how would you obtain the third
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   731
%% column of this data?
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   732
%% \end{frame}
adb85e126341 Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents: 339
diff changeset
   733