How to Simplify an symbolic expression

조회 수: 2 (최근 30일)
safi58
safi58 2017년 4월 18일
댓글: Andrew Newell 2017년 4월 23일
Hi all, I want to simplify this equation
a= 2 atan((-2+Sqrt(4-gama^2 *l^2* M^2-4* gama *l* M^2 *tan(gama/2)+4* tan(gama/2)^2-4 *M^2 *tan(gama/2)^2))/(gama* l* M+2* tan(gama/2)+2* M* tan(gama/2)))
into this form
a= (gama/2)-asin(((gama*l*M)/2)*cos(gama/2)+M*sin(gama/2))
Can anyone help?
  댓글 수: 7
Torsten
Torsten 2017년 4월 20일
Or maybe this can help:
https://de.mathworks.com/help/symbolic/isequaln.html
Best wishes
Torsten.
safi58
safi58 2017년 4월 21일
This is basically a tool for checking equivalence but that is not I am after. Thanks.

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

답변 (2개)

Andrew Newell
Andrew Newell 2017년 4월 21일
If I define
a= 2*atan((-2+sqrt(4-gama^2 *l^2* M^2-4* gama *l* M^2 *tan(gama/2)+4* tan(gama/2)^2-4 *M^2 *tan(gama/2)^2))/(gama* l* M+2* tan(gama/2)+2* M* tan(gama/2)));
b = (gama/2)-asin(((gama*l*M)/2)*cos(gama/2)+M*sin(gama/2));
and substitute pi for gama,
subs(a,gama,pi)
subs(b,gama,pi)
I get a==NaN and b==pi/2 - asin(M). So they are not the same. I find that applying simplify to a does not change it significantly.
  댓글 수: 5
Torsten
Torsten 2017년 4월 21일
I still don't understand why you try to transform the first expression into the second if - as you write - you are sure that both expressions yield the same values for a (at least in cases where both expressions are real-valued).
Best wishes
Torsten.
safi58
safi58 2017년 4월 22일
Hi Torsten,
I want to transform the first expression because second one is more compact and easy to read.

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


Walter Roberson
Walter Roberson 2017년 4월 21일
I randomly substituted M=2, l=3. With those two values, the two expressions are not equal. One of the two goes complex from about gama = pi to gama = 17*pi/16 . From 17*pi/16 to roughly 48*Pi/41 the difference between the two is real valued . After that the difference has a real component of 2*pi and an increasing imaginary component.
  댓글 수: 8
safi58
safi58 2017년 4월 23일
Yes, without the return condition, it gives the solution.
Andrew Newell
Andrew Newell 2017년 4월 23일
To summarize what Walter and I are saying, the two expressions are clearly not always equal, and the conditions under which they are equal are hard to pin down. Perhaps you should look more closely at how they did it in the article. Not that published work is always 100% correct.

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

카테고리

Help CenterFile Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by