필터 지우기
필터 지우기

Raising a negative value to a fraction power?

조회 수: 2 (최근 30일)
Ahmed
Ahmed 2020년 11월 24일
댓글: Ahmed 2020년 11월 24일
I am rasing a negative value to a fraction power. Depending on how I write the operation (putting the negative value in parenthesis or not), the answer changes (see below)? Am I missing something?

채택된 답변

Alan Stevens
Alan Stevens 2020년 11월 24일
Exponentiation has a higher priority than negation, so -2^1.2 is -(2^1.2), this results in a negative real. On the other had (-2)^1.2 raises a negative number to a fractional power, because parentheses take priority over exponentiation, and the result is a complex number.
  댓글 수: 1
Ahmed
Ahmed 2020년 11월 24일
Thanks alot. Yes, I was missing this MATLAB operator precedence rules when parenthesis are involved.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by