numpy

http://www.runoob.com/numpy/numpy-tutorial.html

基础

1
2
3
4
5
~ >python
Python 2.7.15 (default, Jun 17 2018, 13:05:56)
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

打印数组

1
2
3
import numpy as np
a=np.array([1,2,3])
print a

线性代数计算

1
2
3
4
5
6
7
>>> import numpy.matlib
>>> import numpy as np
>>> a = np.array([[1,2],[3,4]])
>>> b = np.array([[11,12],[13,14]])
>>> print(np.dot(a,b))
[[37 40]
[85 92]]