Quaternion[0, Cos[Pi/20]/Sqrt[2], Sin[Pi/20]/Sqrt[2], 0] ** 
 Quaternion[0, 1, 0, 0] ** 
 Quaternion[0, -Cos[Pi/20]/Sqrt[2], -Sin[Pi/20]/Sqrt[2], 0]

this should produce a table of real numbers, but, at least for me, the result appears to include a very small imaginary component.

Quaternion[0, (-(1/4))*(-1)^(9/10)*(1 + (-1)^(1/5)), (1/8)*(-1 + 
    Sqrt[5]), 0]

I believe the result is wrong, but grateful for any suggestions of how to fix it (or is it possible that my version has become corrupted - do others get the same result ?)


closed as off-topic by Daniel Lichtblau, user9660, RunnyKine, Jens, m_goldberg Mar 29 '16 at 0:29

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Daniel Lichtblau, Community, RunnyKine, Jens, m_goldberg
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ That's rounding error. What if you replace the N[] with Simplify[]? $\endgroup$ – J. M. will be back soon Mar 28 '16 at 11:49
  • 1
    $\begingroup$ What result are you expecting? Possibly this would be better? In[2322]:= RootReduce[(-(1/4))*(-1)^(9/10)*(1 + (-1)^(1/5))] Out[2322]= Root[5 - 80 #1^2 + 256 #1^4 &, 4] Or this In[2323]:= ToRadicals[%] Out[2323]= 1/4 Sqrt[1/2 (5 + Sqrt[5])] ? $\endgroup$ – Daniel Lichtblau Mar 28 '16 at 15:01
  • 2
    $\begingroup$ I am using the Quaternion definition as per the Quaternions Package in Mathematica. The result for the second piece should be 0.475528, but is coming out as 0.475528 - 2.77556*10^-17 I $\endgroup$ – G Taylor Mar 28 '16 at 15:33
  • 1
    $\begingroup$ My gosh, I didn't even realize we had a Quaternions package. Live and learn. $\endgroup$ – Daniel Lichtblau Mar 28 '16 at 19:56
  • 1
    $\begingroup$ G Taylor: as I said, this is floating point arithmetic error at work. That's the reason for telling you to postpone the use of N[]; now that you're sure (through symbolic means) that there was no imaginary part after all, it is now safe to use Chop[]. $\endgroup$ – J. M. will be back soon Mar 28 '16 at 22:11

Browse other questions tagged or ask your own question.