How is (-2)^(2/3) different than ((-2)^2)^(1/3) ?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi everybody.
It's the first time I ask a question here.
I would like to understand how is that possible that the following expressions give different results:
>> (-2)^(2/3)
ans =
-0.7937 + 1.3747i
>> ((-2)^2)^(1/3)
ans =
1.5874
댓글 수: 2
Priya
2014년 1월 23일
편집: Priya
2014년 1월 23일
According to my point of view, in the case of ((-2)^2)^(1/3), it first computes the part ((-2)^2), which gives 4. This is then calculated with ^(1/3). ie., 4^(1/3) which gives 1.5874.
So it should be (-2)^(2*1/3) which is same as (-2)^(2/3) instead of ((-2)^2)^(1/3). It's the placement of parentheses that matters.
채택된 답변
Roger Stafford
2014년 1월 23일
편집: Roger Stafford
2014년 1월 23일
This seeming inconsistency is due to the fact that ideally each of these two expressions has three roots or values and these are the same values, namely the three "cube roots of unity" times the real value 2^(2/3). They are:
+2^(2/3) = 1.5874
-1/2^(1/3)+3^(1/2)/2^(1/3)*i = -0.7937 + 1.3747*i
-1/2^(1/3)-3^(1/2)/2^(1/3)*i = -0.7937 - 1.3747*i
It would generally be an inconvenience if matlab always returned all three each time, so it chooses to give what is regarded as a "principal" value and this depends on the form of the expression. In your case your two different expression forms, though equivalent mathematically, had different principal forms and thus received different values.
This is similar to the situation with 4^(1/2) which has two roots, +2 and -2. It would be inconvenient for most purposes if both were returned by matlab, so only +2 is returned. If you write it as
4^(1/2) = ((-2)*(-2))^(1/2) = ((-2)^(1/2))*((-2)^(1/2))
you can trick it into giving you -2 as the answer.
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!