【python】 numpyメモ

sqrt 平方根

import numpy as np
np.sqrt([1,2,3])
# array([ 1.        ,  1.41421356,  1.73205081])
np.sqrt(2)
# 1.4142135623730951

dot 内積

 v1 = [1,2,3]
 v2 = [2,3,4]
 np.dot(v1,v2) #20

degrees radianを返す

np.degrees(3.14) 
#179.90874767107849
np.degrees(np.pi)
#180
#np.piは円周率 (≒3.1415926)

power 累乗

np.power([1,2,3],2) #配列要素をそれぞれ2乗
#array([1, 4, 9])