The Stack Overflow podcast is back! Listen to an interview with our new CEO.

New answers tagged

1

The $2\times 2$ matrix has determinant close to zero, and so its condition number is very large, causing numerical instability. The explicit solution of your system is $$ x=\frac{a}{a^2-b^2}, y=-\frac{b}{a^2-b^2}. $$ Therefore $$ x+y = \frac{a-b}{a^2-b^2} = \frac{1}{a+b}, $$ thus avoiding the numerical issues.


1

It’s a 3x3 matrix, so it can be done in constant time O(1). I can’t see where a “k” comes into this problem.


0

Since you are subtracting $Z$ from $I$, you must compute the lower part of the matrix. If it was reversed, you only had to compute the new diagonal. The total number of subtractions is therefore $(k^2 + k)/2$.


Top 50 recent answers are included