I need a numerical approximation around some functions at $x = 0^{-}$ from the left side, where $x = 0$ is unfortunately the right end of the domain (in the reals) so the functions are not differentiable there.

Nonetheless, all I want is an approximation so I actually just need a one-sided limit along the reals and don't need it to be differentiable. I don't care about the fact that different "series" will be obtained when one approaches $x=0$ from different directions in the complex plane.

That is, I'll take whatever works.

The two methods shown below of doing series expansion yield results that differ by a complex $i$. There are two examples, each being a Column object aligning the two ways of coding that seem mathematically the same to me.

Column[{  (* example 1 *)
Series[ -1 + Sqrt[-x (2 + x)]
 , {x, 0, 4}, Assumptions -> x < 0] 
, Series[-1 + Sqrt[(2 - x) x]
 , {x, 0, 4}, Assumptions -> x > 0] }]

Column[{  (* example 2 *)
Series[  ArcCos[1 + x]
 , {x, 0, 4}, Assumptions ->  x < 0] 
, Series[ ArcCos[1 - x]
 , {x, 0, 4}, Assumptions -> x > 0] }]

The discrepancy most likely involve something like $\arg(x)$ and this has to do with the expansion being done near the branch cut.

However, why are there two different outcomes in terms of coding? To me the two ways of coding seem mathematically equivalent. If one of them is more appropriate, which one?

The expansion is meant to be, for instance more clearly seen in the 2nd example, $x \to 0^{-}$ coming from the left along the real line (inside the proper domain in reals). In both examples the function goes "vertical" at $x = 0$.

Thank you.

  • 3
    $\begingroup$ I'm inclined to say that this is a bug. Over the years I have noticed that Series is very badly implemented for expansions around non-analytic points. In both examples, the correct result is the first one. $\endgroup$
    – QuantumDot
    Jan 28, 2017 at 2:58
  • $\begingroup$ @QuantumDot Thanks for the opinion. I guess I can be more comfortable using Series after knowing its shortcomings, and the 2nd method in my examples of manually flipping the function twice (before and after) is not as good as letting the complex $i$ in a negative $\sqrt{x}$ take care of itself. $\endgroup$ Feb 1, 2017 at 4:35

1 Answer 1


There is some information missing here, insofar as the details of what exactly is the problem are sketchy. Presumably it is as follows. We'll start with one of the functions in question.

func1 = Sqrt[-x*(2 + x)];

Here are the series formed using different assumptions about side-of-branch-cut residency status.

InputForm[s1Neg = Normal[Series[func1, {x, 0, 2},
  Assumptions -> x < 0]]]

(* Out[6]//InputForm= I*Sqrt[2]*Sqrt[x] + ((I/2)*x^(3/2))/Sqrt[2] *)

InputForm[s1Pos = Normal[Series[func1, {x, 0, 2},
  Assumptions -> x > 0]]]

(* Out[7]//InputForm= I*Sqrt[2]*Sqrt[x] + ((I/2)*x^(3/2))/Sqrt[2] *)

The positive one is fine, numerically.

{func1, s1Pos} /. x -> .001

(* Out[8]= {0. + 0.0447325 I, 0. + 0.0447325 I} *)

The negative part is not so fortunate.

{func1, s1Neg} /. x -> -.001

(* Out[9]= {0.0447102, -0.0447102 + 0. I} *)

Here is a result I hope to see in the next release of Mathematica.

InputForm[s1Neg = Normal[Series[func1, {x, 0, 2},                       
     Assumptions -> x < 0]]]

(* Sqrt[2]*Sqrt[-x] + (Sqrt[-x]*x)/(2*Sqrt[2]) - (Sqrt[-x]*x^2)/(16*Sqrt[2]) *)

Numerically it is much improved.

{func1, s1Neg} /. x -> -.001                                            

(* Out[7]= {0.0447102, 0.0447102} *)

I will mention that before Normal is used, the SeriesData object contains square roots of -x in its coefficients. So there are drawbacks to this, insofar as what is obtained is no longer a "pure" Puiseux series. I do not see a way around that though; either we extend the allowed for of result, or we have (more) branch cut errors.

The situation with ArcCos[1 + x] is substantially the same. So the InputForm of the expansion, for x < 0 assumed, would be

Sqrt[2]*Sqrt[-x] - (Sqrt[-x]*x)/(6*Sqrt[2]) + (3*Sqrt[-x]*x^2)/(80*Sqrt[2])

Here again, the branch cut difference is handled by the explicit Sqrt[-x].

  • $\begingroup$ Yeah, I see your point. So .... before the next release, one should double check explicitly, or even do a bit manual calculation before sending the code down the pipeline? $\endgroup$ Feb 1, 2017 at 4:30
  • 1
    $\begingroup$ Depends on the pipeline I guess. But pretty much any Series expansion at a branch point or branch cut is at risk of having problems getting a representation that is correct in all neighborhoods allowed by assumptions that might be present. And when it magically works, there is always the question of whether the cure was more voodoo than it was worth. $\endgroup$ Feb 1, 2017 at 5:04

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.