# Mathematica gives imaginary results for polynomials [duplicate]

I was trying to plot a very simple polynomial function:

Plot[x^(2./3.),{x,-0.5,-0.2}]

Mathematica tells me that in this region, the result is always imaginary, but from fundamental math the result should be real. So why the difference?

To make the question clear: I know how to get the correct plot, but I want to understand why mathematica gives us imaginary result. How did mathematica do the calculation inside the kernal?

Thanks!

## marked as duplicate by J. M. will be back soon♦Aug 30 '17 at 16:10

• Because (see the docs of Power, under Scope) "the principal root is always used. You can use CubeRoot[x^2] or Surd[x^2, 3]. – corey979 Aug 30 '17 at 15:13
• Great, that answers my question. Thanks a lot. – Y.Du Aug 30 '17 at 15:20
• As a terminological note: $x^\frac23$ is an algebraic function, but certainly not a polynomial. – J. M. will be back soon Aug 30 '17 at 16:11

Plot[CubeRoot[x]^2, {x, -0.5, -0.2}]


or

Plot[Surd[x, 3]^2, {x, -0.5, -0.2}]

• Hi jiaoeyushushu, thanks for your reply. I actually know how to get the correct plot. But do you know why mathamatica gives us imaginary results? Thanks. – Y.Du Aug 30 '17 at 15:14
• From the Documentation Center: Power[x,y] has a branch cut discontinuity for y running from -[Infinity] to 0 in the complex x plane for noninteger y. Because of this branch cut, Power[x,1/n] returns a complex root by default instead of the real one for negative real x and odd positive n. To obtain a real-valued n[Null]^th root, Surd[x,n] can be used. The special case CubeRoot[x] corresponds to Surd[x,3]. – John Doty Aug 30 '17 at 15:25
• @JohnDoty Thank you John and also corey979, your answers solve my question. – Y.Du Aug 30 '17 at 15:38

Guide Mathematica to the desired result,

Table[(x^(2.))^(1/3.), {x, -0.5, -0.2, 0.1}]


{0.629961, 0.542884, 0.44814, 0.341995}

If you check the internal operation procedure you will see the difference,

FullForm[x^(2./3.)]


compare with this

FullForm[(x^(2.))^(1/3.)]


You can also try with exact form, i.e., 2/3.

• Hi zhk, thanks. I know how to get the correct plot, but I want to understand why mathematica gives us imaginary results. Do you have any idea? – Y.Du Aug 30 '17 at 15:14
• @Y.Du Check the edit – zhk Aug 30 '17 at 15:19