CoCalc Shared Filesscientific-python-lectures / Scientific-Computing-with-Python.texOpen in CoCalc with one click!
Author: William A. Stein
1
\documentclass{report}
2
\usepackage{graphicx}
3
\makeatletter
4
\def\maxwidth{\ifdim\[email protected]@width>\linewidth\linewidth
5
\else\[email protected]@width\fi}
6
\makeatother
7
\let\Oldincludegraphics\includegraphics
8
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=.8\maxwidth]{#1}}
9
\usepackage{caption}
10
\DeclareCaptionLabelFormat{nolabel}{}
11
\captionsetup{labelformat=nolabel}
12
13
\usepackage{adjustbox} % Used to constrain images to a maximum size
14
\usepackage{xcolor} % Allow colors to be defined
15
\usepackage{enumerate} % Needed for markdown enumerations to work
16
\usepackage{geometry} % Used to adjust the document margins
17
\usepackage{amsmath} % Equations
18
\usepackage{amssymb} % Equations
19
\usepackage{textcomp} % defines textquotesingle
20
\AtBeginDocument{%
21
\def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code
22
}
23
\usepackage{upquote} % Upright quotes for verbatim code
24
\usepackage{eurosym} % defines \euro
25
\usepackage[mathletters]{ucs} % Extended unicode (utf-8) support
26
\usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document
27
\usepackage{fancyvrb} % verbatim replacement that allows latex
28
\usepackage{grffile} % extends the file name processing of package graphics
29
\usepackage{hyperref}
30
\usepackage{longtable} % longtable support required by pandoc >1.10
31
\usepackage{booktabs} % table support for pandoc > 1.12.2
32
\usepackage[normalem]{ulem} % ulem is needed to support strikethroughs (\sout)
33
34
% Colors for the hyperref package
35
\definecolor{urlcolor}{rgb}{0,.145,.698}
36
\definecolor{linkcolor}{rgb}{.71,0.21,0.01}
37
\definecolor{citecolor}{rgb}{.12,.54,.11}
38
39
% ANSI colors
40
\definecolor{ansi-black}{HTML}{3E424D}
41
\definecolor{ansi-black-intense}{HTML}{282C36}
42
\definecolor{ansi-red}{HTML}{E75C58}
43
\definecolor{ansi-red-intense}{HTML}{B22B31}
44
\definecolor{ansi-green}{HTML}{00A250}
45
\definecolor{ansi-green-intense}{HTML}{007427}
46
\definecolor{ansi-yellow}{HTML}{DDB62B}
47
\definecolor{ansi-yellow-intense}{HTML}{B27D12}
48
\definecolor{ansi-blue}{HTML}{208FFB}
49
\definecolor{ansi-blue-intense}{HTML}{0065CA}
50
\definecolor{ansi-magenta}{HTML}{D160C4}
51
\definecolor{ansi-magenta-intense}{HTML}{A03196}
52
\definecolor{ansi-cyan}{HTML}{60C6C8}
53
\definecolor{ansi-cyan-intense}{HTML}{258F8F}
54
\definecolor{ansi-white}{HTML}{C5C1B4}
55
\definecolor{ansi-white-intense}{HTML}{A1A6B2}
56
57
% commands and environments needed by pandoc snippets
58
% extracted from the output of `pandoc -s`
59
\providecommand{\tightlist}{%
60
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
61
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
62
% Add ',fontsize=\small' for more characters per line
63
\newenvironment{Shaded}{}{}
64
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
65
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}
66
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
67
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
68
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
69
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
70
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
71
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}}
72
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
73
\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
74
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}
75
\newcommand{\RegionMarkerTok}[1]{{#1}}
76
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
77
\newcommand{\NormalTok}[1]{{#1}}
78
79
% Additional commands for more recent versions of Pandoc
80
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{{#1}}}
81
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
82
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
83
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{{#1}}}
84
\newcommand{\ImportTok}[1]{{#1}}
85
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{{#1}}}}
86
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
87
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
88
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{{#1}}}
89
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
90
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{{#1}}}
91
\newcommand{\BuiltInTok}[1]{{#1}}
92
\newcommand{\ExtensionTok}[1]{{#1}}
93
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{{#1}}}
94
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{{#1}}}
95
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
96
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
97
98
99
% Define a nice break command that doesn't care if a line doesn't already
100
% exist.
101
\def\br{\hspace*{\fill} \\* }
102
% Math Jax compatability definitions
103
\def\gt{>}
104
\def\lt{<}
105
% Pygments definitions
106
107
\makeatletter
108
\def\[email protected]{\let\[email protected]=\relax \let\[email protected]=\relax%
109
\let\[email protected]=\relax \let\[email protected]=\relax%
110
\let\[email protected]=\relax \let\[email protected]=\relax}
111
\def\[email protected]#1{\csname PY@tok@#1\endcsname}
112
\def\[email protected]#1+{\ifx\relax#1\empty\else%
113
\[email protected]{#1}\expandafter\[email protected]\fi}
114
\def\[email protected]#1{\[email protected]{\[email protected]{\[email protected]{%
115
\[email protected]{\[email protected]{\[email protected]{#1}}}}}}}
116
\def\PY#1#2{\[email protected]\[email protected]#1+\relax+\[email protected]{#2}}
117
118
\expandafter\def\csname PY@tok@gd\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}}
119
\expandafter\def\csname PY@tok@gu\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}}
120
\expandafter\def\csname PY@tok@gt\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}}
121
\expandafter\def\csname PY@tok@gs\endcsname{\let\[email protected]=\textbf}
122
\expandafter\def\csname PY@tok@gr\endcsname{\def\[email protected]##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}}
123
\expandafter\def\csname PY@tok@cm\endcsname{\let\[email protected]=\textit\def\[email protected]##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
124
\expandafter\def\csname PY@tok@vg\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
125
\expandafter\def\csname PY@tok@vi\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
126
\expandafter\def\csname PY@tok@mh\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
127
\expandafter\def\csname PY@tok@cs\endcsname{\let\[email protected]=\textit\def\[email protected]##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
128
\expandafter\def\csname PY@tok@ge\endcsname{\let\[email protected]it=\textit}
129
\expandafter\def\csname PY@tok@vc\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
130
\expandafter\def\csname PY@tok@il\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
131
\expandafter\def\csname PY@tok@go\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
132
\expandafter\def\csname PY@tok@cp\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}}
133
\expandafter\def\csname PY@tok@gi\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}}
134
\expandafter\def\csname PY@tok@gh\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
135
\expandafter\def\csname PY@tok@ni\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}}
136
\expandafter\def\csname PY@tok@nl\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}}
137
\expandafter\def\csname PY@tok@nn\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
138
\expandafter\def\csname PY@tok@no\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}}
139
\expandafter\def\csname PY@tok@na\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}}
140
\expandafter\def\csname PY@tok@nb\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
141
\expandafter\def\csname PY@tok@nc\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
142
\expandafter\def\csname PY@tok@nd\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
143
\expandafter\def\csname PY@tok@ne\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}}
144
\expandafter\def\csname PY@tok@nf\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
145
\expandafter\def\csname PY@tok@si\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
146
\expandafter\def\csname PY@tok@s2\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
147
\expandafter\def\csname PY@tok@nt\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
148
\expandafter\def\csname PY@tok@nv\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
149
\expandafter\def\csname PY@tok@s1\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
150
\expandafter\def\csname PY@tok@ch\endcsname{\let\[email protected]=\textit\def\[email protected]##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
151
\expandafter\def\csname PY@tok@m\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
152
\expandafter\def\csname PY@tok@gp\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
153
\expandafter\def\csname PY@tok@sh\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
154
\expandafter\def\csname PY@tok@ow\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
155
\expandafter\def\csname PY@tok@sx\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
156
\expandafter\def\csname PY@tok@bp\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
157
\expandafter\def\csname PY@tok@c1\endcsname{\let\[email protected]=\textit\def\[email protected]##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
158
\expandafter\def\csname PY@tok@o\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
159
\expandafter\def\csname PY@tok@kc\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
160
\expandafter\def\csname PY@tok@c\endcsname{\let\[email protected]=\textit\def\[email protected]##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
161
\expandafter\def\csname PY@tok@mf\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
162
\expandafter\def\csname PY@tok@err\endcsname{\def\[email protected]##1{\setlength{\fboxsep}{0pt}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}}
163
\expandafter\def\csname PY@tok@mb\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
164
\expandafter\def\csname PY@tok@ss\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
165
\expandafter\def\csname PY@tok@sr\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
166
\expandafter\def\csname PY@tok@mo\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
167
\expandafter\def\csname PY@tok@kd\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
168
\expandafter\def\csname PY@tok@mi\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
169
\expandafter\def\csname PY@tok@kn\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
170
\expandafter\def\csname PY@tok@cpf\endcsname{\let\[email protected]=\textit\def\[email protected]##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
171
\expandafter\def\csname PY@tok@kr\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
172
\expandafter\def\csname PY@tok@s\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
173
\expandafter\def\csname PY@tok@kp\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
174
\expandafter\def\csname PY@tok@w\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}
175
\expandafter\def\csname PY@tok@kt\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}}
176
\expandafter\def\csname PY@tok@sc\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
177
\expandafter\def\csname PY@tok@sb\endcsname{\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
178
\expandafter\def\csname PY@tok@k\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
179
\expandafter\def\csname PY@tok@se\endcsname{\let\[email protected]=\textbf\def\[email protected]##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}}
180
\expandafter\def\csname PY@tok@sd\endcsname{\let\[email protected]=\textit\def\[email protected]##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
181
182
\def\PYZbs{\char`\\}
183
\def\PYZus{\char`\_}
184
\def\PYZob{\char`\{}
185
\def\PYZcb{\char`\}}
186
\def\PYZca{\char`\^}
187
\def\PYZam{\char`\&}
188
\def\PYZlt{\char`\<}
189
\def\PYZgt{\char`\>}
190
\def\PYZsh{\char`\#}
191
\def\PYZpc{\char`\%}
192
\def\PYZdl{\char`\$}
193
\def\PYZhy{\char`\-}
194
\def\PYZsq{\char`\'}
195
\def\PYZdq{\char`\"}
196
\def\PYZti{\char`\~}
197
% for compatibility with earlier versions
198
\def\PYZat{@}
199
\def\PYZlb{[}
200
\def\PYZrb{]}
201
\makeatother
202
203
204
% Exact colors from NB
205
\definecolor{incolor}{rgb}{0.0, 0.0, 0.5}
206
\definecolor{outcolor}{rgb}{0.545, 0.0, 0.0}
207
208
209
210
211
% Prevent overflowing lines due to hard-to-break entities
212
\sloppy
213
% Setup hyperref package
214
\hypersetup{
215
breaklinks=true, % so long urls are correctly broken across lines
216
colorlinks=true,
217
urlcolor=urlcolor,
218
linkcolor=linkcolor,
219
citecolor=citecolor,
220
}
221
% Slightly bigger margins than the latex defaults
222
223
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
224
225
\title{Introduction to Scientific Computing in Python}
226
\author{Robert Johansson}
227
228
\begin{document}
229
\maketitle
230
231
\tableofcontents
232
233
\newpage
234
\input{Lecture-0-Scientific-Computing-with-Python}
235
236
\newpage
237
\input{Lecture-1-Introduction-to-Python-Programming}
238
239
\newpage
240
\input{Lecture-2-Numpy}
241
242
\newpage
243
\input{Lecture-3-Scipy}
244
245
\newpage
246
\input{Lecture-4-Matplotlib}
247
248
\newpage
249
\input{Lecture-5-Sympy}
250
251
\newpage
252
\input{Lecture-6A-Fortran-and-C}
253
254
\newpage
255
\input{Lecture-6B-HPC}
256
257
\newpage
258
\input{Lecture-7-Revision-Control-Software}
259
260
\end{document}
261