Matrix Calculations

Mathematical vector and matrix (array) calculations are provided by the Numerical Python (NumPy) package from www.scipy.org

sinus curve using linspace and sin from the numpy package

>>> from numpy import *

>>> x = linspace(-1,1,5) # (start, stop, num)

array([-1. , -0.5, 0. , 0.5, 1. ])

>>> y = sin(x)

array([-0.8414, -0.4794, 0., 0.4794, 0.8414])

convert list to array (vector/matrix) structure

>>> mylist = [1,2,3]

>>> x = array(mylist)

array([1, 2, 3])