How do i do the reverse from expand function ?

12 ビュー (過去 30 日間)
tomer gigi
tomer gigi 2021 年 11 月 12 日
回答済み: Chidvi Modala 2021 年 11 月 19 日
I have an expression lets say
and i want to simplify the expression to get
what is the proper way of doing this ?

回答 (1 件)

Chidvi Modala
Chidvi Modala 2021 年 11 月 19 日
Hi Tomer,
In general, you may use simplify(expr) function to perform algebraic simplification of expr. But simplify currently has some known issue with the simplification of sums. It cannot simplify your entire expression "a^2+2*a*b+b^2+b", but it can simplify "a^2+2*a*b+b^2" to "(a+b)^2". You may use the following example as a workaround.
syms a b;
simplify(expand(a^2+2*a*b+b^2)) + b




Community Treasure Hunt

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

Start Hunting!

Translated by