python numpy array calculation
Try to calculate with numpy
Array multiplication (multiplication of elements)
>>> import numpy as np
>>> from __future__ import division #For python2. Display after the decimal point
>>> my_array1 = np.array([1,2,3,4])
>>> my_array1
array([1, 2, 3, 4])
>>> my_array1*my_array1
array([ 1, 4, 9, 16])
Array subtraction
>>> my_array1-my_array1
array([0, 0, 0, 0])
Exponentiation of the array
>>> my_array1**2
array([ 1, 4, 9, 16])
Inner product of the array
>>> np.dot(my_array1,my_array1) #1*1+2*2+3*3+4*4
30