How to suppress errors in matrix algebra involving very large matrices ?
1 view (last 30 days)
Show older comments
I have two very large matrices, A and B which constitute an equation
A* x + B* y =0
I am interested in solving for x (denoted x_star) so
x_star = pinv(A) * (- B*y);
Then, I back- substitute x_star to check the accuracy
A* x_star + B* y
But this value is not zero. Its usually a large number. How do I ensure this is zero? The matrices A and B are given as
y= [1,0]';
A(1,1) = 4.15325070802278e+22 - .07633591784246e+18i ;
A(1,2) = 9.04710238303399e+20- 8.73556649303388e+16i ;
A(2,1) = -9.04710238303399e+20+ .73556649303387e+16i;
A(2,2) = -1.9707469469826e+19 + 1.87151868951167e+15i ;
B(1,1) = 2.57576471264519e+18
B(1,2) = -1.18245242413448e+20 ;
B(2,1) = -5.610835634053e+16 ;
B(2,2 ) = 2.57575785721108e+18;
0 Comments
Answers (2)
Matt J
on 13 Dec 2016
Edited: Matt J
on 13 Dec 2016
You can't make it zero. To hope for that is to be in denial of the realities of floating point arithmetic. But as for your specific data, the substitution result looks pretty reasonable,
>> A*x_star+B*y
ans =
1.0e+07 *
0.0001 + 4.5513i
-0.0000 - 0.0991i
Looks pretty small to me - certainly when compared to the magnitude of the elements of A and B which are O(1e20).
0 Comments
See Also
Categories
Find more on Numbers and Precision in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!