Matlab R2014a version gives, -3.1175^0.5 = -1.7656 but (-3.1175)^0.5 = 0.0000 + 1.7656i Why?
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Matlab R2014a version gives, -3.1175^0.5 = -1.7656 but (-3.1175)^0.5 = 0.0000 + 1.7656i
Why?
Answers (2)
Orion
on 29 Mar 2016
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
on 29 Mar 2016
0 votes
The power operator ^ has higher precedence than the unary minus operator - but parentheses () have higher precedence than either ^ or -.
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!