NumPy and Matplotlib examples

First import NumPy and Matplotlib:


In [1]:
%pylab inline


Welcome to pylab, a matplotlib-based Python environment [backend: module://ipykernel.pylab.backend_inline].
For more information, type 'help(pylab)'.

In [2]:
import numpy as np

Now we show some very basic examples of how they can be used.


In [6]:
a = np.random.uniform(size=(100,100))

In [7]:
a.shape


Out[7]:
(100, 100)

In [8]:
evs = np.linalg.eigvals(a)

In [10]:
evs.shape


Out[10]:
(100,)

Here is a cell that has both text and PNG output:


In [14]:
hist(evs.real)


Out[14]:
(array([95,  4,  0,  0,  0,  0,  0,  0,  0,  1]),
 array([ -2.93566063,   2.35937011,   7.65440086,  12.9494316 ,
        18.24446235,  23.53949309,  28.83452384,  34.12955458,
        39.42458533,  44.71961607,  50.01464682]),
 <a list of 10 Patch objects>)

This cell is just markdown for testing whether an ASCIIDoc quirk is caught.

one test two tests. three tests


In [ ]: