expand and simplify are not reverse?

조회 수: 16 (최근 30일)
Niklas Kurz
Niklas Kurz 2021년 7월 9일
답변: Walter Roberson 2021년 7월 9일
I thought any symbolic function that I expand I can simplify getting same results in both direction. But it seems to be just oneway, because:
syms z; simplify(expand(1/((z-1)*(z-i))))
does not give back
1/((z-1)*(z-i)) %?
  댓글 수: 1
Rik
Rik 2021년 7월 9일
There is even a remark in the documentation suggesting to use expand first under some circumstances.
I'm not aware of any explicit requirements that suggest the factorized form is simpler. I think you can make a case for both forms.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2021년 7월 9일
syms x t
simplify(sin(x)^2 + cos(x)^2)
simplify(2*(sin(t)^2 + cos(t)^2))
The first sin formula in x and the sin formula in t both simplify to 1 and the overall second expression simplifies to 2.
If it were true that expand() is the reverse of simplify then it follows that if you were to
expand(sym(3))
then the result should be
sin(x)^2 + cos(x)^2 + 2 * (sin(t)^2 + cos(t)^2)
except that it should also be the same thing with several different variables instead. And, clearly, numerous other expressions.
We must arrive at the conclusion that expand() and simplify() are not inverse of each other.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by