フィルターのクリア

How can I simplify the result of a symbolic expression with it's coefficients to an expression that only uses the variable names?

3 ビュー (過去 30 日間)
Hello,
I would like to use the symbolic toolbox to validate some equations and I was wondering if it is possible to simplify a result so that it does not show all coefficients but only the defined symbol names. The example only shows a simplified version of the problem, the actual equations are more complex.
Example:
a = sym("a", [3 3])
b = sym("b", [3 3])
c = sym("c", [3 1])
result = a*b*c
Result:
c1*(a1_1*b1_1 + a1_2*b2_1 + a1_3*b3_1) + c2*(a1_1*b1_2 + a1_2*b2_2 + a1_3*b3_2) + c3*(a1_1*b1_3 + a1_2*b2_3 + a1_3*b3_3)
c1*(a2_1*b1_1 + a2_2*b2_1 + a2_3*b3_1) + c2*(a2_1*b1_2 + a2_2*b2_2 + a2_3*b3_2) + c3*(a2_1*b1_3 + a2_2*b2_3 + a2_3*b3_3)
c1*(a3_1*b1_1 + a3_2*b2_1 + a3_3*b3_1) + c2*(a3_1*b1_2 + a3_2*b2_2 + a3_3*b3_2) + c3*(a3_1*b1_3 + a3_2*b2_3 + a3_3*b3_3)
But what I actually would like to see is:
a*b*c

採用された回答

Walter Roberson
Walter Roberson 2017 年 11 月 3 日
There is no operation for that in the Symbolic Toolbox. Internally, the symbolic engine MuPAD has no provision for the generalized notion of a "matrix" that might be matrix-multiplied as a whole: the symbolic engine only knows about arrays that are populated with something and whose individual elements are acted on.
  3 件のコメント
Chris B
Chris B 2017 年 11 月 4 日
This is an important information, thank you. I did not know that the symbolic toolbox does not respect the properties of matrices. Is there a way to define that matrix multiplications are non-commutative? Or is there another toolbox that is more suitable for this task?
Walter Roberson
Walter Roberson 2017 年 11 月 4 日
I think it just might be possible to go into the symbolic engine (MuPAD) and tell it to define a new DOMAIN and then fill in function "slots" for each desired operation. It might be a bit tricky to have objects of that DOMAIN cross back and forth between MATLAB and the symbolic engine, but I think something usable might be possible.
When I looked at this a few months ago, I seem to recall that I did have trouble with the print slots (character representation for the MATLAB side), but it has been long enough that I no longer recall exactly what I did.

サインインしてコメントする。

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by