当前位置:   article > 正文

python 雅可比迭代方法_雅可比迭代法python

雅可比迭代法python


 

  1. #yangbocsu 2021.06.2 科技园7栋
  2. import numpy as np
  3. x = np.array([0.0,0.0,0.0])
  4. xn = np.array([0.0,0.0,0.0])
  5. for i in range(10):
  6. x[0] = 1.0*(13-3*x[1]-2*x[2])/8
  7. x[1] = 1.0*(12-2*x[1]-1*x[2])/9
  8. x[2] = 1.0*(8-1*x[1]-2*x[2])/5
  9. print(i+1,"次\t",x,end="\t")
  10. #向量的∞范数
  11. eps = x-xn
  12. eps=np.maximum(eps,-eps)#取绝对值
  13. print(np.max(a))#向量的∞范数
  14. if np.max(a)<0.003:
  15. break
  16. for j in range(3):
  17. xn[j] = x[j]

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/78114
推荐阅读
相关标签
  

闽ICP备14008679号