赞
踩
- #yangbocsu 2021.06.2 科技园7栋
-
- import numpy as np
- x = np.array([0.0,0.0,0.0])
- xn = np.array([0.0,0.0,0.0])
-
- for i in range(10):
- x[0] = 1.0*(13-3*x[1]-2*x[2])/8
- x[1] = 1.0*(12-2*x[1]-1*x[2])/9
- x[2] = 1.0*(8-1*x[1]-2*x[2])/5
- print(i+1,"次\t",x,end="\t")
-
- #向量的∞范数
- eps = x-xn
- eps=np.maximum(eps,-eps)#取绝对值
- print(np.max(a))#向量的∞范数
-
- if np.max(a)<0.003:
- break
- for j in range(3):
- xn[j] = x[j]
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。