用于查找具有任意数量变量的任意数量线性方程的任意解的库
我必须找到具有任意数量的变量的任意数量的给定线性方程的任何解(可能存在许多或没有)。在爪哇。使用什么库和方法?实施什么?我想至少通过工作来实现它。
I have to finding any solution (there may exist many or none) of any number of given liner equations with any number of variables. In Java. What libraries and method use? What to implement? I want to make it with at least work as possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
尝试 Apache Commons 数学求解器 http://commons.apache.org/math/userguide/linear .html
Try the Apache Commons Math solvers http://commons.apache.org/math/userguide/linear.html
有多少个方程?解决方法的不同取决于与未知数的比较。
如果 N(未知数) < N(方程),您需要进行最小二乘解来获得系数。
如果 N(未知数) = N(方程),您可以使用带有枢轴或奇异值分解的 LU 分解来求解。
如果 N(未知数) > N(方程),您需要进行奇异值分解,这将为您提供零空间和最佳解决方案。
如果方程的数量非常,您可能需要考虑利用稀疏性或将矩阵写入磁盘并逐步求解。
Apache Commons Math 库包含所有这些。如果您使用 Java 编码,我推荐它。
Any number of equations? The means of solution is different depending on how that compares to the number of unknowns.
If N(unknowns) < N(equations), you'll need to do a least squares solution to obtain the coefficients.
If N(unknowns) = N(equations), you can solve using LU decomposition with pivoting or singular value decomposition.
If N(unknowns) > N(equations), you'll need to do a singular value decomposition, which will give you the null space and the best solution it can.
If the number of equations is very large, you may need to think about exploiting sparseness or writing the matrix out to disk and solving it in steps.
The Apache Commons Math library contains all these. I recommend it if you're coding in Java.
http://icl.cs.utk提供了经典 BLAS 线性代数库的 Java 端口
。 edu/f2j/
我以前没有使用过这个,但看起来它可能非常有用。
There is a Java port of the classic BLAS linear algebra libraries available at
http://icl.cs.utk.edu/f2j/
I have not used this before, but it looks like it could be very useful.