Raising a negative value to a fraction power?

9 ビュー (過去 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 Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by