# Possible bug Integrate[(1-x^(-1/5))/(1-x),{x,0,1}]=0

Summary

It seems that Integrate[] cannot handle complicated branch cuts of the integrand properly.

The problem

This integral

i5 = Integrate[(1 - x^(-1/5))/(1 - x), {x, 0, 1}]

(* Out[1682]= 0 *)


returns a wrong result.

The numerical values is

i5n = NIntegrate[(1 - x^(-1/5))/(1 - x), {x, 0, 1}]

(* Out[1683]= -0.387793 *)


The same result holds for higher values:

Table[Integrate[(1 - x^(-1/n))/(1 - x), {x, 0, 1}], {n, 2, 10}]

(* Out[1706]= {-Log[4], 1/6 (Sqrt[3] \[Pi] - 9 Log[3]),
1/2 (\[Pi] - 2 Log[8]), 0, 0, 0, 0, 0, 0} *)


Analysis

1) The antiderivative shows no sign of irregularity like jumps

ia = Integrate[(1 - x^(-1/5))/(1 - x), x]

(* Out[15]= -5 RootSum[
1 + #1 + #1^2 + #1^3 + #1^4 &, (Log[x^(1/5) - #1] #1^3)/(
1 + 2 #1 + 3 #1^2 + 4 #1^3) &] *)


The difference of the values at the borders is ok.

(ia /. x -> 1) - (ia /. x -> 0);
% // N

(* Out[1722]= -0.387793 + 0. I *)


2) The integral with a variable upper limit shows several branch cuts

iy[y_] = Integrate[(1 - x^(-1/5))/(1 - x), {x, 0, y},
Assumptions -> 0 < y < 1]

(*
Out[2]= -(-1)^(1/5) Log[1 + (-y)^(1/5)] +
Log[1 - y^(1/5)] + (-1)^(2/5) Log[1 - (-1)^(2/5) y^(1/5)] - (-1)^(3/5)
Log[1 + (-1)^(3/5) y^(1/5)] + (-1)^(4/5) Log[1 - (-1)^(4/5) y^(1/5)] -
Log[1 - y]
*)


which leads to difficulties with the values at y=1

% /. y -> 1

(* Out[3]= Indeterminate *)

iy[1]

(* Out[4]= Indeterminate *)


But it works with the limit:

Limit[iy[y], y -> 1]

(* Out[12]= -Log[5] - (-1)^(1/5) Log[1 + (-1)^(1/5)] + (-1)^(2/5)
Log[1 - (-1)^(2/5)] - (-1)^(3/5) Log[1 + (-1)^(3/5)] + (-1)^(4/5)
Log[1 - (-1)^(4/5)] *)

% // N

(* Out[14]= -0.387793 - 1.11022*10^-16 I *)


It also works numerically close to 1:

iy[1. - 10^-6]

(* Out[24]= -0.387793 - 3.33067*10^-16 I *)

• Also, Integrate[(1 - x^(-1/5))/(1 - x), {x, 0, 1}, PrincipalValue -> True] // Simplify works. Feb 21 '20 at 15:06
• I have observed that specifying the path in the complex plane by giving one or more way points between the endpoints seems to help Integrate resolve the correct branch(es). I have also observed that it does not always work. So if the integral is meant to be completely real, I thought inserting a real waypoint between 0 and 1 might help. Alternatively, it splits the branch point from the singular point (PrincipalValue probably does this, too). That might also be the reason. Feb 22 '20 at 15:49
• Mathematica 5.2 produces the correct result for this definite integral, directly and immediately. But Mathematica 8.0.4 already does not, it gives 0. Such a progress. Feb 26 '20 at 19:16
• @ innaiz Thank you very much for reminding me of my beloved version 5.2. :-) Feb 27 '20 at 11:59
• The bug seems to have been fixed in MMA 12.2 but it returned an extremely lengthy answer and took a little while... One can fullsimplify the lengthy answer and get 1/2 Sqrt[1 + 2/Sqrt[5]] \[Pi] - 1/2 Sqrt[5] ArcCoth[Sqrt[5]] - ( 5 Log[5])/4 though Jan 10 at 3:49

You can do

Integrate[(1 - x^-y)/(1 - x), {x, 0, 1}]
(* HarmonicNumber[-y], Re[y] < 1*)]


and then

(HarmonicNumber[-y] /. y -> 1/5) // FunctionExpand // FullSimplify

(* 1/2 Sqrt[1 + 2/Sqrt[5]] \[Pi] -
1/2 Sqrt[5] ArcCoth[Sqrt[5]] - (5 Log[5])/4*)

