IPython

IPython (http://ipython.org) provides a rich architecture for interactive computing with:

  • Powerful interactive shells (terminal and Qt-based).
  • A browser-based notebook with support for code, text, mathematical expressions, inline plots and other rich media.
  • Support for interactive data visualization and use of GUI toolkits.
  • Flexible, embeddable interpreters to load into your own projects.
  • Easy to use, high performance tools for parallel computing.

Notebook

Text can be added to IPython Notebooks using Markdown cells. Markdown is a popular markup language that is a superset of HTML. You can even use LaTeX formulas:

\begin{equation*} P(E) = {n \choose k} p^k (1-p)^{ n-k} \end{equation*}

System Shell

In [5]:
files = !ls # ! means execute command in the shell, which in this case is assigned to a variable
files
Out[5]:
['BioSpeech',
 'ipython.ipynb',
 'numpy.ipynb',
 'rosenblatt.jpg',
 'scipy.ipynb',
 'stockholm_td_adj.dat']
In [6]:
for file in files:
    res = !file $file # reference python variable in shell command using $
    print("{}:\n{}".format(file, res))
BioSpeech:
['BioSpeech: directory']
ipython.ipynb:
['ipython.ipynb: ASCII English text, with very long lines']
numpy.ipynb:
['numpy.ipynb: ASCII Java program text, with very long lines']
rosenblatt.jpg:
['rosenblatt.jpg: JPEG image data, JFIF standard 1.01']
scipy.ipynb:
['scipy.ipynb: ASCII English text, with very long lines']
stockholm_td_adj.dat:
['stockholm_td_adj.dat: ASCII text, with CRLF line terminators']

Simple Plotting Example

In [7]:
%pylab inline
Populating the interactive namespace from numpy and matplotlib
In [8]:
plot([1, 2, 10, 2, 1])
Out[8]:
[<matplotlib.lines.Line2D at 0x110bb8ed0>]