Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Matlab R2014a version gives, -3.1175^0.5 = -1.7656 but (-3.1175)^0.5 = 0.0000 + 1.7656i Why?

1 回表示 (過去 30 日間)
milan
milan 2016 年 3 月 29 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Matlab R2014a version gives, -3.1175^0.5 = -1.7656 but (-3.1175)^0.5 = 0.0000 + 1.7656i
Why?

回答 (2 件)

Orion
Orion 2016 年 3 月 29 日
Because of the parenthesis.
The power operation is executed before the minus operation, so
-3.1175^0.5
is strictly equivalent to :
-(3.1175^0.5)
which is not the same as
(-3.1175)^0.5

Steven Lord
Steven Lord 2016 年 3 月 29 日
The power operator ^ has higher precedence than the unary minus operator - but parentheses () have higher precedence than either ^ or -.

Community Treasure Hunt

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

Start Hunting!

Translated by