How is (-2)^(2/3) different than ((-2)^2)^(1/3) ?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Paulo Oliveira
le 23 Jan 2014
Commenté : Paulo Oliveira
le 23 Jan 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 commentaires
Priya
le 23 Jan 2014
Modifié(e) : Priya
le 23 Jan 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.
Réponse acceptée
Roger Stafford
le 23 Jan 2014
Modifié(e) : Roger Stafford
le 23 Jan 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.
1 commentaire
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Spline Postprocessing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!