摘要:
import numpy as np a = np.array([[3,1],[1,2]]) b = np.array([9,8]) x1 = np.linalg.inv(a) @ b x2 = np.linalg.solve(a,b) print(x1);print(x2) print("学号:3 阅读全文
posted @ 2024-10-15 17:36
方~~
阅读(14)
评论(0)
推荐(0)
摘要:
import numpy as np a = np.array([[0,3,4],[1,6,4]]) b = np.linalg.norm(a,axis = 1) c = np.linalg.norm(a,axis = 0) d = np.linalg.norm(a) print("行向量2范数为: 阅读全文
posted @ 2024-10-15 17:35
方~~
阅读(21)
评论(0)
推荐(0)
摘要:
import numpy as np a = np.ones(4) b = np.arange(2,10,2) c = a @ b d = np.arange(16).reshape(4,4) f = a @ d g = d @ a print(a);print(b);print(c) print( 阅读全文
posted @ 2024-10-15 17:33
方~~
阅读(32)
评论(0)
推荐(0)
摘要:
import numpy as np a = np.array([[0,3,4],[1,6,4]]) b = np.array([[1,2,3],[2,1,4]]) c = a / b d = np.array([2,3,2]) e = a * d f = np.array([[3],[2]]) g 阅读全文
posted @ 2024-10-15 17:32
方~~
阅读(7)
评论(0)
推荐(0)
摘要:
import numpy as np a = np.array([[0,3,4],[1,6,4]]) b = a.sum() c1 = sum(a) c2 = np.sum(a,axis = 0) c3 = np.sum(a,axis = 0,keepdims = True) print(c2.sh 阅读全文
posted @ 2024-10-15 17:31
方~~
阅读(17)
评论(0)
推荐(0)
摘要:
import numpy as np a = np.arange(16).reshape(4,4) b = np.vsplit(a,2) print('行分割:\n',b[0],'\n',b[1]) c = np.hsplit(a,4) print('列分隔:\n',c[0],'\n',c[1],' 阅读全文
posted @ 2024-10-15 17:30
方~~
阅读(7)
评论(0)
推荐(0)
摘要:
import numpy as np a = np.arange(16).reshape(4,4) b = np.floor(5 * np.random.random((2,4))) c = np.ceil(6 * np.random.random((4,2))) d = np.vstack([a, 阅读全文
posted @ 2024-10-15 17:28
方~~
阅读(14)
评论(0)
推荐(0)
摘要:
import numpy as np a = np.arange(16).reshape(4,4) b = a[1][2] c = a[1,2] d = a[1:2,2:3] x = np.array([0,1,2,1]) print(a[x == 1]) print('学号:3008') 结果如下 阅读全文
posted @ 2024-10-15 17:27
方~~
阅读(16)
评论(0)
推荐(0)
摘要:
import numpy as np a = np.ones(4,dtype = int) b = np.ones((4,),dtype = int) c = np.ones((4,1)) d = np.zeros(4) e = np.empty(3) f = np.eye(3) g = np.ey 阅读全文
posted @ 2024-10-15 17:26
方~~
阅读(13)
评论(0)
推荐(0)
摘要:
import numpy as np a1 = np.array([1,2,3,4]) a2 = a1.astype(float) a3 = np.array([1,2,3],dtype = float) print(a1.dtype);print(a2.dtype);print(a3.dtype) 阅读全文
posted @ 2024-10-15 17:25
方~~
阅读(7)
评论(0)
推荐(0)