# Computational discrepancy for plugging in equivalent forms into an expression

When the following 9th root of unity is raised to the 6th power a 3rd root of unity is returned.

(Power[-(1/2) + (I Sqrt[3])/2, (3)^-1])^6 // N

-0.5 - 0.866025 I


It is the same as the following 3rd root of unity.

-(1/2) - (I Sqrt[3])/2 // N

-0.5 - 0.866025 I


However, there is a computational discrepancy when plugging these two equivalent values into the following expression:

Power[44 + 6 a^3 - 51 a^6, (9)^-1] Power[-33 - 27 a + 6 a^2 - 32 a^3 - 15 a^4 - 24 a^6 - 9 a^7, (3)^-1]


When plugging in the 9th root to the 6th power like so one achieves the following:

Power[44 + 6 a^3 - 51 a^6, (9)^-1]
Power[-33 - 27 a + 6 a^2 - 32 a^3 - 15 a^4 - 24 a^6 - 9 a^7, (3)^-1] /. a -> (Power[-(1/2) + (I Sqrt[3])/2, (3)^-1])^6 // N

3.85564 + 2.03323 I


When plugging in the equivalent 3rd root like so the result is the following:

Power[44 + 6 a^3 - 51 a^6, (9)^-1]
Power[-33 - 27 a + 6 a^2 - 32 a^3 - 15 a^4 - 24 a^6 - 9 a^7, (3)^-1] /. a -> -(1/2) - (I Sqrt[3])/2 // N

1.64666 + 4.0359 I


If you try to plug in these equivalent forms into just the multiplicand or multiplier in the expression then you will achieve the same result for each. It is when plugging them into their product that the discrepancy arises.

Why is Mathematica behaving this way?

• I believe that the factor (44 + 6 (-(1/2) + (I Sqrt[3])/2)^6 - 51 (-(1/2) + (I Sqrt[3])/2)^12) in the first expression has a rounding error that yields a slightly negative imaginary part, which lies just on the other side of the branch-cut discontinuity of the (1/9) power. Perhaps try N[expr, 16], followed by N if you want machine precision. – Michael E2 Apr 30 '18 at 17:49
• It's a numerical precision issue: Try using N[#, \$MachinePrecision]& instead of N. This will carry out the computation at arbitrary precision, with a precision equivalent to your machine's precision, and you will see that the results are the same. – MarcoB Apr 30 '18 at 17:51