# Changes to Series[...] in version 11.1

Bug introduced in 11.1 or earlier and fixed in 11.2

I have updated to Mathematica 11.1 and I am shocked to see that the Series function now works differently:

If I enter

Series[x^2+x^3, {x,0,0}]


it will return

x^2+O[x]^3


which is just weird. In the old versions, it would correctly return

O[x]^2


I get that it now tries to return the leading non-trivial term, but this "feature" breaks a number of functions that I have written over the last years and use in my daily work. Does anybody know if there is a quick way to make Series work as it used to in older versions? Did anybody actually see this in any changelog? Because I for sure haven't...

Cheers, Matthias

• Looks like a bug. Apr 12 '17 at 10:48
• You should report this to Wolfram and let us know what they said. Apr 12 '17 at 11:45
• btw: Mathematica hasn't released a comprehensive "changelog" since the last 10 years. Apr 12 '17 at 13:43
• @jjc385 Most probably SeriesData[x, 0, List[], 2, 2, 1] Apr 12 '17 at 18:23
• The only reply I got was "I'll forward this to the devs". Nothing since then. The update that was rolled out shortly after also didn't fix it. Right now I'm using QuantumDot's reply. I suggest everyone affected submits a bug report to keep up the pressure on that matter. Jul 3 '17 at 6:31

There is an undocumented function SystemSeriesDumptruncateSeries that you can use to facilitate the truncation of your series.

SystemSeriesDumptruncateSeries[Series[x^2 + x^3, {x, 0, 0}], {x, 0, 0}]
(* O[x]^2 *)


Modify the Series function so that it calls SystemSeriesDumptruncateSeries after it is applied:

ClearAttributes[Series, Protected];
Series[expr_, {var_, x0_, nf_}] :=
Block[{$inSeries = True, result}, result = SystemSeriesDumptruncateSeries[ Series[expr, {var, x0, nf}], {var, x0, nf}]; result] /; ! TrueQ[$inSeries];
SetAttributes[Series, Protected];


Then,

Series[x^2 + x^3, {x, 0, 0}]
(* O[x]^2 *)


All disclaimers associated with using undocumented functionality and modifying built-in functions apply.

• It's a good workaround, undocumented notwithstanding. Apr 15 '17 at 20:39
• Unprotect[]/Protect[] is the traditional way to remove and restore the Protected[] attribute, but this apparently works, too. Apr 16 '17 at 0:25
• Incredible, thanks a lot. Apr 18 '17 at 12:58
• I just wanted to add that Series in 11.0.0 does not consistently return the leading order term. Mathematica 10.0.0 evaluates Series[(-(h^3*t1^3)/864 + (ht1)^(3/2) - (h^4*t1^3*t2) 373248 + (h*(ht1)^(3/2)*t2)/864 + (h^2*(h*t1)^(3/2)*t2^2) 746496)^(1/6), {h, 0, 2}] to $$\sqrt[4]{h} \sqrt[6]{\text{t1}^{3/2}}+\frac{h^{5/4}\sqrt[6]{\text{t1}^{3/2}} \text{t2}}{5184}-\frac{h^{7/4}\left(\text{t1}^{3/2}\right)^{7/6}}{5184}+O\left(h^{9/4}\right)$$ while 11.0.0 returns  \sqrt[6]{h^{3/2} \text{t1}^{3/2}}+\frac{h \text{t2} \sqrt[6]{h^{3/2} \text{t1}^{3/2}}}{5184}-\frac{h^{3/2} \left(\text{t1}^{3/2}
– Cobi
Jun 21 '17 at 13:37
• @vsht It's fixed for the next release. Jul 5 '17 at 17:52

The following works for expansions in one variable only. It would need to be extended for multiple variables.

If you're looking for a quick and dirty fix, you might replace every instance of Series in your code with series :

ClearAll[series]
series[f_, {x_, x0_, nMaxSpec_}, args___] := (
Series[f, {x, x0, nMaxSpec}, args]
// Replace[
HoldPattern@SeriesData[x, x0, coeffs_, n0Min_, n0Max_, denom_] :>
With[{nMin = n0Min/denom, nMax = n0Max/denom},
SeriesData[x, x0, {}, n0Min, n0Min, denom]
/; ! n0Min === n0Max && n0Min > nMaxSpec
]
]
)


As mentioned above, this works for expansions in one variable only. It would need to be extended for multiple variables.

It would probably be ideal to modify the behavior of Series itself rather than have to replace it with a different function. I attempted to do such a thing, but I was unsuccessful. Perhaps someone more clever will figure out something better.