# About the wrong evaluation of an integral

Here is an integral I've been studying in my research and I've just realized that Mathematica $8.0$ is unable to correctly compute it. I have 2 simple questions to ask:

1. Is my code below correct?

Integrate[x^(a - 1)/(1 - x) - c x^(b - 1)/(1 - x^c), {x, 0, 1}]

2. Are the newer Mathematica versions able to correctly compute it (how about W|A)?

Please do not provide with mathematical solutions, I like to attend this part on my own.

-

Your syntax is correct and v.9 produces a result. If appropriate you can halp things by adding assumptions..for example:

     Integrate[x^(a - 1)/(1 - x) - c x^(b - 1)/(1 - x^c), {x, 0, 1},
Assumptions -> {a > 0, b > 0, c > 0}]


-PolyGamma[0, a] + PolyGamma[0, b/c]

Indeed.. it apperars to be incorrect..

 example = {a -> RandomReal[{0, 2}], b -> RandomReal[{0, 2}], c -> RandomReal[{0, 2}]}
Integrate[x^(a - 1)/(1 - x) - c x^(b - 1)/(1 - x^c), {x, 0, 1},
Assumptions -> {a > 0, b > 0, c > 0}] /. example
Integrate[
x^(a - 1)/(1 - x) - c x^(b - 1)/(1 - x^c) /. example, {x, 0, 1} ]
NIntegrate[
x^(a - 1)/(1 - x) - c x^(b - 1)/(1 - x^c) /. example, {x, 0, 1} ]


{a -> 1.35623, b -> 1.98544, c -> 0.957961}

0.57579

0.532842

0.532842

Edit.. try the indefinite integral :

   indef = Integrate[x^(a - 1)/(1 - x) - c x^(b - 1)/(1 - x^c), x,
Assumptions -> {a > 0, b > 0, c > 0}]

Simplify[ Limit[ indef , x -> 1 ] - indef /. x -> 0 ,
Assumptions -> {a > 0, b > 0, c > 0} ]


1/a + Log[c] - PolyGamma[0, 1 + a] + PolyGamma[0, b/c]

Is that right?? Gives the same numerical result for the example

 % /. example // N


0.532842

-
This is a wrong answer, but thanks for your effort. (+1) – A_math_ninja Feb 12 '14 at 19:10
It seems OK, excepting the fact it's not nicely simplified (the answer I mean). – A_math_ninja Feb 12 '14 at 19:59
FullSimplify .. gets got there.. same as chuy's answer – george2079 Feb 12 '14 at 21:26

Problem looks to occur when doing the definite integral. If you start with the indefinite integral:

int = Integrate[x^(a - 1)/(1 - x) - c x^(b - 1)/(1 - x^c), x]

(* x^a/a + (x^(1 + a) Hypergeometric2F1[1, 1 + a, 2 + a, x])/(1 + a) -
(c x^b Hypergeometric2F1[1, b/c, 1 + b/c, x^c])/b *)


and you do the limits by hand you get:

result=FullSimplify[Limit[int,x-> 1, Assumptions->{a>0,b>0,c>0}]-Limit[int,x-> 0, Assumptions->{a>0,b>0,c>0}]]

(* 1/a + EulerGamma - HarmonicNumber[a] + Log[c] + PolyGamma[0, b/c] *)


which looks correct.

example = {a -> RandomReal[{0, 2}], b -> RandomReal[{0, 2}], c -> RandomReal[{0, 2}]}

(* {a -> 1.90438, b -> 0.334205, c -> 0.32148} *)

result /. example

(* -2.00794 *)


and

NIntegrate[x^(a-1)/(1-x)-c x^(b-1)/(1-x^c)/.example,{x,0,1}]

(* -2.00794 *)

-
OK, thanks for feedback! (+1) – A_math_ninja Feb 12 '14 at 20:00

I get the answer 0 using

Integrate[x^(a - 1)/(1 - x) - c x^(b - 1)/(1 - x^c), {x, 0, 1}, Assumptions -> {a > 0, b > 0, c > 0}]


v10.1

-
I cannot reproduce your answer, which also differs from that of the other two Answers. – bbgodfrey Apr 16 '15 at 10:14
using version 10.1 result is precisely 0 – Peter Lindsay Apr 16 '15 at 10:29
I get george2079's answer using 10.1. Neither it nor zero are correct. – Michael E2 Apr 16 '15 at 11:58