|
Prev: ASCII transfer with Conn4x
Next: circuit simulator
From: ~kurt on 15 Jan 2008 21:47 I got a reminder as to how sensitive matrix inversion is to roundoff. I had a C program where I was using two different methods to form sets of normal equations which were then inverted to get 2X2 variance/covariance matrices (think along the lines of a least squares fit). One method was well established, and another I was experimenting with. I was surprised to see that both methods were ending up with the same variance/covariance matrix (they take measurement bias into account differently). Now, inverting a 2X2 matrix is easy - just swap the diagonals, negate the off-diagonals, and divide everything by the determinant. So, to double check things I took out the HP32SII, and did the inversion manually by hand using only 5 significant figures. The answer didn't even come close to what the C program was outputting. I was convinced that I was misusing the matrix subroutines, and memory stomping on the arrays that held the matrices (this is C, not Java...). I don't know how much time I wasted re-calculating the inverse convinced that I was messing something up, or that there was a problem with the code I had just written. Finally, it hit me, and I used 12 significant figures. I got the same answer as the C program. 5 significant figures resulted in an answer that was an order of magnitude off. This kind of surprised me because all the numbers in the variance/covariance matrices where similar in magnitude (E9 and E10). It really drove home the reason why matrix inversion got so much attention in those numerical methods courses. Roundoff error does not propagate linearly! - Kurt
From: Bjoern Schliessmann on 16 Jan 2008 09:26 ~kurt wrote: > It really drove home the reason why matrix inversion got so much > attention in those numerical methods courses. Roundoff error does > not propagate linearly! Well perceived. Probably you want to read about http://en.wikipedia.org/wiki/Cond Regards, Bj�rn -- BOFH excuse #395: Redundant ACLs.
From: Bjoern Schliessmann on 16 Jan 2008 16:29 ~kurt wrote: > It really drove home the reason why matrix inversion got so much > attention in those numerical methods courses. Roundoff error does > not propagate linearly! Well perceived. Probably you want to read about http://en.wikipedia.org/wiki/Condition_number Regards, Bj�rn -- BOFH excuse #395: Redundant ACLs.
From: Irl on 17 Jan 2008 20:35 On Jan 16, 4:29 pm, Bjoern Schliessmann <usenet- mail-0306.20.chr0n...(a)spamgourmet.com> wrote: > ~kurt wrote: > > It really drove home the reason why matrix inversion got so much > > attention in those numerical methods courses. Roundoff error does > > not propagate linearly! > > Well perceived. Probably you want to read abouthttp://en.wikipedia.org/wiki/Condition_number > > Regards, > > Björn > > -- > BOFH excuse #395: > > Redundant ACLs. Department of Beating Dead Horses, perhaps: Having similar magnitudes doesn't help. Consider the two matrices 10.100 8.000 12.500 9.901 and 10.100 8.000 12.500 9.900 The determinants are in a ratio of 100:1. Thus, to 3 digits, measurement errors would make the solution of this set of linear equations nonsense. However, if the measurements are good to 3 more digits, the problem is simply a mild loss of precision. Systems which are ill-conditioned to a given precision may well be OK (albeit not great) to greater precision. HTH Irl
From: ttw6687 on 17 Jan 2008 22:07
Variance-Covariance matrices (we need a shorter name, perhaps scatter matrix) are notoriously ill-conditioned. Note that the vectors entering into the computation are "trying" to be the mean. |