views:

90

answers:

2

Hi,

I needed an application for solving linear systems of equations (N up to 10), so I got different codes, and compile them, and they seem to work, but I get lots of problems with precision. I mean, the solvers are really very sensitive to small changes of the system.

So, could somebody recommend to me a reliable commandl ine application for this purpose? Or some useful open source code (and easy to compile)

Thanks

A: 

GNU Octave is essentially a free version of Matlab (the syntax is identical for basic operations), so you can try things out there and see how they compare to the answers that you're getting.

Having said that, if your answer is very sensitive to the input, it's possible that your problem is ill-conditioned - you can check this by computing the condition number of the matrix in Octave. It's hard to say what to do in that case without knowing more specifics on the problem.

Also, you don't mention which method you're currently using. Gaussian elimination (i.e. "what you learned in math class") is notoriously numerically unstable if you don't use pivoting (see the wikipedia entry for "Pivoting"); adding that might be enough to improve the quality of the results.

celion
Pay careful attention to what Chris writes in his second paragraph. If several different solvers all have problems with precision and are very sensitive to inputs then your problem has a problem, as it were. If you don't know what the condition number of a matrix is, or what it tells you about a problem you should spend some time learning about this and about the facilities your favourite applications offer for investigating these and related matters.
High Performance Mark
A: 

An approach is to use the numpy package in Python. You can create a 2d matrix A and a 1d vector b, then solve Ax=b for x using solve(A, x). It's part of the linalg subpackage of numpy.

Nathan Whitehead
thankscan you give me a link on how to create a matrix on python?
Werner
sorry if this is a stupid question ...
Werner
Check out http://www.scipy.org/Tentative_NumPy_TutorialThere is also a Numpy book http://www.tramy.us/numpybook.pdf
Nathan Whitehead
thanks a lot, very useful and neat
Werner