フィルターのクリア

Why are there different results of 'simplify' function for similar inputs?

2 ビュー (過去 30 日間)
Saketh
Saketh 2023 年 7 月 7 日
コメント済み: Dyuman Joshi 2023 年 7 月 10 日
Hello, I am using the simplify function for simplifying some equations in Matlab. Basically, it involves getting two symbolic expressions for the x and y components of stress-fields. In my case, the equations are pretty similar and look like this:
and
When I input these expressions to the simplify function, these are the results:
syms br1 bi1 r t;
simplify((br1*((3*cos(t/2))/2 + cos((5*t)/2)/2) + bi1*((7*sin(t/2))/2 + sin((5*t)/2)/2))/(2*r^(1/2)))
ans = 
simplify((br1*((5*cos(t/2))/2 - cos((5*t)/2)/2) + bi1*(sin(t/2)/2 - sin((5*t)/2)/2))/(2*r^(1/2)))
ans = 
My question is, even thought the terms in both equations are mathematically of the same 'complexity', why does the simplify function give different results? Does it have something to do with the way I wrote the equations or is it because the way Matlab stores them internally is different(if so, what)?
(Note: the number of steps in simplify also doesn't seem to affect this result, as taking 100 steps in both cases has the same output as above)
Thanks!!
  1 件のコメント
Dyuman Joshi
Dyuman Joshi 2023 年 7 月 10 日
"... even thought the terms in both equations are mathematically of the same 'complexity'..."
Are they?

サインインしてコメントする。

回答 (1 件)

N A POORNA CHANDRA
N A POORNA CHANDRA 2023 年 7 月 10 日
hi saketh, i think there is mistake in your equation some where in paranthesis i guess i used the first equation and replaced them it is woring fine here is the updated second equation
simplify((br1*((5*cos(t/2))/2 - cos((5*t)/2)/2) + bi1*((sin(t/2))/2 + sin((5*t)/2)/2))/(2*r^(1/2)))
  1 件のコメント
Saketh
Saketh 2023 年 7 月 10 日
編集済み: Saketh 2023 年 7 月 10 日
Hey Poorna,
The equation that you have given has a wrong sign. The last term has a '+' instead of a '-'. Changing this again gives the previous results, although it is interesting that a single sign change causes this.

サインインしてコメントする。

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by