在Python中是否有用于消除高斯的标准解决方案?

编程入门 行业动态 更新时间:2024-10-11 03:19:32
本文介绍了在Python中是否有用于消除高斯的标准解决方案?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

scipy/numpy/...的宇宙中是否存在用于矩阵高斯消除的标准方法?

有人通过Google找到了许多代码片段,但我希望尽可能使用受信任的"模块.

我终于发现,可以使用 LU分解完成此操作.这里的 U 矩阵表示线性系统的简化形式.

from numpy import array from scipy.linalg import lu a = array([[2.,4.,4.,4.],[1.,2.,3.,3.],[1.,2.,2.,2.],[1.,4.,3.,4.]]) pl, u = lu(a, permute_l=True)

然后u读取

array([[ 2., 4., 4., 4.], [ 0., 2., 1., 2.], [ 0., 0., 1., 1.], [ 0., 0., 0., 0.]])

取决于系统的可溶性,该基质具有上部三角形或梯形结构.在上述情况下,由于矩阵仅具有等级3,所以会出现零线.

Is there somewhere in the cosmos of scipy/numpy/... a standard method for Gauss-elimination of a matrix?

One finds many snippets via google, but I would prefer to use "trusted" modules if possible.

解决方案

I finally found, that it can be done using LU decomposition. Here the U matrix represents the reduced form of the linear system.

from numpy import array from scipy.linalg import lu a = array([[2.,4.,4.,4.],[1.,2.,3.,3.],[1.,2.,2.,2.],[1.,4.,3.,4.]]) pl, u = lu(a, permute_l=True)

Then u reads

array([[ 2., 4., 4., 4.], [ 0., 2., 1., 2.], [ 0., 0., 1., 1.], [ 0., 0., 0., 0.]])

Depending on the solvability of the system this matrix has an upper triangular or trapezoidal structure. In the above case a line of zeros arises, as the matrix has only rank 3.

更多推荐

在Python中是否有用于消除高斯的标准解决方案?

本文发布于:2023-11-22 01:37:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1615469.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:高斯   解决方案   标准   Python

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!