Info
此问题已关闭。 请重新打开它进行编辑或回答。
Matlab R2014a version gives, -3.1175^0.5 = -1.7656 but (-3.1175)^0.5 = 0.0000 + 1.7656i Why?
1 次查看(过去 30 天)
显示 更早的评论
Matlab R2014a version gives, -3.1175^0.5 = -1.7656 but (-3.1175)^0.5 = 0.0000 + 1.7656i
Why?
0 个评论
回答(2 个)
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
0 个评论
Steven Lord
2016-3-29
The power operator ^ has higher precedence than the unary minus operator - but parentheses () have higher precedence than either ^ or -.
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!