MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

a bug in Integrate (2nd message)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg122251] a bug in Integrate (2nd message)
  • From: dimitris <dimmechan at yahoo.com>
  • Date: Sat, 22 Oct 2011 06:07:58 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

int = 1/((x^2 + x + 1)*Sqrt[x^2 - x + 1]);

As I told in the previous message Mathematica gives wrong result for
the following integral

Integrate[int, {x, -1, 0}]

the problem is (I guess from what I figured out in the previous
message) that after applying the Risch algorithm and gets an
antiderivative

intMath = Integrate[int, x]

Mathematica uses the fundamental theorem of Calculus incorrectly
failing to take into account the jump singularity that possesses the
antiderivative in the integration range.

Let's figure out where is this jump.

In[43]:= ff = Expand[intMath]

Out[43]:=(-(1/2))*Sqrt[(1/3)*(1 + I*Sqrt[3])]*
  ArcTan[(3*(1 - x + x^2)*(I*Sqrt[3] - x + x^2))/(3*I + Sqrt[3] -
      2*Sqrt[3]*x^4 -
            Sqrt[3 - 3*I*Sqrt[3]]*Sqrt[1 - x + x^2] +
      2*x^3*(3*I + Sqrt[3 - 3*I*Sqrt[3]]*Sqrt[1 - x + x^2]) +
      x*(3*I - 3*Sqrt[3] + Sqrt[3 - 3*I*Sqrt[3]]*Sqrt[1 - x + x^2])
+
      x^2*(-3*I + Sqrt[3] +
         Sqrt[3 - 3*I*Sqrt[3]]*Sqrt[1 - x + x^2]))] - (1/2)*
  Sqrt[(1/3)*(1 - I*Sqrt[3])]*
     ArcTan[(3*(I*Sqrt[3] + x - x^2)*(1 - x + x^2))/(3*I - Sqrt[3] +
      2*Sqrt[3]*x^4 + Sqrt[3 + 3*I*Sqrt[3]]*Sqrt[1 - x + x^2] +
            x^3*(6*I - 2*Sqrt[3 + 3*I*Sqrt[3]]*Sqrt[1 - x + x^2]) +
      x*(3*I + 3*Sqrt[3] - Sqrt[3 + 3*I*Sqrt[3]]*Sqrt[1 - x + x^2])
-
      x^2*(3*I + Sqrt[3] +
         Sqrt[3 + 3*I*Sqrt[3]]*Sqrt[1 - x + x^2]))] + (1/4)*I*
  Sqrt[(1/3)*(1 - I*Sqrt[3])]*
     Log[16*(1 + x + x^2)^2] - (1/4)*I*Sqrt[(1/3)*(1 + I*Sqrt[3])]*
  Log[16*(1 + x + x^2)^2] +
   (1/4)*I*Sqrt[(1/3)*(1 + I*Sqrt[3])]*
  Log[(1 + x + x^2)*(11*I + 4*Sqrt[3] + (11*I + 4*Sqrt[3])*x^2 +
            10*I*Sqrt[1 - I*Sqrt[3]]*Sqrt[1 - x + x^2] -
      x*(17*I + 4*Sqrt[3] +
         8*I*Sqrt[1 - I*Sqrt[3]]*Sqrt[1 - x + x^2]))] -
   (1/4)*I*Sqrt[(1/3)*(1 - I*Sqrt[3])]*
  Log[(1 + x + x^2)*(-11*I + 4*Sqrt[3] + (-11*I + 4*Sqrt[3])*x^2 -
            10*I*Sqrt[1 + I*Sqrt[3]]*Sqrt[1 - x + x^2] +
      x*(17*I - 4*Sqrt[3] +
         8*I*Sqrt[1 + I*Sqrt[3]]*Sqrt[1 - x + x^2]))]

In[44]:= Length[ff]

Out[44]= 6

