# Series gives wrong result

Bug introduced in 10.0 or earlier and persisting through 12.2.

The following code shows that Series gives different results depending on whether one simplifies the expression in the first place. Let's assume all variables real.

f = (4 x^2)/((-a^2 - 4 x^2 + a Sqrt[a^2 + 4 x^2]) (a^2 + 4 x^2 +
a Sqrt[a^2 + 4 x^2]));
Series[Simplify[f], {x, 0, 1}]
(*-(1/a^2)+O[x]^2*)
Series[f, {x, 0, 1}, Assumptions -> a \[Element] Reals]
(*O[x]^2*)

• The command Series[f, {x, 0, 1}, Assumptions -> a \ [Element] Reals] produces -(1/a^2)+O[x]^2. – user64494 Feb 6 '20 at 19:21
• I wouldn't blame Series. Compare f /. x -> 0 and Simplify[f] /. x -> 0. – Michael E2 Feb 6 '20 at 20:18
• OK, maybe you should blame Series: Limit[f, x -> 0] and Limit[Simplify[f], x -> 0] both give -1/a^2. – Michael E2 Feb 6 '20 at 20:27
• @user64494 Not working with my V12 MMA. What version are you using? – xiaohuamao Feb 6 '20 at 20:43
• With version 11, Series[f, {x, 0, 2}] gives (4 x^2)/(a^2 (-a+Sqrt[a^2]) (a+Sqrt[a^2]))+O[x]^3 which is even more questionable: denominator is zero for any a – მამუკა ჯიბლაძე Feb 7 '20 at 10:00

## 2 Answers

There is a simple workaround:

ClearAll[a, x]; f = (4 x^2)/((-a^2 - 4 x^2 +
a Sqrt[a^2 + 4 x^2]) (a^2 + 4 x^2 + a Sqrt[a^2 + 4 x^2]));
Series[f, {x, 0, 1}, Assumptions -> Re[a] > 0]
*-(1/a^2)+O[x]^2 *
Series[f, {x, 0, 1}, Assumptions -> Re[a] < 0]
*-(1/a^2)+O[x]^2 *


The case $$\Re a=0$$ makes a trouble.

• For me (in version 11) Assumptions -> Re[a] != 0 also gives wrong answer – მამუკა ჯიბლაძე Feb 7 '20 at 10:02
• The same in version 12.0. However, both assumptions Assumptions -> Re[a] > 0 and Assumptions -> Re[a] <0 work separately. – user64494 Feb 7 '20 at 13:09

Simplify the expression You like to evolve into the series first: Then reduce by hand the nominator, denominator. The expression in the first argument of Series is than more simply: Nice equivalent for math thinking is using Wolfram Alpha: So Your question addresses plenty of complexity in Mathematica. Advice is:

Keep in mind Mathematica calculates solutions on an algorithmics process path. It went where You ask it to go. Wolfram Alpha takes over some more intelligence or better experience. Because it shows up plenty of standard solution You might expect to be of importance for You. Use visualizations as often as possible. A general rule and a rule from Wolfram Alpha is asking Mathematica to do the calculation as simple as possible. Think on the domains and deal with them logically. (Example: Neither the Assumption a==0 nor a>0&&a<0 cause other than evaluation warnings and logical confusion. Nor does a!=0 is a better logic.)

The Wolfram Alpha solution and my more specific do not make use of Assumptions.

The most important paradigma for Mathematics is stay lazy is best or even optimum. Always wonder and aks.