
数值计算与优化
LazzyBoi懒惰男孩
Everybody dies in their nightmare.
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
用LU分解法来解矩阵方程
运用的是克劳特(Crout)分解,也就是U是单位上三角形矩阵 import numpy as np #np.set_printoptions(threshold=np.inf) def LU(A, n): L = [[0 for x in range(n)] for y in range(n)] U = [[0 for x in range(n)] for y in ...原创 2018-07-15 09:11:24 · 2259 阅读 · 0 评论 -
雅可比迭代法、高斯 - 赛德尔迭代法和SOR迭代法的实现
雅可比迭代法: 高斯-赛德尔迭代法: SOR迭代法: import numpy as np import numpy.linalg as nl def MaxOfList(A): max = A[0] for i in range(0, len(A)): if A[i] > max: max =...原创 2018-07-15 09:14:46 · 10642 阅读 · 2 评论 -
共轭梯度法与QR法解矩阵方程
共轭梯度法: QR法: import numpy as np import numpy.linalg as nl def ConjugateGradient(A, b, n, x0): x = x0 r = b - np.dot(A, x0) p = r for i in range(0, n): a = np.dot(r.trans...原创 2018-07-15 09:18:08 · 724 阅读 · 0 评论 -
梯度下降法和加速梯度下降法的实现
import numpy as np import numpy.linalg as nl def GradientDescent(A, b): num = 0 xOld = np.zeros([1000, 1]) xNew = np.zeros([1000, 1]) gamma = 1e-8 while num < 1000: ...原创 2018-07-15 09:20:59 · 1063 阅读 · 0 评论