7
$\begingroup$

Bug introduced after 9, persisting through 12.2.


Recently, I have found a very bad problem with Wolfram Language. It gives the wrong answer for a quite simple expression!

When calculating

Series[ArcTan[A + 1/x], {x, 0, 2},  Assumptions -> A > 0 && x > 0]

I get the wrong answer (tested in wolfram cloud and in Mathematica 12.1.1.0)

wrong answer

I am absolutely sure that the correct answer should be

correct answer

There is a plot of these functions to demonstrate the issue

plot demonstration

How to get rid of the problem?

UPD More obvious issue (thank to @MichaelE2): enter image description here

UPD#2 Working around.

The result in v10.3 is correct.

The result in v11.3 is incorrect.

The corresponding post is in Wolfram Community.

$\endgroup$
9
  • 1
    $\begingroup$ Not a particularly satisfying workaround: For n=2, Series[Series[ArcTan[A + 1/x], {x, 0, 2 n}, Assumptions -> A > 0 && x > 0], {x, 0, n}]. Seems to work and be necessary for higher n. -- I'd say it's a bug and you should report it to WRI. $\endgroup$ – Michael E2 Mar 4 at 19:35
  • 3
    $\begingroup$ When you calculate the series, you assume A constant and x variable. However, in your plot, x is constant and A variable. You can not this purely graphically, the slope for A==0 should be negative not positive. When you plot x as a variable, the plot looks much better. $\endgroup$ – Daniel Huber Mar 4 at 19:46
  • 2
    $\begingroup$ This does look to be a bug. Compare to In[291]:= Series[ArcTan[aa + x], {x, Infinity, 2}, Assumptions -> aa > 0 && x > 1000] Out[291]= SeriesData[x, DirectedInfinity[1], {Rational[1, 2] Pi, -1, aa}, 0, 3, 1] $\endgroup$ – Daniel Lichtblau Mar 4 at 20:00
  • 2
    $\begingroup$ @DanielHuber When you plot vs. x, you should try to show the series is O[x]^3. It's clearly not, but the OP's "correct answer" is: Block[{ A = 2, f = (ArcTan[ A + 1/x] - {Normal@ Series[ArcTan[A + 1/x], {x, 0, 2}, Assumptions -> A > 0 && x > 0], \[Pi]/2 - x + A x^2})/x^3}, Plot[f, {x, 0, 1}, WorkingPrecision -> 16] ] $\endgroup$ – Michael E2 Mar 4 at 23:35
  • 3
    $\begingroup$ Reported as a bug. $\endgroup$ – Daniel Lichtblau Mar 5 at 0:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.