• @ Andreas Welcome in the forum, and congratulation for the brilliant entry (+1). Feb 24 '20 at 0:49

Since it was too long for a comment, I transcribe everything here together:

f1[x_] := Sqrt[(5 + Sqrt[5])/2] ArcTan[(1 - Sqrt[5] + 4 x^(1/5))/Sqrt[2 (5 + Sqrt[5])]]
f2[x_] := Sqrt[(5 - Sqrt[5])/2] ArcTan[(1 + Sqrt[5] + 4 x^(1/5))/Sqrt[2 (5 - Sqrt[5])]]
f3[x_] := -(5 - Sqrt[5])/4 Log[2 + (1 - Sqrt[5]) x^(1/5) + 2 x^(2/5)]
f4[x_] := -(5 + Sqrt[5])/4 Log[2 + (1 + Sqrt[5]) x^(1/5) + 2 x^(2/5)]
f[x_] := f1[x] + f2[x] + f3[x] + f4[x]

int1 = Integrate[(1 - Surd[x, -5])/(1 - x), {x, 0, 1}] // FullSimplify;
int2 = Integrate[(1 - x^(-1/5))/(1 - x) // ComplexExpand, {x, 0, 1}] // FullSimplify;

D[f[x], x] == (1 - x^(-1/5))/(1 - x) // FullSimplify
int1 == int2 == f[1] - f[0] // FullSimplify


True

True

• So what is the conclusion? Feb 21 '20 at 16:02
• @yarchik: none, only some strategies to get around the obstacle.
– TeM
Feb 21 '20 at 16:16

It might be interesting how we can simplify the expression obtained by Mathematica with the method 2) of my analysis:

iy1 = -Log[5] - (-1)^(1/5) Log[1 + (-1)^(1/5)] + (-1)^(2/5)
Log[1 - (-1)^(2/5)] - (-1)^(3/5) Log[1 + (-1)^(3/5)] + (-1)^(4/5)
Log[1 - (-1)^(4/5)]


The basic action is a replacement exemplified here

Log[1 + (-1)^(1/5)] /. Log[a_] -> (Log[Abs[a]] + I Arg[a]) // FullSimplify

(* = 1/2 ((I \[Pi])/5 + Log[1/2 (5 + Sqrt[5])]) *)


As an intermediate step we transform the sum into a list so that the replacement can act on each term separately

List @@ iy1

(* = {-Log[5], -(-1)^(1/5) Log[1 + (-1)^(1/5)], (-1)^(2/5)
Log[1 - (-1)^(2/5)], -(-1)^(3/5) Log[1 + (-1)^(3/5)], (-1)^(4/5)
Log[1 - (-1)^(4/5)]} *)

% /. Log[a_] -> (Log[Abs[a]] + I Arg[a]) // FullSimplify

(* = {-Log[5],
1/2 (-1)^(1/5) (-((I \[Pi])/5) + Log[2/(5 + Sqrt[5])]),
1/2 (-1)^(2/5) (-((3 I \[Pi])/5) + Log[1/2 (5 - Sqrt[5])]),
1/10 (-1)^(1/10) (3 \[Pi] + 5 I Log[1/10 (5 + Sqrt[5])]),
1/10 (-1)^(3/10) (\[Pi] + 5 I Log[1/2 (5 + Sqrt[5])])} *)


Plus @@ %;


Then follows the main simplifying step with

ExpToTrig[%] // Simplify

(* = 1/40 (2 (Sqrt[10 - 2 Sqrt[5]] +
3 Sqrt[2 (5 + Sqrt[5])]) \[Pi] + 5 Log[4] - 45 Log[5] +
5 Sqrt[5] Log[10] + Sqrt[5] Log[32] - 5 Log[5 - Sqrt[5]] +
5 Sqrt[5] Log[5 - Sqrt[5]] - 5 Log[5 + Sqrt[5]] -
15 Sqrt[5] Log[5 + Sqrt[5]]) *)


And other simplifying steps admittedly without a stringent logical seqence but the result of trial and error (as is often the case with Simplify[]-ing)

PowerExpand[%] (* useful for expanding Log[ A B ] *)
FullSimplify[%]

(* =
1/2 Sqrt[1 + 2/Sqrt[5]] \[Pi] - (5 Log[5])/4 +
1/8 Sqrt[5] Log[1/2 (7 - 3 Sqrt[5])] *)


Which is the final result.

Remark: compare my question in the Math SE https://math.stackexchange.com/questions/3555539/prove-int-01-frac1-frac1-sqrt5x1-x-dx-frac-pi2-sqrt1-frac2-sqr