13
$\begingroup$

Bug introduced after 9 and persisting through 13.1. Resolved in 13.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$
10
  • 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
    Commented Mar 4, 2021 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$ Commented Mar 4, 2021 at 19:46
  • 3
    $\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$ Commented Mar 4, 2021 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
    Commented Mar 4, 2021 at 23:35
  • 5
    $\begingroup$ Reported as a bug. $\endgroup$ Commented Mar 5, 2021 at 0:31

1 Answer 1

4
$\begingroup$

The issue appears to have been resolved in 13.2.0

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.