Problem with Integrate

Hello.

I was trying to do the following integral:

Integrate[1/Sqrt[2 (1 + x)^3 + 1], {x, 0, 1}] // N

The output in Mathematica 9 is a complex number that is not correct

-2.96267 - 1.92762 I

When I try to solve by using NIntegrate, the output is the correct one

NIntegrate[1/Sqrt[2 (1 + x)^3 + 1], {x, 0, 1}]

0.376065

Is this a bug in Integrate or I am missing something? Can someone test in Mathematica 10?

Thanks

Using Mathematica 10

In[2]:= Integrate[1/Sqrt[2 (1 + x)^3 + 1], {x, 0, 1}]

Out[2]= (1/(3^(1/4)))(-1)^(1/12) 2^(
2/3) (EllipticF[
ArcSin[((-1)^(11/12) Sqrt[1 + 2^(1/3)])/3^(1/4)], (-1)^(1/3)] -
EllipticF[
ArcSin[((-1)^(11/12) Sqrt[1 + 2 2^(1/3)])/3^(1/4)], (-1)^(1/3)])

In[3]:= N[%]

Out[3]= -2.96267 - 1.92762 I

Seeing -1 raised to fractional powers makes a branch cut problem a possibility.

There is a path singularity around .59 that is not found. Will investigate.

Daniel, I don’t understand your post.

Frank: In brief: Mathematica is using the Newton-Leibniz method to do the definite integral. It computes the antiderivative. It looks for points on the path of integration where the antiderivative might have discontinuities. It evaluates by taking limits at endpoints and all these points.

The antiderivative has a jump discontinuity near x=0.59, which of course is between 0 and 1. The code that looks for discontinuities is failing to find it. Not entirely a surprise (finding them involves some hard-core equation solving, often transcendental). But it’s worth further investigation.

I see what you mean

sln = DSolve[{y’[x] == 1/Sqrt[2 (1 + x)^3 + 1], y[0] == 0}, y]

Plot [Im[y[x] /. sln], {x, 0, 1}, PlotRange → All ] shows that y[x] develops an imaginary part at 0.59

Hi Daniel. Thanks for your answer.

When you say that the antiderivative has a jump discontinuity near x=0.59, I think you are looking at the Mathematica answer

In[6]:= Integrate[1/Sqrt[2 (1 + x)^3 + 1], x]

Out[6]= ((-1)^(1/6) 2^(2/3) Sqrt[(-1)^(5/6) (-1 + (-2)^(1/3) (1 + x))]
Sqrt[1 + (-2)^(1/3) (1 + x) + (-2)^(2/3) (1 + x)^2]
EllipticF[
ArcSin[Sqrt[-(-1)^(5/6) - I (-2)^(1/3) (1 + x)]/3^(1/4)], (-1)^(
1/3)])/(3^(1/4) Sqrt[1 + 2 (1 + x)^3])

Is that correct? But is it possible to trust in this result in this case?

@otsocol, Yes, I was looking at that antiderivative.

As to whether the antiderivative itself is correct, About all I can say is it gives a numerical result consistent with NIntegrate if one only integrates from 0 to 1/2 (which excludes that singularity point). This might or might not answer your question.

A side observation…

If one computes

theIntegral = Integrate[1/Sqrt[2 (1 + x)^3 + 1], x]

and then computes

theDerivative = D[theIntegral, x] // FullSimplify

which yields

