%pylab inline
Here are some basic — and some more surprising — features of the iPython Notebook that has been used to build this collection of astronomy examples.
>>> n = 0
>>> for i in range(5):
... n += i
...
>>> print n
# Exception tracebacks are attractive, detailed!
plot([1, 2, 3], [4, 5, 'a'])
!pwd
!cal 1 2013
files = !ls /usr/bin
%load spectral_classification.py
# See examples at http://matplotlib.org/gallery.html
%load http://matplotlib.org/mpl_examples/api/radar_chart.py
%timeit '-'.join(('abc', 'def', 'ghi'))
%timeit '-'.join(['abc', 'def', 'ghi'])
from IPython.display import Image, HTML, Latex, YouTubeVideo
f = 'venv/lib/python2.7/site-packages/pyface/images/about.jpg'
Image(filename=f)
HTML('<iframe src="http://numpy.org/" height=240 width=480>'
'</iframe>')
YouTubeVideo('F4rFuIb1Ie4') # Fernando Pérez at PyConCA
from sympy.interactive import init_printing
init_printing()
from sympy import *
x, y = symbols('x y')
eq = ((x + y)**2 * (x + 1))
eq
expand(eq)
Latex(r'The Taylor series for $e^x$ is:'
r'$$\sum_{x=0}^\infty {x^n / n!}$$')
Recently, @jakevdp decided that his example plots looked too serious, and wanted them to look more like hand-drawn plots in xkcd.
http://jakevdp.github.com/blog/2012/10/07/xkcd-style-plots-in-matplotlib/