Rank on symbolic matrices
Show older comments
Hey all,
I'm trying to figure out the rank of several (sym) matrices that I am working on and the built-in 'Rank' function gives me different answer.
As I saw in the help, It's not reliable and I can't trust it ("rank returns an incorrect result because the outputs of intermediate steps are not simplified").
Is there a different way to get the rank of my matrices?
TIA
9 Comments
What would you want MATLAB to return for the rank of this matrix?
X = sym('x', [2, 2])
No, I'm not going to tell you anything about the elements inside X.
Ohad Shapira
on 5 Apr 2021
Bruno Luong
on 5 Apr 2021
Edited: Bruno Luong
on 5 Apr 2021
"But as you can see, the elements in the first culomn are equal (trigonometric identities) so I would expect to get rank=1"
I'm only aware that sin(w*t)^2-1 is equal to MINUS cos(w*t)^2
Ohad Shapira
on 5 Apr 2021
Bruno Luong
on 5 Apr 2021
When a is used? When t is declared as real?
Ohad Shapira
on 5 Apr 2021
Bruno Luong
on 5 Apr 2021
Maybe some one that own symbolic tbx can help you (I don't) but I wonder what do you get with an even simpler matrix
A=sym([t, w*t; 1, w]);
rank(A)
Bruno Luong
on 5 Apr 2021
According to https://www.mathworks.com/help/symbolic/rank.html it seems you cannot use RANK until a numerical value is plugged-in.
Seem like very limited usefulness to me.
That reminds me why I don't like using computer symbolic calculation.
Ohad Shapira
on 5 Apr 2021
Answers (1)
Aditya Patil
on 7 Apr 2021
0 votes
Rank does not take identities satisfied by functions into account. As a workaround, substitute values into variables, and then calculate rank. See Rank Function Does Not Simplify Symbolic Calculations more further details.
2 Comments
Ohad Shapira
on 7 Apr 2021
Bruno Luong
on 7 Apr 2021
Edited: Bruno Luong
on 7 Apr 2021
May be you can select p arbitrary combinations of values of your variables and substitute in then calculation of the rank after substitution.
If the ranks obtained after substitution give the identical result then it is ikely this holds true for almost all values.
I would suggest select p as the size of the matrix (n) + 1 or larger, because the determinant is a polynomial of order n, threfore has n+1 DOFs.
Categories
Find more on Number Theory 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!
