|
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
2 %Tutorial slides on Python. |
|
3 % |
|
4 % Author: The FOSSEE Group |
|
5 % Copyright (c) 2009, The FOSSEE Group, IIT Bombay |
|
6 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
7 |
|
8 \documentclass[14pt,compress]{beamer} |
|
9 %\documentclass[draft]{beamer} |
|
10 %\documentclass[compress,handout]{beamer} |
|
11 %\usepackage{pgfpages} |
|
12 %\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm] |
|
13 |
|
14 % Modified from: generic-ornate-15min-45min.de.tex |
|
15 \mode<presentation> |
|
16 { |
|
17 \usetheme{Warsaw} |
|
18 \useoutertheme{split} |
|
19 \setbeamercovered{transparent} |
|
20 } |
|
21 |
|
22 \usepackage[english]{babel} |
|
23 \usepackage[latin1]{inputenc} |
|
24 %\usepackage{times} |
|
25 \usepackage[T1]{fontenc} |
|
26 |
|
27 % Taken from Fernando's slides. |
|
28 \usepackage{ae,aecompl} |
|
29 \usepackage{mathpazo,courier,euler} |
|
30 \usepackage[scaled=.95]{helvet} |
|
31 |
|
32 \definecolor{darkgreen}{rgb}{0,0.5,0} |
|
33 |
|
34 \usepackage{listings} |
|
35 \lstset{language=Python, |
|
36 basicstyle=\ttfamily\bfseries, |
|
37 commentstyle=\color{red}\itshape, |
|
38 stringstyle=\color{darkgreen}, |
|
39 showstringspaces=false, |
|
40 keywordstyle=\color{blue}\bfseries} |
|
41 |
|
42 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
43 % Macros |
|
44 \setbeamercolor{emphbar}{bg=blue!20, fg=black} |
|
45 \newcommand{\emphbar}[1] |
|
46 {\begin{beamercolorbox}[rounded=true]{emphbar} |
|
47 {#1} |
|
48 \end{beamercolorbox} |
|
49 } |
|
50 \newcounter{time} |
|
51 \setcounter{time}{0} |
|
52 \newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}} |
|
53 |
|
54 \newcommand{\typ}[1]{\texttt{#1}} |
|
55 |
|
56 \newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}} } |
|
57 |
|
58 %%% This is from Fernando's setup. |
|
59 % \usepackage{color} |
|
60 % \definecolor{orange}{cmyk}{0,0.4,0.8,0.2} |
|
61 % % Use and configure listings package for nicely formatted code |
|
62 % \usepackage{listings} |
|
63 % \lstset{ |
|
64 % language=Python, |
|
65 % basicstyle=\small\ttfamily, |
|
66 % commentstyle=\ttfamily\color{blue}, |
|
67 % stringstyle=\ttfamily\color{orange}, |
|
68 % showstringspaces=false, |
|
69 % breaklines=true, |
|
70 % postbreak = \space\dots |
|
71 % } |
|
72 |
|
73 |
|
74 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
75 % Title page |
|
76 \title[Basic Python]{Matrices, Solution of equations and Integration\\} |
|
77 |
|
78 \author[FOSEE Team] {The FOSSEE Group} |
|
79 |
|
80 \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} |
|
81 \date[] {31, October 2009\\Day 1, Session 4} |
|
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
83 |
|
84 %\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo} |
|
85 %\logo{\pgfuseimage{iitmlogo}} |
|
86 |
|
87 |
|
88 %% Delete this, if you do not want the table of contents to pop up at |
|
89 %% the beginning of each subsection: |
|
90 \AtBeginSubsection[] |
|
91 { |
|
92 \begin{frame}<beamer> |
|
93 \frametitle{Outline} |
|
94 \tableofcontents[currentsection,currentsubsection] |
|
95 \end{frame} |
|
96 } |
|
97 |
|
98 %%\AtBeginSection[] |
|
99 %%{ |
|
100 %%\begin{frame}<beamer> |
|
101 %% \frametitle{Outline} |
|
102 %% \tableofcontents[currentsection,currentsubsection] |
|
103 %%\end{frame} |
|
104 %%} |
|
105 |
|
106 % If you wish to uncover everything in a step-wise fashion, uncomment |
|
107 % the following command: |
|
108 %\beamerdefaultoverlayspecification{<+->} |
|
109 |
|
110 %\includeonlyframes{current,current1,current2,current3,current4,current5,current6} |
|
111 |
|
112 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
|
113 % DOCUMENT STARTS |
|
114 \begin{document} |
|
115 |
|
116 \begin{frame} |
|
117 \titlepage |
|
118 \end{frame} |
|
119 |
|
120 \begin{frame} |
|
121 \frametitle{Outline} |
|
122 \tableofcontents |
|
123 \pausesections |
|
124 \end{frame} |
|
125 |
|
126 \section{Matrices} |
|
127 \subsection{Initializing} |
|
128 \begin{frame}[fragile] |
|
129 \frametitle{Matrices: Initializing} |
|
130 \begin{lstlisting} |
|
131 In []: a = matrix([[1,2,3],[4,5,6],[7,8,9]]) |
|
132 |
|
133 In []: a |
|
134 Out[]: |
|
135 matrix([[1, 2, 3], |
|
136 [4, 5, 6], |
|
137 [7, 8, 9]]) |
|
138 \end{lstlisting} |
|
139 \end{frame} |
|
140 |
|
141 \subsection{Basic Operations} |
|
142 \begin{frame}[fragile] |
|
143 \frametitle{Inverse of a Matrix} |
|
144 \begin{lstlisting} |
|
145 In []: linalg.inv(a) |
|
146 Out[]: |
|
147 matrix([[ 3.15221191e+15, -6.30442381e+15, 3.15221191e+15], |
|
148 [ -6.30442381e+15, 1.26088476e+16, -6.30442381e+15], |
|
149 [ 3.15221191e+15, -6.30442381e+15, 3.15221191e+15]]) |
|
150 \end{lstlisting} |
|
151 \end{frame} |
|
152 |
|
153 \begin{frame}[fragile] |
|
154 \frametitle{Determinant} |
|
155 \begin{lstlisting} |
|
156 In []: linalg.det(a) |
|
157 Out[]: -9.5171266700777579e-16 |
|
158 \end{lstlisting} |
|
159 \end{frame} |
|
160 |
|
161 \begin{frame}[fragile] |
|
162 \frametitle{Computing Norms} |
|
163 \begin{lstlisting} |
|
164 In []: linalg.norm(a) |
|
165 Out[]: 16.881943016134134 |
|
166 |
|
167 In []: linalg.norm? |
|
168 \end{lstlisting} |
|
169 \end{frame} |
|
170 |
|
171 \begin{frame}[fragile] |
|
172 \frametitle{Eigen Values and Eigen Matrix} |
|
173 \begin{lstlisting} |
|
174 In []: linalg.eigvals(a) |
|
175 Out[]: array([ 1.61168440e+01, -1.11684397e+00, -1.22196337e-15]) |
|
176 |
|
177 In []: linalg.eig(a) |
|
178 Out[]: |
|
179 (array([ 1.61168440e+01, -1.11684397e+00, -1.22196337e-15]), |
|
180 matrix([[-0.23197069, -0.78583024, 0.40824829], |
|
181 [-0.52532209, -0.08675134, -0.81649658], |
|
182 [-0.8186735 , 0.61232756, 0.40824829]])) |
|
183 \end{lstlisting} |
|
184 \end{frame} |
|
185 |
|
186 \end{document} |