# Is it a bug of Integrate?

Integrate[1/(1 - x^2), x] // FullSimplify


ArcTanh[x]

But as we see in follow graphcs:

Plot[{1/(1 - x^2), ArcTanh[x]}, {x, -5, 5}, PlotRange -> {-3, 3}] We can see the Integrate just calculate the part of -1<x<1. Is it a bug of Integrate? How do I compute the complete integration of this function with Mathematica? And as I know the right answer is $$\int\frac{1}{1-x^2}dx=\frac{1}{2}\ln{\left|\frac{x+1}{x-1}\right|}+C$$

• Plot just shows the real part. Use ReImPlot of ComplexPlot3D if you want to plot the whole function. Nov 10, 2021 at 10:20
• @DanielHuber As I know $\int\frac{1}{x^2-1}dx=\frac{1}{2}\ln{\left|\frac{x-1}{x+1}\right|}+C$, so I don't need use ReImPlot?
– yode
Nov 10, 2021 at 10:25
• ? ArcTanh has branch cuts along -Infinity..-1 and 1..Infinity Nov 10, 2021 at 10:28
• @DanielHuber Yes, I know. But could I don't want this cuts result? I want to get that complete primary function. Is it possible?
– yode
Nov 10, 2021 at 10:31
• The derivation of the general formula $$\int\frac{1}{1-x^2}dx=\frac{1}{2}\ln{\left|\frac{x+1}{x-1}\right|}$$ which holds on each of three intervals of FunctionDomain,1(1-x^2),x,Reals] is art for art's sake since an antiderivative can be used only for calculation of an definite integral $\int_a^b\frac{1}{1-x^2}dx$, where both integration limits belong to the same interval. Antiderivatives on each interval can be found by Integrate[1/(1 - x^2), x, Assumptions -> x <-1 ] and Integrate[1/(1 - x^2), x, Assumptions -> x>-1&&x <1] and Integrate[1/(1 - x^2), x, Assumptions -> x > 1]. Nov 10, 2021 at 11:30

I answer the question for sportive interest (see the above discussion). The antiderivative of the required form valid on the whole real axis except the points $$x=\pm1$$ can be obtained as

Integrate[1/(1-t^2),{t,0,x},PrincipalValue->True]


under assumptions on x. Indeed,

Integrate[1/(1 - t^2), {t, 0, x}, PrincipalValue -> True, Assumptions -> x < -1]


-(1/2) Log[(-1 + x)/(1 + x)]

FullSimplify[-(1/2) Log[(-1 + x)/(1 + x)] -
1/2*Log[RealAbs[(x + 1)/(x - 1)]], Assumptions -> x < -1]


0

Integrate[1/(1 - t^2), {t, 0, x},Assumptions -> x > -1 && x < 1] // TrigToExp


-(1/2) Log[1 - x] + 1/2 Log[1 + x]

Integrate[1/(1 - t^2), {t, 0, x}, PrincipalValue -> True, Assumptions -> x > 1]


1/2 Log[(1 + x)/(-1 + x)]

I leave the remaining simplifications on your own.

• Thanks....... :)
– yode
Nov 11, 2021 at 14:58