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