Library for finding any solution of any number of linear equations with any number of variables

StackOverflow https://stackoverflow.com/questions/4717655

문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

Try the Apache Commons Math solvers http://commons.apache.org/math/userguide/linear.html

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top