# Series default assumptions?

I have a question about the "Series" command. Specifically, the following input

Series[Sqrt[x^2], {x, 0, 2}]


gives me the following output

x+O[x]^3.


However, we know that this is not true for some $x$, e.g. for $x<0$. Because of the singular derivative at $x=0$, I would have expected Mathematica to give an error of some kind here. Moreover, when adding an assumption like this

Series[Sqrt[x^2], {x, 0, 2}, Assumptions -> (x < 0)],


I still get the same output

x+O[x]^3,


whereas I know that the leading order should be $-x$ rather than $x$.

I am trying to understand why Mathematica gives me this result. Does "Series" somehow make some general assumptions about the variable of the expansion?

EDIT: I am using Mathematica version 10.2.

• OK in Mma 11.1.0.0: the output under the assumption $x<0$ is $-x+O\left(x^3\right)$. May 2, 2017 at 16:02
• What version are you using? Recent versions appear to give sensible answers. May 2, 2017 at 22:19
• Edited the question, I am using version 10.2. Is this is a bug in this version? May 3, 2017 at 10:24

This is an extended comment to demonstrate the effect of Assumptions in version 11.1.1 While a problem exists in some earlier versions, it has been corrected.

\$Version

"11.1.1 for Mac OS X x86 (64-bit) (April 18, 2017)"

Series[Sqrt[x^2], {x, 0, 2}]


Series[Sqrt[x^2], {x, 0, 2}, Assumptions -> (x > 0)]


Series[Sqrt[x^2], {x, 0, 2}, Assumptions -> (x < 0)]


The last two are special cases of

Series[Sqrt[x^2], {x, 0, 2}, Assumptions -> Element[x, Reals]]


• This seems more like an output I would have expected. I am using version 10.2, was this a bug in that version? May 3, 2017 at 10:27
• Yes, this appears to be a bug in (some?) earlier versions (e.g., it gives the result shown for x > 0 in all four cases using v10.4.1 on my Mac). May 3, 2017 at 15:00
• Cool, that's clear then. Could you add to your answer that there's this bug in some earlier versions? I'll accept the answer then since that answers my question May 8, 2017 at 13:04

Bob Hanlon has shown which solution Mathematica 11.1.1 has determined. We can check it with the Taylor formula.

s = Sum[1/j! Nest[(x - x0)*# &, D[Sqrt[x^2], {x, j}] /. x -> x0, j], {j, 0, 2}]


((x - x0) x0)/Sqrt[x0^2] + Sqrt[x0^2]

Limit[s, x0 -> 0, Direction -> -1]
x

Limit[s, x0 -> 0, Direction -> 1]
-x


Mathematica is right.

• I am using version 10.2, which gave me the output in my question. Guess that version was bugged then? The command "Limit" does give the right result in 10.2 as well though. May 3, 2017 at 10:28