How can I derive inverse of the matrix with infinite determinant?
26 次查看(过去 30 天)
显示 更早的评论
Hi guys, there is a matrix A which has finite dimension and finite-valued elements.
However, because of its large size and values, the determinant of A becomes infinite on MATLAB.
load("myMatrix.mat","A")
size(A)
max(max(abs(A)))
det(A)
Therefore, it cannot compute the inverse of the matrix precisely.
B = inv(A);
isdiag(A*B)
Is there way to compute the inverse of the matrix A?
Cheers,
0 个评论
回答(4 个)
Bruno Luong
2022-11-17
编辑:Bruno Luong
2022-11-18
Welcome to the world of numerical calculation. Every conclusion you made is wrong.
"det(A) = Inf Therefore, it cannot compute the inverse of the matrix precisely. ".
Wrong
A=eye(200)*1024;
det(A)
B=inv(A);
all(A*B == eye(size(A)), 'all') % A*B is exatly I, despite det(A) is Inf due to overflow
Check B is inverse of A using isdiag(A*B).
This is a bad numerically criteria as showed in the false negative answer example
A=[1 2; 3 4]
B = inv(A)
AB = A*B;
isdiag(AB) % Suppose to be TRUE
AB(2,1) % Suppose to be 0, but not exactly
3 个评论
Bruno Luong
2022-11-17
编辑:Bruno Luong
2022-11-17
The funny thing is the inconsistency of linear algebra - mostly det - in floating point world.
The matrix is numerical singular, so the determinant should be 0, yet it is Inf.
Bruno Luong
2022-11-17
移动:Bruno Luong
2022-11-17
"Is there way to compute the inverse of the matrix A?"
No.
The sum of all columns of your matrix A is numerically 0, therefore your matrix is not invertible.
2 个评论
Steven Lord
2022-11-17
The first of Cleve's Golden Rules of computation applies here. "The hardest things to compute are things that do not exist."
Bruno Luong
2022-11-17
Hmm read these two rules from Cleve I wonder this: things that do not exist are they unique?
It sounds like a non-sense question, but why it is non-sense?
If it does make sense I have no preference for the answer.
Walter Roberson
2022-11-17
编辑:Walter Roberson
2022-11-18
In theory if you have the symbolic toolbox, you could
digits(16);
sA = sym(A, 'd');
digits(32);
Ainv = inv(sA);
... But test it with a much smaller matrix first, as it might take very very long.
5 个评论
Bruno Luong
2022-11-18
编辑:Bruno Luong
2022-11-18
OK I make change accordingly to 'd' flag in my test code, and as you can see the symbolic is no bettrer than numerical method with "\", at least in this toy example.
Even if it use minor formula, there are a lot of cancellation going on in determinant so the summation order and tree (parenthesis) matter. The symbolic probably does the sumation in the implicit order of the implementation as it progres and no care about cancellation.
I'm not sure if the symbolic solution is any better than numerical method for precision point of view, let alone the computation time that goes as factorial of the dimesion.
Walter Roberson
2022-11-18
The point about this approach was that it should avoid the intermediate inf
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Linear Algebra 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!