-(((-1)^(5/6) Sqrt[3] Sqrt[
     1 + 2 (1 + x)^3])/(Sqrt[-(-1)^(5/6) (1 + 2^(1/3) + 2^(1/3) x)]
      Sqrt[(-1)^(5/6) (-1 + (-2)^(1/3) (1 + x))] Sqrt[
     1 + (-2)^(1/3) (1 + x) + (-2)^(2/3) (1 + x)^2] Sqrt[
     3 - (-1)^(1/6) Sqrt[3] + (1 + x) Root[108 + #1^6 &, 1]] Sqrt[
     3 + (-1)^(5/6) Sqrt[3] + (1 + x) Root[108 + #1^6 &, 2]])) 

and then attempts to Plot this using

Plot[-(((-1)^(5/6) Sqrt[3] Sqrt[
      1 + 2 (1 + x)^3])/(Sqrt[-(-1)^(5/6) (1 + 2^(1/3) + 2^(1/3) x)]
       Sqrt[(-1)^(5/6) (-1 + (-2)^(1/3) (1 + x))] Sqrt[
      1 + (-2)^(1/3) (1 + x) + (-2)^(2/3) (1 + x)^2] Sqrt[
      3 - (-1)^(1/6) Sqrt[3] + (1 + x) Root[108 + #1^6 &, 1]] Sqrt[
      3 + (-1)^(5/6) Sqrt[3] + (1 + x) Root[108 + #1^6 &, 2]])) , {x, 0, 1}]

the result is that it crashes the Mathematica Kernel. (I will report this.)

In[1]:= SystemInformation["Small"]

Out[1]= {"Kernel" -> {"SystemID" -> "MacOSX-x86-64", 
   "ReleaseID" -> "10.0.0.0 (5098698, 5098537)", 
   "CreationDate" -> 
    DateObject[{2014, 6, 29}, TimeObject[{20, 38, 32}]]}, 
 "FrontEnd" -> {"OperatingSystem" -> "MacOSX", 
   "ReleaseID" -> "10.0.0.0 (5098698, 2014062704)", 
   "CreationDate" -> 
    DateObject[{2014, 6, 27}, TimeObject[{23, 17, 40.}]]}}

If I calculate

sln = DSolve[{y’[x] == 1/Sqrt[2 (1 + x)^3 + 1], y[0] == 0}, y, x]

yp[x_] = D[y[x] /. sln, x]

Plot[yp[x] - 1/Sqrt[2 (1 + x)^3 + 1], {x, 0, 1}]

works giving me a plot that stays with 1.5 x 10^-15

Also, plotting “theDerivative” does not crash my computer.

Plotting theDerivative using

Plot[theDerivative,{x,0,1}] 

does not crash my Kernel, but plotting the full expression for theDerivative as written in my post does crash it reproducibly.

Yes, that’s what happens on my computer also. Weird.

I filed a bug report.

No crash in Mathematica 9

Regarding the crash associated with plotting a long expression, I wonder if the bug is related to this post:

Postscript: I tried the plot in Spontaneous clearing of variables and functions in v10 but using a shorter expression for the first argument to Plot. The plot in that post still crashes (randomly, it seems). So, perhaps the bugs are not relatives.

Although possible (but you commented that you think not) it’s unlikely that they are related–there are a variety of crashing bugs that one will come across in Mathematica (not frequently, but they happen) and I am guessing that they happen because of things deep in the works.

Slipping in Evaluate prevents the crash. fyi.

Plot[ Evaluate[-(((-1)^(5/6) Sqrt[3] Sqrt[
        1 + 2 (1 + x)^3])/(Sqrt[-(-1)^(5/6) (1 + 2^(1/3) + 
           2^(1/3) x)] Sqrt[(-1)^(5/
            6) (-1 + (-2)^(1/3) (1 + x))] Sqrt[
        1 + (-2)^(1/3) (1 + x) + (-2)^(2/3) (1 + x)^2] Sqrt[
        3 - (-1)^(1/6) Sqrt[3] + (1 + x) Root[108 + #1^6 &, 1]] Sqrt[
        3 + (-1)^(5/6) Sqrt[3] + (1 + x) Root[108 + #1^6 &, 
           2]]))], {x, 0, 1}]

Ditto pre-processing the expression with FullSimplify.

expr2 = FullSimplify[  expr , x >= 0] 

I don’t want to discourage your reporting the crash.

Interesting. I’ve reported the crash and it’s in the bug system. And I just added your example to the report.

Much simpler example that causes the crash:

Plot[Root[108 + #1^6 &, 2], {x, 0, 1}]

sln = DSolve[{y’ == 1/Sqrt[2 (1 + x)^3 + 1], y[0] == 0}, y]

sln represents a syntax error as such. If one is concerned about newbies and rookies not sticking to the syntax, one should stick to it at least oneself.