How is (-2)^(2/3) different than ((-2)^2)^(1/3) ?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Paulo Oliveira
il 23 Gen 2014
Commentato: Paulo Oliveira
il 23 Gen 2014
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 Commenti
Priya
il 23 Gen 2014
Modificato: Priya
il 23 Gen 2014
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.
Risposta accettata
Roger Stafford
il 23 Gen 2014
Modificato: Roger Stafford
il 23 Gen 2014
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.
Più risposte (1)
Vedere anche
Categorie
Scopri di più su Spline Postprocessing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!