Output simpler version of symbolic polynomial expression
2 ビュー (過去 30 日間)
古いコメントを表示
When I run some MATLAB code, I get a symbolic expression that looks like this:
a*x^2 + 2*a*x*y + b + a*y^2
Looking at it, I know I can rewrite this as
a*(x + y)^2 + b
How do I get MATLAB to output the expression as the latter? Is there even a function to do so?
0 件のコメント
回答 (1 件)
madhan ravi
2020 年 10 月 8 日
編集済み: madhan ravi
2020 年 10 月 8 日
syms x y a b
z = a*x^2 + 2*a*x*y + b + a*y^2;
simplify(collect(z, a), 'Steps', 50)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Assumptions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!