##// END OF EJS Templates
Merge pull request #6045 from minrk/nbformat4...
Merge pull request #6045 from minrk/nbformat4 nbformat v4

File last commit:

r18596:2d590459
r18617:482c7bd6 merge
Show More
notebook2.ipynb
261 lines | 10.3 KiB | text/plain | TextLexer

NumPy and Matplotlib examples

First import NumPy and Matplotlib:

In [1]:
%pylab inline
Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.kernel.zmq.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>)
No description has been provided for this image
In [ ]: