Rank of Symbolic Matrix returns incorrectly
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Brian Ulinski
il 3 Lug 2019
Commentato: Brian Ulinski
il 4 Lug 2019
Hello all,
I am trying to invert a 5x5 matrix of mixed symbolics and numbers. All columns are linearly independent, concluded by inspection. However rank() returns 4 and the inverse of the matrix returns a 5x5 matrix where all elements are Inf.
Is there a better way to invert this matrix? It is not singular, as an inverse is returned, but it seems to be of indeterminate form.
Code:
% define coefficients
mu1 = sym('mu1');
mu2 = sym('mu2');
mu3 = sym('mu3');
gam1 = sym('gam1');
gam2 = sym('gam2');
gam3 = sym('gam3');
L = sym('L');
% define matrices
B = [1 -1 -1 0 0
gam1/mu1 gam2/mu2 -gam2/mu2 0 0
0 exp(-gam2*L) exp(gam2*L) -exp(-gam3*L) -exp(gam3*L)
0 (-gam2/mu2)*exp(-gam2*L) (gam2/mu2)*exp(gam2*L) (gam3/mu3)*exp(-gam3*L) (-gam3/mu3)*exp(gam3*L)
0 0 0 0 0]
rank(B)
inv(B)
0 Commenti
Risposta accettata
Walter Roberson
il 3 Lug 2019
An array with a row or column that is all zero cannot be full rank. It is not enough for columns to be linearly independent: rows must be as well.
2 Commenti
John D'Errico
il 3 Lug 2019
Modificato: John D'Errico
il 3 Lug 2019
Put it like this: 5 columns with only 4 non-zero elements in the same columns in each can never be linearly independent. You can always write at least one of those columns as a linear combination of the others, even if that linear combination may be unbearably messy to write in symbolic form.
Più risposte (1)
John D'Errico
il 3 Lug 2019
"Concuded by inspection." I've gotta laugh at that.
B =
[ 1, -1, -1, 0, 0]
[ gam1/mu1, gam2/mu2, -gam2/mu2, 0, 0]
[ 0, exp(-L*gam2), exp(L*gam2), -exp(-L*gam3), -exp(L*gam3)]
[ 0, -(gam2*exp(-L*gam2))/mu2, (gam2*exp(L*gam2))/mu2, (gam3*exp(-L*gam3))/mu3, -(gam3*exp(L*gam3))/mu3]
[ 0, 0, 0, 0, 0]
Do you see that the 5th row of B is IDENTICALLY zero? Not just small, or close, but flat out zero.
Is it true that the rank of a 5x5 mtrix with one zero row is at MOST 4? (Yes.)
Is it true this matrix is not invertible? (Yes.)
It is very much singular. No inverse exists. When inv returns inf or NaNs for the inverse, that is a signal that the result is meaningless.
inv(B)
ans =
[ Inf, Inf, Inf, Inf, Inf]
[ Inf, Inf, Inf, Inf, Inf]
[ Inf, Inf, Inf, Inf, Inf]
[ Inf, Inf, Inf, Inf, Inf]
[ Inf, Inf, Inf, Inf, Inf]
Is there a better way to invert that matrix? (No, since an inverse does not exist. It cannot exist. It will never exist.)
So, concluded by inspection? A bad conclusion.
A pseudo-inverse will exist. But that is only of value some of the time, and it will be highly computationally intensive to compute in fully symbolic form. A pseudo-inverse has some properties that may or may not be of value, but it is NOT an inverse.
0 Commenti
Vedere anche
Categorie
Scopri di più su Linear Algebra in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!