I want to evaluate this function near x=1:

g[x_] := (-2 + 115*x^2 + 616*x^4 + 216*x^6)/(-1 + x^2)^5 + 
    (3*x^2*(12 + 159*x^2 + 136*x^4 + 8*x^6)*ArcTanh[Sqrt[1 - x^2]])/(1 - x^2)^(11/2); 

The following seems to give a good representation of the function near dx=x-1=0 and you can see from the plot why I want to use a series expansion to evaluate near x=1:

gdx0 = Series[g[1 + dx], {dx, 0, 1}, Assumptions -> dx > 0]

$\frac{16}{1155}-\frac{64 \text{dx}}{65}+O\left(\text{dx}^2\right)$

Plot[{g[1 + dx], Evaluate[Normal[gdx0]]}, {dx, -0.02, 0.02}]

enter image description here

However, if I expand about x=1, there is trouble with simplifying even specifying that x>1 (which implies that x is real):

gx1 = Series[g[x], {x, 1, 5}, Assumptions -> x > 1]

$\frac{945}{32 (x-1)^5}+\frac{3255}{64 (x-1)^4}+\frac{2479}{128 (x-1)^3}-\frac{123}{256 (x-1)^2}+\frac{123}{256 (x-1)}-\frac{269}{512}+\frac{945 i \sqrt{x-1}}{32 (1-x)^{11/2}}-\frac{183 (x-1)}{1024}+\frac{3255 i (x-1)^{3/2}}{64 (1-x)^{11/2}}+\frac{1443 (x-1)^2}{2048}+\frac{2479 i (x-1)^{5/2}}{128 (1-x)^{11/2}}-\frac{6497 (x-1)^3}{8192}-\frac{123 i (x-1)^{7/2}}{256 (1-x)^{11/2}}+\frac{9729 (x-1)^4}{16384}+\frac{123 i (x-1)^{9/2}}{256 (1-x)^{11/2}}-\frac{10167 (x-1)^5}{32768}+O\left((x-1)^{11/2}\right)$

I get the same result with FullSimplify[gx1, x > 1]. Note that the constant term is not correct (see gdx0 above). By taking the Normal part of the series it can simplify, but gives the wrong result:

Expand[FullSimplify[Normal[gx1] /. x -> 1 + dx, dx > 0]]

$-\frac{10167 \text{dx}^5}{32768}+\frac{9729 \text{dx}^4}{16384}-\frac{6497 \text{dx}^3}{8192}+\frac{1443 \text{dx}^2}{2048}-\frac{183 \text{dx}}{1024}-\frac{269}{512}$

If I include enough terms, n, then eventually the first two terms are correct, but for small n there are extraneous terms in $\mathrm{dx}^{-1}$:

    Normal[Series[g[x], {x, 1, n}, Assumptions -> x > 1]] /. 
     x -> 1 + dx, dx > 0]], {n, 0, 7}] // MatrixForm

