gaussj() wrong?


Ludek
01-13-2004, 10:29 PM
Dear all,

Has anyone verified the gaussj() function (C-version)? It didn't work for me with these numbers:
9 3 4 7
4 3 4 8
1 1 1 3
(where the column on the right is a right-hand vector).
The matrix inverse should be:
-1 1 0
0 5 -20
1 -6 15
However, the result of gaussj() was completely different. (I haven't checked the solution vector but I presume it would be wrong as well).

I would appreciate any comment on that.
Thank you.
Ludek

Saul Teukolsky
01-14-2004, 09:40 AM
Hi Ludek,

Your claimed inverse is too big by a factor of -5. Looks like you forget to divide by the determinant when you calculated the inverse. gaussj is fine.

Saul Teukolsky

Ludek
01-14-2004, 04:20 PM
Dear Saul,

Many thanks! Yes, you are right, I forgot to divide it by the determinant. There's still a minor point that I don't understand (the determinant needs to be divided by 5 to get an exact match) but at least I know gaussj() works!
Thank you once again.

Regards,
Ludek