| Download
Lectures on scientific computing with python, as IPython notebooks, by J. R. Johansson
Project: Support and Testing
Views: 2351\documentclass{report}1\usepackage{graphicx}2\makeatletter3\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth4\else\Gin@nat@width\fi}5\makeatother6\let\Oldincludegraphics\includegraphics7\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=.8\maxwidth]{#1}}8\usepackage{caption}9\DeclareCaptionLabelFormat{nolabel}{}10\captionsetup{labelformat=nolabel}1112\usepackage{adjustbox} % Used to constrain images to a maximum size13\usepackage{xcolor} % Allow colors to be defined14\usepackage{enumerate} % Needed for markdown enumerations to work15\usepackage{geometry} % Used to adjust the document margins16\usepackage{amsmath} % Equations17\usepackage{amssymb} % Equations18\usepackage{textcomp} % defines textquotesingle19\AtBeginDocument{%20\def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code21}22\usepackage{upquote} % Upright quotes for verbatim code23\usepackage{eurosym} % defines \euro24\usepackage[mathletters]{ucs} % Extended unicode (utf-8) support25\usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document26\usepackage{fancyvrb} % verbatim replacement that allows latex27\usepackage{grffile} % extends the file name processing of package graphics28\usepackage{hyperref}29\usepackage{longtable} % longtable support required by pandoc >1.1030\usepackage{booktabs} % table support for pandoc > 1.12.231\usepackage[normalem]{ulem} % ulem is needed to support strikethroughs (\sout)3233% Colors for the hyperref package34\definecolor{urlcolor}{rgb}{0,.145,.698}35\definecolor{linkcolor}{rgb}{.71,0.21,0.01}36\definecolor{citecolor}{rgb}{.12,.54,.11}3738% ANSI colors39\definecolor{ansi-black}{HTML}{3E424D}40\definecolor{ansi-black-intense}{HTML}{282C36}41\definecolor{ansi-red}{HTML}{E75C58}42\definecolor{ansi-red-intense}{HTML}{B22B31}43\definecolor{ansi-green}{HTML}{00A250}44\definecolor{ansi-green-intense}{HTML}{007427}45\definecolor{ansi-yellow}{HTML}{DDB62B}46\definecolor{ansi-yellow-intense}{HTML}{B27D12}47\definecolor{ansi-blue}{HTML}{208FFB}48\definecolor{ansi-blue-intense}{HTML}{0065CA}49\definecolor{ansi-magenta}{HTML}{D160C4}50\definecolor{ansi-magenta-intense}{HTML}{A03196}51\definecolor{ansi-cyan}{HTML}{60C6C8}52\definecolor{ansi-cyan-intense}{HTML}{258F8F}53\definecolor{ansi-white}{HTML}{C5C1B4}54\definecolor{ansi-white-intense}{HTML}{A1A6B2}5556% commands and environments needed by pandoc snippets57% extracted from the output of `pandoc -s`58\providecommand{\tightlist}{%59\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}60\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}61% Add ',fontsize=\small' for more characters per line62\newenvironment{Shaded}{}{}63\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}64\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}65\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}66\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}67\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}68\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}69\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}70\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}}71\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}72\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}73\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}74\newcommand{\RegionMarkerTok}[1]{{#1}}75\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}76\newcommand{\NormalTok}[1]{{#1}}7778% Additional commands for more recent versions of Pandoc79\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{{#1}}}80\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}81\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}82\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{{#1}}}83\newcommand{\ImportTok}[1]{{#1}}84\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{{#1}}}}85\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}86\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}87\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{{#1}}}88\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}89\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{{#1}}}90\newcommand{\BuiltInTok}[1]{{#1}}91\newcommand{\ExtensionTok}[1]{{#1}}92\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{{#1}}}93\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{{#1}}}94\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}95\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}969798% Define a nice break command that doesn't care if a line doesn't already99% exist.100\def\br{\hspace*{\fill} \\* }101% Math Jax compatability definitions102\def\gt{>}103\def\lt{<}104% Pygments definitions105106\makeatletter107\def\PY@reset{\let\PY@it=\relax \let\PY@bf=\relax%108\let\PY@ul=\relax \let\PY@tc=\relax%109\let\PY@bc=\relax \let\PY@ff=\relax}110\def\PY@tok#1{\csname PY@tok@#1\endcsname}111\def\PY@toks#1+{\ifx\relax#1\empty\else%112\PY@tok{#1}\expandafter\PY@toks\fi}113\def\PY@do#1{\PY@bc{\PY@tc{\PY@ul{%114\PY@it{\PY@bf{\PY@ff{#1}}}}}}}115\def\PY#1#2{\PY@reset\PY@toks#1+\relax+\PY@do{#2}}116117\expandafter\def\csname PY@tok@gd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}}118\expandafter\def\csname PY@tok@gu\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}}119\expandafter\def\csname PY@tok@gt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}}120\expandafter\def\csname PY@tok@gs\endcsname{\let\PY@bf=\textbf}121\expandafter\def\csname PY@tok@gr\endcsname{\def\PY@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}}122\expandafter\def\csname PY@tok@cm\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}123\expandafter\def\csname PY@tok@vg\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}124\expandafter\def\csname PY@tok@vi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}125\expandafter\def\csname PY@tok@mh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}126\expandafter\def\csname PY@tok@cs\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}127\expandafter\def\csname PY@tok@ge\endcsname{\let\PY@it=\textit}128\expandafter\def\csname PY@tok@vc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}129\expandafter\def\csname PY@tok@il\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}130\expandafter\def\csname PY@tok@go\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}131\expandafter\def\csname PY@tok@cp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}}132\expandafter\def\csname PY@tok@gi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}}133\expandafter\def\csname PY@tok@gh\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}134\expandafter\def\csname PY@tok@ni\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}}135\expandafter\def\csname PY@tok@nl\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}}136\expandafter\def\csname PY@tok@nn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}137\expandafter\def\csname PY@tok@no\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}}138\expandafter\def\csname PY@tok@na\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}}139\expandafter\def\csname PY@tok@nb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}140\expandafter\def\csname PY@tok@nc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}141\expandafter\def\csname PY@tok@nd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}142\expandafter\def\csname PY@tok@ne\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}}143\expandafter\def\csname PY@tok@nf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}144\expandafter\def\csname PY@tok@si\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}145\expandafter\def\csname PY@tok@s2\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}146\expandafter\def\csname PY@tok@nt\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}147\expandafter\def\csname PY@tok@nv\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}148\expandafter\def\csname PY@tok@s1\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}149\expandafter\def\csname PY@tok@ch\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}150\expandafter\def\csname PY@tok@m\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}151\expandafter\def\csname PY@tok@gp\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}152\expandafter\def\csname PY@tok@sh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}153\expandafter\def\csname PY@tok@ow\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}154\expandafter\def\csname PY@tok@sx\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}155\expandafter\def\csname PY@tok@bp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}156\expandafter\def\csname PY@tok@c1\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}157\expandafter\def\csname PY@tok@o\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}158\expandafter\def\csname PY@tok@kc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}159\expandafter\def\csname PY@tok@c\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}160\expandafter\def\csname PY@tok@mf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}161\expandafter\def\csname PY@tok@err\endcsname{\def\PY@bc##1{\setlength{\fboxsep}{0pt}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}}162\expandafter\def\csname PY@tok@mb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}163\expandafter\def\csname PY@tok@ss\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}164\expandafter\def\csname PY@tok@sr\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}165\expandafter\def\csname PY@tok@mo\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}166\expandafter\def\csname PY@tok@kd\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}167\expandafter\def\csname PY@tok@mi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}168\expandafter\def\csname PY@tok@kn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}169\expandafter\def\csname PY@tok@cpf\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}170\expandafter\def\csname PY@tok@kr\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}171\expandafter\def\csname PY@tok@s\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}172\expandafter\def\csname PY@tok@kp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}173\expandafter\def\csname PY@tok@w\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}174\expandafter\def\csname PY@tok@kt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}}175\expandafter\def\csname PY@tok@sc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}176\expandafter\def\csname PY@tok@sb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}177\expandafter\def\csname PY@tok@k\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}178\expandafter\def\csname PY@tok@se\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}}179\expandafter\def\csname PY@tok@sd\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}180181\def\PYZbs{\char`\\}182\def\PYZus{\char`\_}183\def\PYZob{\char`\{}184\def\PYZcb{\char`\}}185\def\PYZca{\char`\^}186\def\PYZam{\char`\&}187\def\PYZlt{\char`\<}188\def\PYZgt{\char`\>}189\def\PYZsh{\char`\#}190\def\PYZpc{\char`\%}191\def\PYZdl{\char`\$}192\def\PYZhy{\char`\-}193\def\PYZsq{\char`\'}194\def\PYZdq{\char`\"}195\def\PYZti{\char`\~}196% for compatibility with earlier versions197\def\PYZat{@}198\def\PYZlb{[}199\def\PYZrb{]}200\makeatother201202203% Exact colors from NB204\definecolor{incolor}{rgb}{0.0, 0.0, 0.5}205\definecolor{outcolor}{rgb}{0.545, 0.0, 0.0}206207208209210% Prevent overflowing lines due to hard-to-break entities211\sloppy212% Setup hyperref package213\hypersetup{214breaklinks=true, % so long urls are correctly broken across lines215colorlinks=true,216urlcolor=urlcolor,217linkcolor=linkcolor,218citecolor=citecolor,219}220% Slightly bigger margins than the latex defaults221222\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}223224\title{Introduction to Scientific Computing in Python}225\author{Robert Johansson}226227\begin{document}228\maketitle229230\tableofcontents231232\newpage233\input{Lecture-0-Scientific-Computing-with-Python}234235\newpage236\input{Lecture-1-Introduction-to-Python-Programming}237238\newpage239\input{Lecture-2-Numpy}240241\newpage242\input{Lecture-3-Scipy}243244\newpage245\input{Lecture-4-Matplotlib}246247\newpage248\input{Lecture-5-Sympy}249250\newpage251\input{Lecture-6A-Fortran-and-C}252253\newpage254\input{Lecture-6B-HPC}255256\newpage257\input{Lecture-7-Revision-Control-Software}258259\end{document}260261262