day2/session3.tex
branchscipy2010
changeset 429 58a2d1766197
parent 389 aa392117454f
child 431 9126059d6b37
equal deleted inserted replaced
428:ee689f7c3122 429:58a2d1766197
   283     \item \alert{Use the former only in interactive mode}
   283     \item \alert{Use the former only in interactive mode}
   284     \end{itemize}
   284     \end{itemize}
   285 \end{frame}
   285 \end{frame}
   286 
   286 
   287 \begin{frame}[fragile]
   287 \begin{frame}[fragile]
       
   288   \frametitle{IPython namespace}
       
   289   \begin{lstlisting}
       
   290 
       
   291 In [4]: whos
       
   292 Interactive namespace is empty.
       
   293 
       
   294   \end{lstlisting}
       
   295 \end{frame}
       
   296 
       
   297 \begin{frame}[fragile]
       
   298   \frametitle{IPython namespace}
       
   299   \begin{lstlisting}
       
   300 
       
   301 In [5]: from numpy import *
       
   302 
       
   303 In [6]: whos
       
   304 
       
   305   \end{lstlisting}
       
   306 \end{frame}
       
   307 
       
   308 \begin{frame}[fragile]
   288   \frametitle{Package hierarchies}
   309   \frametitle{Package hierarchies}
   289   \begin{lstlisting}
   310   \begin{lstlisting}
   290 from scipy.integrate import odeint
   311 from scipy.integrate import odeint
   291 
   312 
   292 from scipy.optimize import fsolve
   313 from scipy.optimize import fsolve
   327 pylab.plot(x, x*scipy.sin(x), 'r', linewidth=3)
   348 pylab.plot(x, x*scipy.sin(x), 'r', linewidth=3)
   328 pylab.legend(['x', '-x', 'sin(x)', 'xsin(x)'])
   349 pylab.legend(['x', '-x', 'sin(x)', 'xsin(x)'])
   329 pylab.annotate('origin', xy = (0, 0))
   350 pylab.annotate('origin', xy = (0, 0))
   330 pylab.xlim(-5*scipy.pi, 5*scipy.pi)
   351 pylab.xlim(-5*scipy.pi, 5*scipy.pi)
   331 pylab.ylim(-5*scipy.pi, 5*scipy.pi)
   352 pylab.ylim(-5*scipy.pi, 5*scipy.pi)
       
   353   \end{lstlisting}
       
   354 \end{frame}
       
   355 
       
   356 \begin{frame}[fragile]
       
   357   \frametitle{\texttt{import} - the community convention}
       
   358   \begin{lstlisting}
       
   359 
       
   360 import numpy as np
       
   361 np.linspace(-5 * np.pi, 5 * np.pi, 500)
       
   362 
       
   363 import scipy as sp
       
   364 sp.linspace(-5 * sp.pi, 5 * sp.pi, 500)
       
   365 
   332   \end{lstlisting}
   366   \end{lstlisting}
   333 \end{frame}
   367 \end{frame}
   334 
   368 
   335 \begin{frame}
   369 \begin{frame}
   336   \frametitle{Modules: Standard library}
   370   \frametitle{Modules: Standard library}