MatLAB do not simplify (a^2)^(1/2) in symbolic ToolBox?
24 ビュー (過去 30 日間)
古いコメントを表示
>> simplify((cos(phymi)^2)^(1/2), 3000)
ans =
(cos(phymi)^2)^(1/2)
>> rewrite (((cos(phymi))^2)^(1/2), 'exp')
ans =
((exp(-phymi*1i)/2 + exp(phymi*1i)/2)^2)^(1/2)
>> simplify((phymi^2)^(1/2), 5000)
ans =
(phymi^2)^(1/2)
0 件のコメント
採用された回答
Walter Roberson
2018 年 8 月 3 日
編集済み: Walter Roberson
2018 年 8 月 3 日
MATLAB assumes that symbols might have complex values unless you tell it they are not complex. For complex values, sqrt(x^2) is not the same as x. For that matter, sqrt(x^2) is not the same as x even just for negative real values.
If you know for sure that your values are nonnegative, then add an assumption about that, such as
syms phymi
assume(phymi >= 0)
1 件のコメント
Nathan Hardenberg
2023 年 7 月 27 日
You can also assume directly:
syms a
syms b real
syms c positive
syms d real positive
A = simplify( sqrt(a^2) )
B = simplify( sqrt(b^2) )
C = simplify( sqrt(c^2) )
D = simplify( sqrt(d^2) )
その他の回答 (1 件)
Star Strider
2018 年 8 月 3 日
It does:
syms phymi
a = simplify((cos(phymi)^2)^(1/2), 'Steps',3000, 'IgnoreAnalyticConstraints',1)
a =
cos(phymi)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Symbolic Math Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!