How do i do the reverse from expand function ?

조회 수: 16 (최근 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


Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기




Community Treasure Hunt

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

Start Hunting!

Translated by