NumPy essentials

NumPy is a Python library for manipulation of vectors and arrays. We import it just like any Python module:


In [ ]:
import numpy as np

Vector creation


In [ ]:
# From Python lists or iterators
n1 = np.array( [0,1,2,3,4,5,6] )
n2 = np.array( xrange(6) )
# Using numpy iterators
n3 = np.arange( 10, 20, 0.1)

In [ ]:
n3

(to be extended)