MATLAB Answers

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

1 view (last 30 days)
milan
milan on 29 Mar 2016
Answered: Steven Lord on 29 Mar 2016
Matlab R2014a version gives, -3.1175^0.5 = -1.7656 but (-3.1175)^0.5 = 0.0000 + 1.7656i
Why?

  0 Comments

Sign in to comment.

Answers (2)

Orion
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

  0 Comments

Sign in to comment.


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

  0 Comments

Sign in to comment.

Sign in to answer this question.


Translated by