In[45]:= ({#1, Plot[Evaluate[Re[ff[[#1]]]], {x, -3, 3}]} & ) /@
Range[Length[ff]]

The first two terms of ff (which contain ArcTan) have jump in the same
point.

In[52]:= ff[[1]]
ff[[2]]

Out[52]= (-(1/2))*Sqrt[(1/3)*(1 + I*Sqrt[3])]*
 ArcTan[(3*(1 - x + x^2)*(I*Sqrt[3] - x + x^2))/
       (3*I + Sqrt[3] - 2*Sqrt[3]*x^4 -
     Sqrt[3 - 3*I*Sqrt[3]]*Sqrt[1 - x + x^2] +
          2*x^3*(3*I + Sqrt[3 - 3*I*Sqrt[3]]*Sqrt[1 - x + x^2]) +
     x*(3*I - 3*Sqrt[3] + Sqrt[3 - 3*I*Sqrt[3]]*Sqrt[1 - x + x^2]) +

     x^2*(-3*I + Sqrt[3] + Sqrt[3 - 3*I*Sqrt[3]]*Sqrt[1 - x + x^2]))]

Out[53]= (-(1/2))*Sqrt[(1/3)*(1 - I*Sqrt[3])]*
 ArcTan[(3*(I*Sqrt[3] + x - x^2)*(1 - x + x^2))/
       (3*I - Sqrt[3] + 2*Sqrt[3]*x^4 +
     Sqrt[3 + 3*I*Sqrt[3]]*Sqrt[1 - x + x^2] +
          x^3*(6*I - 2*Sqrt[3 + 3*I*Sqrt[3]]*Sqrt[1 - x + x^2]) +
     x*(3*I + 3*Sqrt[3] - Sqrt[3 + 3*I*Sqrt[3]]*Sqrt[1 - x + x^2]) -

     x^2*(3*I + Sqrt[3] + Sqrt[3 + 3*I*Sqrt[3]]*Sqrt[1 - x + x^2]))]

In particular the jump is at the point:

In[100]:= (N[#1, 20] & )[Re[Select[
    x /. Solve[3*I + Sqrt[3] - 2*Sqrt[3]*x^4 -
        Sqrt[3 - 3*I*Sqrt[3]]*Sqrt[1 - x + x^2] +
        2*x^3*(3*I + Sqrt[3 - 3*I*Sqrt[3]]*Sqrt[1 - x + x^2]) +
        x*(3*I - 3*Sqrt[3] +
           Sqrt[3 - 3*I*Sqrt[3]]*Sqrt[1 - x + x^2]) +
        x^2*(-3*I + Sqrt[3] +
           Sqrt[3 - 3*I*Sqrt[3]]*Sqrt[1 - x + x^2]) == 0], -1 <
       Re[#1] < 0 && Abs[Abs[#1] - 0.7] < 0.1 & ][[
        1]]]]

Out[100]= -0.72241927849008646432307690472106948257`20.

or in symbolic form

jump = 1/6 + Re[(I*(1 + I*Sqrt[3])*(1 -
         5*I*Sqrt[3]))/(12*(-71*I + 9*Sqrt[3] +
          Sqrt[-5022 - 918*I*Sqrt[3]])^(1/3)) -
        (1/12)*I*(1 - I*Sqrt[3])*(-71*I + 9*Sqrt[3] +
        Sqrt[-5022 - 918*I*Sqrt[3]])^(1/3)];

Unfortunately, Mathematica fails to evaluate the side limits

Limit[intMath,x->jump,Direction->1]
and
Limit[intMath,x->jump,Direction->-1]

The package NLimit fails as well.

So I think the only solution is to help a bit Mathematica in order to
get an antiderivative continuous in the whole real axis.
The question is how?

Dimitris Anagnostou

P.S. In another forum a user gave the following antiderivative:

intUser=ArcTan[(Sqrt[2]*(1 + x))/Sqrt[1 - x + x^2]]/Sqrt[2] +
ArcTanh[(Sqrt[2/3]*(-1 + x))/Sqrt[1 - x + x^2]]/Sqrt[6];

which is correct in the whole complex plane

D[intUser, x] - 1/((x^2 + x + 1) Sqrt[x^2 - x + 1]) // FullSimplify
0

and possesses no jump in the whole real axis.

Hence the definite integral in the range [-1,0] is

In[111]:= FullSimplify[int /. x -> 0 - int /. x -> -1]

Out[111]= (3/13)*Sqrt[3*(4 + Sqrt[3])]

In[112]:= N[%] (*check*)

Out[112]= 0.956959





  • Prev by Date: Re: count the number of sub-list in a list
  • Next by Date: Re: strange error
  • Previous by thread: a bug in Integrate
  • Next by thread: Re: a bug in Integrate (2nd message)