Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top