How can I derive inverse of the matrix with infinite determinant?

조회 수: 29 (최근 30일)
Junho Kweon
Junho Kweon 2022년 11월 17일
댓글: Walter Roberson 2022년 11월 18일
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)
ans = 1×2
320 320
max(max(abs(A)))
ans = 2.2913e+04
det(A)
ans = Inf
Therefore, it cannot compute the inverse of the matrix precisely.
B = inv(A);
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.336932e-19.
isdiag(A*B)
ans = logical
0
Is there way to compute the inverse of the matrix A?
Cheers,

답변 (4개)

Bruno Luong
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)
ans = Inf
B=inv(A);
all(A*B == eye(size(A)), 'all') % A*B is exatly I, despite det(A) is Inf due to overflow
ans = logical
1
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]
A = 2×2
1 2 3 4
B = inv(A)
B = 2×2
-2.0000 1.0000 1.5000 -0.5000
AB = A*B;
isdiag(AB) % Suppose to be TRUE
ans = logical
0
AB(2,1) % Suppose to be 0, but not exactly
ans = 8.8818e-16
  댓글 수: 3
Bruno Luong
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.
Junho Kweon
Junho Kweon 2022년 11월 18일
@Bruno Luong Yeah, it is quite interesting that detmerninant is not zero though it is mathematically 0. May be in the mathematical computation of determinant, (very large number)- (very large number), and it is over the computational limitation of MATLAB. Therefore, it might be Inf comes out, and MATLAB just conclude that the determinant is infinite.

댓글을 달려면 로그인하십시오.


Torsten
Torsten 2022년 11월 17일
편집: Torsten 2022년 11월 17일
What do you get if you type
rank(A)
?
If it's smaller than 320, no inverse exists (or is almost impossible to calculate).

Bruno Luong
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
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
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
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
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
Walter Roberson 2022년 11월 18일
The point about this approach was that it should avoid the intermediate inf

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by