赞
踩
一维矩阵的加减乘除
- import numpy as np
-
- a = np.array([4,2,3])
- b = np.array([2,5,7])
-
- c = a+b
- d = a-b
- e = a*b
- f = a/b
-
- print("加%s" % c)
- print("减%s" % d)
- print("乘%s" % e)
- print("除%s" % f)
打印
一维对二维的减价乘除
- import numpy as np
-
- a = np.array([4,2,3])
- b = np.array([[2,5,7],[1,2,3]])
-
- c = a+b
- d = a-b
- e = a*b
- f = a/b
-
- print("加%s" % c)
- print("减%s" % d)
- print("乘%s" % e)
- print("除%s" % f)
打印
另外
- import numpy as np
-
- a = np.array([4,2,3])
-
- c = a+2
- d = a-2
- e = a*2
- f = a/2
-
- print("加%s" % c)
- print("减%s" % d)
- print("乘%s" % e)
- print("除%s" % f)
打印
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。