Preserve the order of matrix when doing symbolic matrix multiplication
16 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Lily Zhang
el 8 de Mzo. de 2021
Comentada: Lily Zhang
el 16 de Feb. de 2022
Hi community,
I have been trying to use Matlab to do a large matrix multiplication using the symbolic tool. However, I found that the result it gave me is confusing in the order of matrices. Searched the mathwork forums and found a similar question without anwers:
So I decided to raise a new one and see if anyone knows the answer.
Problem I encounter is,
I define symbolic matrix as
A = sym('A', [1,1]);
B = sym('B',[1,1]);
and calculate
C = B*A,
and matlab will give me the answer C = A01*B01 which isn't the right order. The problem seems to root in the fact that matlab see the symbols as scalars when defined the dimension of [1,1], but I have to do this as my entire matrix is too big (38*38) so if I do dimension more than 1, it is very difficult to extract the matrix from the result.
Is there a way to force the order when doing multiplication? If not, could someone suggest other tools that can do this please?
Thanks in advance!
0 comentarios
Respuesta aceptada
Walter Roberson
el 8 de Mzo. de 2021
This is not possible in any released versions.
It might be possible in a future version.
In all released versions, individual symbolic variables are always treated as scalars, and then the internal sorting rules designed to detect duplicate expressions come into play to re-order the names.
5 comentarios
Walter Roberson
el 16 de Feb. de 2022
Note that as of R2021a, defining symbolic matrix became possible. R2021a was released a couple of weeks after the question was asked, so as of the time the question was asked, no released version handled the task, only prerelease
Más respuestas (0)
Ver también
Categorías
Más información sobre Assumptions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!