author | Puneeth Chaganti <punchagan@fossee.in> |
Thu, 09 Dec 2010 23:11:12 +0530 | |
branch | scipyin2010 |
changeset 448 | dc8d666a594a |
parent 446 | b9d07ebd783b |
permissions | -rw-r--r-- |
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 |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
77 |
\title[Arrays]{Python for Science and Engg: \\Arrays} |
118
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
78 |
|
141
fccf675946bf
Made usage of FOSSEE consistent; removed all instances of Team, Group.
Puneeth Chaganti <punchagan@fossee.in>
parents:
131
diff
changeset
|
79 |
\author[FOSSEE] {FOSSEE} |
118
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
80 |
|
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
81 |
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} |
448
dc8d666a594a
Changed date format in day1/session{3,4,5}.tex.
Puneeth Chaganti <punchagan@fossee.in>
parents:
446
diff
changeset
|
82 |
\date[] {SciPy.in 2010, Tutorials} |
118
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
83 |
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
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 |
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
86 |
%\logo{\pgfuseimage{iitmlogo}} |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
87 |
|
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 |
%% 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
|
90 |
%% the beginning of each subsection: |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
91 |
\AtBeginSubsection[] |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
92 |
{ |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
93 |
\begin{frame}<beamer> |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
94 |
\frametitle{Outline} |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
95 |
\tableofcontents[currentsection,currentsubsection] |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
96 |
\end{frame} |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
97 |
} |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
98 |
|
213
ce62706cf870
Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
203
diff
changeset
|
99 |
\AtBeginSection[] |
ce62706cf870
Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
203
diff
changeset
|
100 |
{ |
ce62706cf870
Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
203
diff
changeset
|
101 |
\begin{frame}<beamer> |
ce62706cf870
Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
203
diff
changeset
|
102 |
\frametitle{Outline} |
ce62706cf870
Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
203
diff
changeset
|
103 |
\tableofcontents[currentsection,currentsubsection] |
ce62706cf870
Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
203
diff
changeset
|
104 |
\end{frame} |
ce62706cf870
Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
203
diff
changeset
|
105 |
} |
118
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
106 |
|
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
107 |
% 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
|
108 |
% the following command: |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
109 |
%\beamerdefaultoverlayspecification{<+->} |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
110 |
|
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
111 |
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6} |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
112 |
|
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 |
% DOCUMENT STARTS |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
115 |
\begin{document} |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
116 |
|
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
117 |
\begin{frame} |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
118 |
\titlepage |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
119 |
\end{frame} |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
120 |
|
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
121 |
\begin{frame} |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
122 |
\frametitle{Outline} |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
123 |
\tableofcontents |
123
d2f4053a2e85
Added first slides for ODE.
Puneeth Chaganti <punchagan@fossee.in>
parents:
118
diff
changeset
|
124 |
% \pausesections |
118
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
125 |
\end{frame} |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
126 |
\section{Motivation} |
197
8c42ffdaaeec
Updated session 4 slides based on review.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
185
diff
changeset
|
127 |
|
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
128 |
\begin{frame}[fragile] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
129 |
\frametitle{Why arrays?} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
130 |
\begin{itemize} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
131 |
\item Speed! |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
132 |
\item Convenience |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
133 |
\item Easier to handle multi-dimensional data |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
134 |
\end{itemize} |
179
eea01ca072ff
Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
178
diff
changeset
|
135 |
\end{frame} |
eea01ca072ff
Updated session 2.tex of Day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
178
diff
changeset
|
136 |
|
118
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
137 |
\begin{frame}[fragile] |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
138 |
\frametitle{Speed} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
139 |
\begin{lstlisting} |
446
b9d07ebd783b
Replaced random array with linspace in day1/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
444
diff
changeset
|
140 |
In []: a = linspace(0, 100*pi, 1000000) |
b9d07ebd783b
Replaced random array with linspace in day1/session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
444
diff
changeset
|
141 |
# array with a million elements |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
142 |
In []: b = [] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
143 |
In []: for each in a: |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
144 |
...: b.append(sin(each)) |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
145 |
...: |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
146 |
...: |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
147 |
In []: sin(a) |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
148 |
\end{lstlisting} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
149 |
\end{frame} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
150 |
|
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
151 |
\begin{frame}[fragile] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
152 |
\frametitle{Convenience} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
153 |
The pendulum problem could've been solved as below:: |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
154 |
\begin{lstlisting} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
155 |
In []: L, T = loadtxt('pendulum.txt', |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
156 |
unpack=True) |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
157 |
In []: tsq = T*T |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
158 |
In []: plot (L, tsq, '.') |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
159 |
\end{lstlisting} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
160 |
\end{frame} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
161 |
|
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
162 |
\section{Initializing} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
163 |
\begin{frame}[fragile] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
164 |
\frametitle{Initializing} |
118
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
165 |
\begin{lstlisting} |
384
9f9fddf7e37c
MNIT Jaipur changes.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
382
diff
changeset
|
166 |
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
|
167 |
[21,22,23], |
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
168 |
[31,32,33]]) |
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
169 |
|
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
170 |
In []: c |
235
8eab0fee0fc2
Updated session 4 day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
233
diff
changeset
|
171 |
Out[]: |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
172 |
array([[11, 12, 13], |
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
173 |
[21, 22, 23], |
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
174 |
[31, 32, 33]]) |
118
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
175 |
\end{lstlisting} |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
176 |
\end{frame} |
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
177 |
|
263
8a4a1e5aec85
Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents:
253
diff
changeset
|
178 |
\begin{frame}[fragile] |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
179 |
\frametitle{Some special arrays} |
293
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
180 |
\begin{small} |
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
181 |
\begin{lstlisting} |
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
182 |
In []: ones((3,5)) |
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
183 |
Out[]: |
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
184 |
array([[ 1., 1., 1., 1., 1.], |
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
185 |
[ 1., 1., 1., 1., 1.], |
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
186 |
[ 1., 1., 1., 1., 1.]]) |
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
187 |
|
319
cef948318842
Minor edits to sessions 2, 4, 6 on day1.
Puneeth Chaganti <punchagan@fossee.in>
parents:
318
diff
changeset
|
188 |
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
|
189 |
Out[]: array([1, 1, 1, 1]) |
293
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
190 |
|
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
191 |
In []: identity(2) |
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
192 |
Out[]: |
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
193 |
array([[ 1., 0.], |
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
194 |
[ 0., 1.]]) |
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
195 |
\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
|
196 |
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
|
197 |
\end{small} |
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
198 |
\end{frame} |
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
199 |
|
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
200 |
|
f7d7b5565232
Added another ODE example to session6.
Puneeth Chaganti <punchagan@fossee.in>
parents:
286
diff
changeset
|
201 |
\begin{frame}[fragile] |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
202 |
\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
|
203 |
\begin{small} |
263
8a4a1e5aec85
Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents:
253
diff
changeset
|
204 |
\begin{lstlisting} |
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
205 |
In []: c |
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
206 |
Out[]: |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
207 |
array([[11, 12, 13], |
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
208 |
[21, 22, 23], |
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
209 |
[31, 32, 33]]) |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
210 |
|
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
211 |
In []: c[1][2] |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
212 |
Out[]: 23 |
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
213 |
In []: c[1,2] |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
214 |
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
|
215 |
|
41c34770d63a
Updated sessions of day 1 with the corrections from GRD.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
379
diff
changeset
|
216 |
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
|
217 |
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
|
218 |
\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
|
219 |
\end{small} |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
220 |
Similar to \kwrd{lists} but improved! |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
221 |
\end{frame} |
263
8a4a1e5aec85
Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents:
253
diff
changeset
|
222 |
|
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
223 |
\begin{frame}[fragile] |
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
224 |
\frametitle{Changing elements} |
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
225 |
\begin{small} |
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
226 |
\begin{lstlisting} |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
227 |
In []: c[1,1] = -22 |
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
228 |
In []: c |
263
8a4a1e5aec85
Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents:
253
diff
changeset
|
229 |
Out[]: |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
230 |
array([[ 11, 12, 13], |
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
231 |
[ 21, -22, 23], |
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
232 |
[ 31, 32, 33]]) |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
233 |
|
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
234 |
In []: c[1] = 0 |
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
235 |
In []: c |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
236 |
Out[]: |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
237 |
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
|
238 |
[ 0, 0, 0], |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
239 |
[31, 32, 33]]) |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
240 |
\end{lstlisting} |
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
241 |
\end{small} |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
242 |
How do you access one \alert{column}? -- Enter Slicing! |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
243 |
\end{frame} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
244 |
|
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
245 |
\section{Slicing \& Striding} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
246 |
|
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
247 |
\begin{frame}[fragile] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
248 |
\frametitle{Slicing: Lists} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
249 |
\begin{block}{Define a list} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
250 |
\kwrd{In []: p = [ 2, 3, 5, 7, 11, 13]} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
251 |
\end{block} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
252 |
\begin{lstlisting} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
253 |
In []: p[1:3] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
254 |
Out[]: [3, 5] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
255 |
\end{lstlisting} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
256 |
\emphbar{A slice} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
257 |
\begin{lstlisting} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
258 |
In []: p[0:-1] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
259 |
Out[]: [2, 3, 5, 7, 11] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
260 |
In []: p[:] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
261 |
Out[]: [2, 3, 5, 7, 11, 13] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
262 |
\end{lstlisting} |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
263 |
\end{frame} |
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
264 |
|
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
265 |
\begin{frame}[fragile] |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
266 |
\frametitle{Striding: Lists} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
267 |
\emphbar{Striding over \typ{p}} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
268 |
\begin{lstlisting} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
269 |
In []: p[::2] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
270 |
Out[]: [2, 5, 11] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
271 |
In []: p[1::2] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
272 |
Out[]: [3, 7, 13] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
273 |
In []: p[1:-1:2] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
274 |
Out[]: [3, 7] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
275 |
In []: p[::3] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
276 |
Out[]: [2, 7] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
277 |
\end{lstlisting} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
278 |
\alert{\typ{list[initial:final:step]}} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
279 |
\end{frame} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
280 |
|
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
281 |
\begin{frame}[fragile] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
282 |
\frametitle{Slicing \& Striding: Lists} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
283 |
What is the output of the following? |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
284 |
\begin{lstlisting} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
285 |
In []: p[1::4] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
286 |
|
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
287 |
In []: p[1:-1:3] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
288 |
\end{lstlisting} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
289 |
\end{frame} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
290 |
|
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
291 |
|
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
292 |
\begin{frame}[fragile] |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
293 |
\frametitle{Slicing: \typ{arrays}} |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
294 |
\begin{small} |
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
295 |
\begin{lstlisting} |
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
296 |
In []: c[:,1] |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
297 |
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
|
298 |
|
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
299 |
In []: c[1,:] |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
300 |
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
|
301 |
|
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
302 |
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
|
303 |
Out[]: |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
304 |
array([[11, 12, 13], |
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
305 |
[ 0, 0, 0]]) |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
306 |
|
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
307 |
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
|
308 |
Out[]: |
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
309 |
array([[ 0, 0, 0], |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
310 |
[31, 32, 33]]) |
263
8a4a1e5aec85
Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents:
253
diff
changeset
|
311 |
\end{lstlisting} |
8a4a1e5aec85
Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents:
253
diff
changeset
|
312 |
\end{small} |
8a4a1e5aec85
Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents:
253
diff
changeset
|
313 |
\end{frame} |
8a4a1e5aec85
Changes made for Goa workshop .
Shantanu <shantanu@fossee.in>
parents:
253
diff
changeset
|
314 |
|
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
315 |
\begin{frame}[fragile] |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
316 |
\frametitle{Slicing: \typ{arrays} \ldots} |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
317 |
\begin{small} |
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
318 |
\begin{lstlisting} |
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
319 |
In []: c[:2,:] |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
320 |
Out[]: |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
321 |
array([[11, 12, 13], |
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
322 |
[ 0, 0, 0]]) |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
323 |
|
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
324 |
In []: c[1:,:] |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
325 |
Out[]: |
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
326 |
array([[ 0, 0, 0], |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
327 |
[31, 32, 33]]) |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
328 |
|
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
329 |
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
|
330 |
Out[]: |
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
331 |
array([[ 0, 0], |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
332 |
[31, 32]]) |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
333 |
\end{lstlisting} |
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
334 |
|
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
335 |
\end{small} |
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
336 |
\end{frame} |
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
337 |
|
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
338 |
\begin{frame}[fragile] |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
339 |
\frametitle{Striding: \typ{arrays}} |
279
e7ce6f9d7e15
Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
278
diff
changeset
|
340 |
\begin{small} |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
341 |
\begin{lstlisting} |
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
342 |
In []: c[::2,:] |
279
e7ce6f9d7e15
Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
278
diff
changeset
|
343 |
Out[]: |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
344 |
array([[11, 12, 13], |
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
345 |
[31, 32, 33]]) |
279
e7ce6f9d7e15
Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
278
diff
changeset
|
346 |
|
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
347 |
In []: c[:,::2] |
279
e7ce6f9d7e15
Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
278
diff
changeset
|
348 |
Out[]: |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
349 |
array([[11, 13], |
279
e7ce6f9d7e15
Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
278
diff
changeset
|
350 |
[ 0, 0], |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
351 |
[31, 33]]) |
279
e7ce6f9d7e15
Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
278
diff
changeset
|
352 |
|
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
353 |
In []: c[::2,::2] |
279
e7ce6f9d7e15
Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
278
diff
changeset
|
354 |
Out[]: |
361
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
355 |
array([[11, 13], |
a1ee950f3d6d
Fixed few more errors found during REC workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
354
diff
changeset
|
356 |
[31, 33]]) |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
357 |
\end{lstlisting} |
279
e7ce6f9d7e15
Added Striding in session4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
278
diff
changeset
|
358 |
\end{small} |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
359 |
\end{frame} |
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
360 |
|
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
361 |
\begin{frame}[fragile] |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
362 |
\frametitle{Shape of an \typ{array}} |
373
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
363 |
\begin{lstlisting} |
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
364 |
In []: c |
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
365 |
Out[]: |
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
366 |
array([[11, 12, 13], |
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
367 |
[ 0, 0, 0], |
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
368 |
[31, 32, 33]]) |
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
369 |
|
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
370 |
In []: c.shape |
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
371 |
Out[]: (3, 3) |
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
372 |
\end{lstlisting} |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
373 |
\emphbar{Shape specifies shape or dimensions of an array} |
373
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
374 |
\end{frame} |
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
375 |
|
f04eca8b2f3d
Commits from NIT DGP and IITK
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
366
diff
changeset
|
376 |
\begin{frame}[fragile] |
379
682b6f66fe11
Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
377 |
\frametitle{Elementary image processing} |
282
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
378 |
\begin{small} |
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
379 |
\begin{lstlisting} |
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
380 |
In []: a = imread('lena.png') |
282
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
381 |
|
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
382 |
In []: imshow(a) |
282
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
383 |
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
|
384 |
\end{lstlisting} |
682b6f66fe11
Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
385 |
\end{small} |
682b6f66fe11
Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
386 |
\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
|
387 |
\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
|
388 |
\end{frame} |
282
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
389 |
|
379
682b6f66fe11
Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
390 |
\begin{frame}[fragile] |
682b6f66fe11
Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
391 |
\frametitle{Slicing \& Striding Exercises} |
282
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
392 |
\begin{itemize} |
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
393 |
\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
|
394 |
\item Crop the image to get only the face |
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
395 |
\item Resize image to half by dropping alternate pixels |
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
396 |
\end{itemize} |
379
682b6f66fe11
Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
397 |
|
272
e5fc37a9ca96
Added initial slides of Slicing and Striding to session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
268
diff
changeset
|
398 |
\end{frame} |
282
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
399 |
\begin{frame}[fragile] |
285
e072cadee389
Minor edits to session4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
400 |
\frametitle{Solutions} |
282
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
401 |
\begin{small} |
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
402 |
\begin{lstlisting} |
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
403 |
In []: imshow(a[:256,:256]) |
282
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
404 |
Out[]: <matplotlib.image.AxesImage object at 0xb6f658c> |
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
405 |
|
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
406 |
In []: imshow(a[200:400,200:400]) |
282
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
407 |
Out[]: <matplotlib.image.AxesImage object at 0xb757c2c> |
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
408 |
|
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
409 |
In []: imshow(a[::2,::2]) |
282
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
410 |
Out[]: <matplotlib.image.AxesImage object at 0xb765c8c> |
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
411 |
\end{lstlisting} |
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
412 |
\end{small} |
b2dafce03b8d
Added Slicing and Striding exercises.
Puneeth Chaganti <punchagan@fossee.in>
parents:
281
diff
changeset
|
413 |
\end{frame} |
214
19592f802dde
Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
213
diff
changeset
|
414 |
|
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
415 |
\section{Operations on \typ{arrays}} |
214
19592f802dde
Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
213
diff
changeset
|
416 |
\begin{frame}[fragile] |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
417 |
\frametitle{Operations: Addition} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
418 |
Operations on arrays, as already mentioned, are \alert{element-wise} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
419 |
\begin{lstlisting} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
420 |
In []: a = array([[-3,2.5], |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
421 |
[2.5,2]]) |
330
46533051b9d3
commited changes made for scipy and cheatsheats.
Shantanu <shantanu@fossee.in>
parents:
319
diff
changeset
|
422 |
|
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
423 |
In []: b = array([[3,2], |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
424 |
[2,-2]]) |
214
19592f802dde
Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
213
diff
changeset
|
425 |
|
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
426 |
In []: a + b |
214
19592f802dde
Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
213
diff
changeset
|
427 |
Out[]: |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
428 |
array([[ 0. , 4.5], |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
429 |
[ 4.5, 0. ]]) |
214
19592f802dde
Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
213
diff
changeset
|
430 |
\end{lstlisting} |
19592f802dde
Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
213
diff
changeset
|
431 |
\end{frame} |
19592f802dde
Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
213
diff
changeset
|
432 |
|
19592f802dde
Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
213
diff
changeset
|
433 |
\begin{frame}[fragile] |
274
34f71bdd0263
Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
253
diff
changeset
|
434 |
\frametitle{Elementwise Multiplication} |
34f71bdd0263
Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
253
diff
changeset
|
435 |
\begin{lstlisting} |
318
e75d3c993ed5
Corrected errata in Matrices slides.
Puneeth Chaganti <punchagan@fossee.in>
parents:
304
diff
changeset
|
436 |
In []: a*b |
274
34f71bdd0263
Loads of changes done.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
253
diff
changeset
|
437 |
Out[]: |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
438 |
array([[-9., 5.], |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
439 |
[ 5., -4.]]) |
214
19592f802dde
Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
213
diff
changeset
|
440 |
\end{lstlisting} |
19592f802dde
Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
213
diff
changeset
|
441 |
\end{frame} |
19592f802dde
Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
213
diff
changeset
|
442 |
|
118
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
443 |
\begin{frame}[fragile] |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
444 |
\frametitle{Matrix Operations using \typ{arrays}} |
118
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
445 |
|
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
446 |
We can perform various matrix operations on \kwrd{arrays}\\ |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
447 |
A few are listed below. |
379
682b6f66fe11
Updated for day1 of GRD workshop.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
378
diff
changeset
|
448 |
|
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
449 |
\vspace{-0.2in} |
253
e446ed7287d7
Updated session 2 and session 4 slides of day 1.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
240
diff
changeset
|
450 |
|
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
451 |
\begin{center} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
452 |
\begin{tabular}{lll} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
453 |
Operation & How? & Example \\ |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
454 |
\hline |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
455 |
Transpose & \typ{.T} & \typ{A.T} \\ |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
456 |
Product & \typ{dot} & \typ{dot(A, B)} \\ |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
457 |
Inverse & \typ{inv} & \typ{inv(A)} \\ |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
458 |
Determinant & \typ{det} & \typ{det(A)} \\ |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
459 |
Sum of all elements & \typ{sum} & \typ{sum(A)} \\ |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
460 |
Eigenvalues & \typ{eigvals} & \typ{eigvals(A)} \\ |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
461 |
Eigenvalues \& Eigenvectors & \typ{eig} & \typ{eig(A)} \\ |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
462 |
Norms & \typ{norm} & \typ{norm(A)} \\ |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
463 |
SVD & \typ{svd} & \typ{svd(A)} \\ |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
464 |
\end{tabular} |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
465 |
\end{center} |
127
44c2f614e321
Updated Integration section in Session 4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
124
diff
changeset
|
466 |
|
410
ec4b97af33e1
Updating session4, adding example for computation of norm and SVD.
Prabhu Ramachandran <prabhu@aero.iitb.ac.in>
parents:
389
diff
changeset
|
467 |
\end{frame} |
214
19592f802dde
Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
213
diff
changeset
|
468 |
|
213
ce62706cf870
Resolved conflicts manually.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
203
diff
changeset
|
469 |
\section{Summary} |
185
e59ab9ab1a89
Manual Merge with Mainline.
Puneeth Chaganti <punchagan@fossee.in>
parents:
179
diff
changeset
|
470 |
\begin{frame} |
285
e072cadee389
Minor edits to session4.
Puneeth Chaganti <punchagan@fossee.in>
parents:
282
diff
changeset
|
471 |
\frametitle{What did we learn?} |
185
e59ab9ab1a89
Manual Merge with Mainline.
Puneeth Chaganti <punchagan@fossee.in>
parents:
179
diff
changeset
|
472 |
\begin{itemize} |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
473 |
\item Arrays |
214
19592f802dde
Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
213
diff
changeset
|
474 |
\begin{itemize} |
444
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
475 |
\item Initializing |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
476 |
\item Accessing elements |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
477 |
\item Slicing \& Striding |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
478 |
\item Element-wise Operations |
a1117e03f98a
Modified day1/session3 -- arrays.
Puneeth Chaganti <punchagan@fossee.in>
parents:
443
diff
changeset
|
479 |
\item Matrix Operations |
214
19592f802dde
Added matrix operations.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
213
diff
changeset
|
480 |
\end{itemize} |
185
e59ab9ab1a89
Manual Merge with Mainline.
Puneeth Chaganti <punchagan@fossee.in>
parents:
179
diff
changeset
|
481 |
\end{itemize} |
e59ab9ab1a89
Manual Merge with Mainline.
Puneeth Chaganti <punchagan@fossee.in>
parents:
179
diff
changeset
|
482 |
\end{frame} |
e59ab9ab1a89
Manual Merge with Mainline.
Puneeth Chaganti <punchagan@fossee.in>
parents:
179
diff
changeset
|
483 |
|
118
c7f85ba59af3
Added session4.tex.
Santosh G. Vattam <vattam.santosh@gmail.com>
parents:
diff
changeset
|
484 |
\end{document} |
343
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
485 |
|
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
486 |
%% Questions for Quiz %% |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
487 |
%% ------------------ %% |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
488 |
|
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
489 |
\begin{frame}[fragile] |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
490 |
\frametitle{\incqno } |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
491 |
\begin{lstlisting} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
492 |
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
|
493 |
[3, 4]]) |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
494 |
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
|
495 |
\end{lstlisting} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
496 |
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
|
497 |
\end{frame} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
498 |
|
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
499 |
\begin{frame}[fragile] |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
500 |
\frametitle{\incqno } |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
501 |
\begin{lstlisting} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
502 |
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
|
503 |
[2,3,4,5])) |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
504 |
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
|
505 |
In []: print x |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
506 |
\end{lstlisting} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
507 |
What will be printed? |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
508 |
\end{frame} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
509 |
|
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
510 |
%% \begin{frame}[fragile] |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
511 |
%% \frametitle{\incqno } |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
512 |
%% \begin{lstlisting} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
513 |
%% 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
|
514 |
%% [3,4,2,5]]) |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
515 |
%% \end{lstlisting} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
516 |
%% 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
|
517 |
%% \end{frame} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
518 |
|
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
519 |
\begin{frame}[fragile] |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
520 |
\frametitle{\incqno } |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
521 |
\begin{lstlisting} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
522 |
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
|
523 |
\end{lstlisting} |
354
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
343
diff
changeset
|
524 |
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
|
525 |
\end{frame} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
526 |
|
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
527 |
\begin{frame}[fragile] |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
528 |
\frametitle{\incqno } |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
529 |
\begin{lstlisting} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
530 |
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
|
531 |
[3,4,2,5]]) |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
532 |
\end{lstlisting} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
533 |
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
|
534 |
\begin{lstlisting} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
535 |
array([[2,3], |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
536 |
[4,2]]) |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
537 |
\end{lstlisting} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
538 |
\end{frame} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
539 |
|
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
540 |
\begin{frame}[fragile] |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
541 |
\frametitle{\incqno } |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
542 |
\begin{lstlisting} |
354
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
343
diff
changeset
|
543 |
In []: x = array([[9,18,27], |
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
343
diff
changeset
|
544 |
[30,60,90], |
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
343
diff
changeset
|
545 |
[14,7,1]]) |
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
343
diff
changeset
|
546 |
\end{lstlisting} |
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
343
diff
changeset
|
547 |
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
|
548 |
\end{frame} |
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
343
diff
changeset
|
549 |
|
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
343
diff
changeset
|
550 |
|
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
343
diff
changeset
|
551 |
\begin{frame}[fragile] |
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
343
diff
changeset
|
552 |
\frametitle{\incqno } |
5dc6c3673f9d
Changes made during REC Chennai workshop.
Puneeth Chaganti <punchagan@fossee.in>
parents:
343
diff
changeset
|
553 |
\begin{lstlisting} |
343
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
554 |
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
|
555 |
[3, 4]]) |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
556 |
\end{lstlisting} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
557 |
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
|
558 |
\end{frame} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
559 |
|
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
560 |
\begin{frame}[fragile] |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
561 |
\frametitle{\incqno } |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
562 |
\begin{lstlisting} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
563 |
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
|
564 |
[3, 4]]) |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
565 |
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
|
566 |
[2, 2]]) |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
567 |
In []: a*b |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
568 |
\end{lstlisting} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
569 |
What does this produce? |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
570 |
\end{frame} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
571 |
|
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
572 |
\begin{frame} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
573 |
\frametitle{\incqno } |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
574 |
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
|
575 |
eigenvalues? |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
576 |
\end{frame} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
577 |
|
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
578 |
%% \begin{frame} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
579 |
%% \frametitle{\incqno } |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
580 |
%% 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
|
581 |
%% 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
|
582 |
%% \end{frame} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
583 |
|
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
584 |
%% \begin{frame} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
585 |
%% \frametitle{\incqno } |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
586 |
%% 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
|
587 |
%% $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
|
588 |
%% column of this data? |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
589 |
%% \end{frame} |
adb85e126341
Moved all day1 quiz questions to end of day1-sessions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
339
diff
changeset
|
590 |