The atan function returns different results in different versions of Matlab.

Question:

Why in

MATLAB Version: 8.1.0.604 (R2013a)

>> sin(2+3i)*atan(4i)/(1-6i)

ans =

-1.8009 - 1.9190i

>> sin(2+3i)*atan((4i))/(1-6i)

ans =

  -1.8009 - 1.9190i

>> atan(4i)

ans =

  -1.5708 + 0.2554i

MATLAB Version 6.5.0.180913a (R13)

>> sin(2+3i)*atan(4i)/(1-6i)

ans =

1.1002 + 2.3907i

>> sin(2+3i)*atan((4i))/(1-6i)

ans =

   1.1002 + 2.3907i

>> atan(4i)

ans =

   1.5708 + 0.2554i

Please explain why this is so? And what is atan (4i) after all?

Answer:

Did a little research and found out the following. If you feed WolframAlpha these equations (if you didn't notice, then I replaced i on the left side with x ):

sin(2+3x)*atan(4x)/(1-6x) = 1.1002 + 2.3907i

and

sin(2+3x)*atan(4x)/(1-6x) = -1.8009 - 1.9190i ,

then among their roots there will also be x = i (with some error). This suggests that both results are correct. However, for one reason or another, Matlab in different versions prefers different options. Perhaps, in some version between 6.5.0.180913a and 8.1.0.604, the algorithm for the operation of trigonometric functions or functions that work with complex numbers was reworked. Perhaps you should contact the Mathematics forum, there is a chance that there are people familiar with this situation sitting there.

PS WolframAlpha thinks the correct answer is 1.1002 + 2.3907i

Scroll to Top