Kenneth, the idea is really great. Also that you posted the code.Started to play a little bit with it and found some things. If you still watch this post it would be great if you could comment to it?
1. does not seem to run if input is large
2. with 6 or more digits it seems to convert to a wrong number.
x = 0.555555
xFrac = new Fraction(x)
xFrac.ToDouble = -0,444445
xFrac.ToString = -255505987455949225841282/574887753166194300400009
Well, you can't. But you'd be advised to use Gauss-Seidel algorithm instead of this.
You can use Gaussian elimination to get good start values for the Gauss-Seidel, and do some checks and fine tuning with the iterative solver. You should also be aware that for solutions with close eignvalues, you could get very unpredictable results.
Even with double accuracy we do not obtain the exact value (x=1, y=1, and z=1), and Gaussian Elimination does suffer from an extreme requirement of numbers of digits in the calculation. This could be solved using fraction calculations with the use of the class System.Numerics.BigInteger instead of Decimal or Double in the calculations, this would eliminate errors of calculations, even for relatively small numbers. We should mention here that we could use either the Gauss-Jordan or better the Gauss-Seidel iteration schema instead.
So I guess that takes care of most of your complaint?
Thanks to VB’s lack of matrix functions, I have recently been perusing the internet looking for an article on matrix inversion. There are a lot of halfhearted attempts out there. This article is great. It does the best job I’ve found of explaining Gaussian Elimination and the code is very well written, very professional.
Completely underlooks the issue of matrix condition number and gives a false feeling of accuracy with an overly costly method.
Well, you could try a Hilbert matrix with this approch, I dont think it would get any better than this. It is costly, due to the fraction class, and for accuracy, it wont be better than the numbers entered into the equations, with non transcendental numbers within the double precition it would be excact.
Also a wrong idea to bubble sort for pivoting !
The bubble sort is used to get the highest absolute number, so the sorting is incidental, and not fully needed but was easy to implement.