-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAdvanced.tex
134 lines (86 loc) · 2.63 KB
/
Advanced.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
\section{Python Modules for Science}
\subsection{Important tools}
\begin{frame}{The IPython shell}
\begin{exbox}{IPython}
An interactive shell - may replace MatLab [tm] for interactive work
\end{exbox}
\begin{columns}
\column{0.25\textwidth}
\begin{itemize}
\item Syntax highlighting
\item Tab completion
\item Inline documentation
\item Easy profiling, timing...
\item IPython $\ge$ 0.11: inline plots...
\end{itemize}
\column{0.75\textwidth}
\includegraphics[width=\textwidth]{Figures/Ipython1.png}
\end{columns}
\end{frame}
\subsection{NumPy}
\begin{frame}{NumPy: Python meets an array data type}
\begin{exbox}{NumPy}
Fast and convenient array operations
\end{exbox}
\begin{itemize}
\item Lists: + does join, not add!
\item NumPy array: basic vector/matrix data type
\item Convenience functions (e.g. {\texttt{linspace(), zeros(), loadtxt()...}})
\item Array slicing
\item element-wise operations
\item Code using NumPy reads and writes very similar to modern Fortran
(slicing, vector valued indices...)
\end{itemize}
\end{frame}
\begin{frame}[fragile]{NumPy by examples}
\input{Pygsnippets/NumPy.tex}
\end{frame}
\subsection{SciPy}
\begin{frame}{SciPy}
\begin{exbox}{SciPy}
Numerical algorithms using NumPy arrays
\end{exbox}
Wrappers around well-established libraries\\[1.0ex]
Submodules:
\begin{columns}
\column{0.5\textwidth}
\begin{itemize}
\item {\texttt{linalg}}: linear algebra (lapack)
\item{\texttt{sparse}}: sparse matrices
\item {\texttt{fft}}: FFT (fftpack)
\item {\texttt{optimize}}: optimization, zeros (minpack)
\end{itemize}
\column{0.5\textwidth}
\begin{itemize}
\item {\texttt{integration}}: integration (quadpack, odepack)
\item {\texttt{special}}: special functions (amos...)
\item {\texttt{signal}}: signal processing
\end{itemize}
\end{columns}
\end{frame}
\begin{frame}[fragile]{SciPy: an example}
\input{Pygsnippets/SciPy.tex}
\end{frame}
\begin{frame}{SciPy: the example's output}
\begin{center}
\includegraphics[width=0.8\textwidth]{Figures/fit-png}
\end{center}
Already used here: \emph{Matplotlib}
\end{frame}
\subsection{Matplotlib}
\begin{frame}{Matplotlib}
(mostly) 2D plots
\begin{center}
\includegraphics[width=0.8\textwidth]{Figures/mpl}
\end{center}
Pylab: MatLab alternative for interactive work
\end{frame}
\begin{frame}{Some Pylab: the logistic map $x_{n+1}= rx_n(1-x_n)$}
\input{Pygsnippets/logMap.tex}
\end{frame}
\begin{frame}{Some Pylab: the logistic map $x_{n+1}= rx_n(1-x_n)$}
The last script produces this image:
\begin{center}
\includegraphics[width=0.9\textwidth]{Figures/logMap}
\end{center}
\end{frame}