$\begin{pmatrix} \frac{945}{32 \text{dx}^5}+\frac{3255}{64 \text{dx}^4}+\frac{2479}{128 \text{dx}^3}-\frac{123}{256 \text{dx}^2}+\frac{123}{256 \text{dx}}-\frac{269}{512}\\ \frac{3255}{64 \text{dx}^4}+\frac{2479}{128 \text{dx}^3}-\frac{123}{256 \text{dx}^2}-\frac{183 \text{dx}}{1024}+\frac{123}{256 \text{dx}}-\frac{269}{512}\\ \frac{2479}{128 \text{dx}^3}+\frac{1443 \text{dx}^2}{2048}-\frac{123}{256 \text{dx}^2}-\frac{183 \text{dx}}{1024}+\frac{123}{256 \text{dx}}-\frac{269}{512}\\ -\frac{6497 \text{dx}^3}{8192}+\frac{1443 \text{dx}^2}{2048}-\frac{123}{256 \text{dx}^2}-\frac{183 \text{dx}}{1024}+\frac{123}{256 \text{dx}}-\frac{269}{512}\\ \frac{9729 \text{dx}^4}{16384}-\frac{6497 \text{dx}^3}{8192}+\frac{1443 \text{dx}^2}{2048}-\frac{183 \text{dx}}{1024}+\frac{123}{256 \text{dx}}-\frac{269}{512}\\ -\frac{10167 \text{dx}^5}{32768}+\frac{9729 \text{dx}^4}{16384}-\frac{6497 \text{dx}^3}{8192}+\frac{1443 \text{dx}^2}{2048}-\frac{183 \text{dx}}{1024}-\frac{269}{512}\\ \frac{4451 \text{dx}^6}{65536}-\frac{10167 \text{dx}^5}{32768}+\frac{9729 \text{dx}^4}{16384}-\frac{6497 \text{dx}^3}{8192}+\frac{1443 \text{dx}^2}{2048}-\frac{183 \text{dx}}{1024}+\frac{16}{1155}\\ \frac{2931 \text{dx}^7}{32768}+\frac{4451 \text{dx}^6}{65536}-\frac{10167 \text{dx}^5}{32768}+\frac{9729 \text{dx}^4}{16384}-\frac{6497 \text{dx}^3}{8192}+\frac{1443 \text{dx}^2}{2048}-\frac{64 \text{dx}}{65}+\frac{16}{1155}\end{pmatrix}$

Overall, the problem seems to be that it's not treating terms like $\frac{i\sqrt{x-1}}{(1-x)^{11/2}}$ as the correct order in the series, so without asking for sufficient order, the summation/cancellation of different terms of the same order isn't happening.

My single question is: how do I ask Mathematica for a series in a way that is sure to be safe when not expanding about zero?

EDIT in response to answer by Ulrich Neumann:

I'm using v11.2.0.0. For the Plot of gS (copy and pasted exactly as suggested), this gives:

enter image description here

This may relate to the comment by Akku14, i.e. perhaps Ulrich is using an older version than me. In any case, it is perhaps more general to use Series[g[a + d], {d, a, 1}, Assumptions -> d > 0] to workaround the bug, rather than pulling out removable singularities.

  • $\begingroup$ Something weird is indeed going on. Would you mind explaining where the function came from? $\endgroup$ Apr 8, 2018 at 7:29
  • $\begingroup$ It is x^2 D[y/3, {x, 4}] where y=3x^2 ArcTanh[Sqrt[1 - x^2]]/(1 - x^2)^(3/2) - (1 + 2 x^2)/(1 - x^2). y is the result of an integral of a rational function. $\endgroup$ Apr 8, 2018 at 8:49
  • 1
    $\begingroup$ Yes, I think it is one. $\endgroup$ Apr 9, 2018 at 3:08
  • 2
    $\begingroup$ MMA Version 8.0 gives the right series expansion gx1 to any order. Looks like a bug in higher versions. $\endgroup$
    – Akku14
    Apr 9, 2018 at 7:45
  • 2
    $\begingroup$ v9.0.1 gives the correct result. $\endgroup$
    – xzczd
    Apr 9, 2018 at 8:19

1 Answer 1


If you factor out the the singularity (x-1)^5 and expand g[x] (-1 + x^2)^5

gS = Normal[Series[g[x] (-1 + x^2)^5, {x, 1, 5 }]]

Mathematica evaluates as expected

Show[{Plot[gS/(-1 + x^2)^5, {x, 1 - #, 1 + #}], 
Graphics[{Red, Point[{1, Limit[g[x], x -> 1]}]}]}] &[.001]

enter image description here

  • $\begingroup$ This doesn't work in my version. My edited question has details. Does your version show the behaviour I outline in my original question? $\endgroup$ Apr 9, 2018 at 8:26
  • 1
    $\begingroup$ @Ramashalanka: My MMA version is 11.0.1 (Windows). This version doesn't show the behaviour gx1=... Plot-behaviour is the same. $\endgroup$ Apr 9, 2018 at 8:35

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.