Re: Definite Integration in Mathematica

*To*: mathgroup at smc.vnet.net*Subject*: [mg74547] Re: Definite Integration in Mathematica*From*: "dimitris" <dimmechan at yahoo.com>*Date*: Sun, 25 Mar 2007 01:29:00 -0500 (EST)*References*: <etqo3f$10i$1@smc.vnet.net>

Thanks to all that contribute to this thread. Namely Daniel Huber, Andrzej Kozlowski (I got the point about Adamchik article!) Daniel Lichtblau, David Cantrell, Michael Weyrauch and of course Maxim Rytin for offering a clear visualization. Last but not least. I would like to thank (and congratulate!) Peter Pein (...P^2!) for his amazing method to construct a continuous antiderivative. Best Regards to all! Dimitris =CF/=C7 dimitris =DD=E3=F1=E1=F8=E5: > Hello to all of you! > > Firstly, I apologize for the lengthy post! > Secondly, this post has a close connection with a recent (and well > active!) > thread titled "Integrate" and one old post of mine which was based on > a older > post of David Cantrell. Since there was no response and I do consider > the > subject very fundamental I would like any kind of insight. > > In the section about Proper Integrals in his article, Adamchik > mentions that the Newton-Leibniz formula (i.e. the Fundamental > Theorem of Integral Calculus: Integrate[f[x],{x,a,b}]=F[b]-F[a], > F[x]: an antiderivative), does not hold any longer if the > antiderivative F(x) has singularities in the integration interval > (a,b). > > To demonstrate this, he considers the integral of the function: > > f[x_] = (x^2 + 2*x + 4)/(x^4 - 7*x^2 + 2*x + 17); > > over the interval (0,4). > > Plot[f[x], {x, 0, 4}]; > (*plot to be displayed*) > > The integrand posseses no singularities on the interval (0,4). > > Here is the corresponding indefinite integral > > F[x_] = Simplify[Integrate[f[x], x]] > ArcTan[(1 + x)/(4 - x^2)] > > Substituting limits of integration into F[x] yields an incorrect > result > > Limit[F[x], x -> 4, Direction -> 1] - Limit[F[x], x -> 0, Direction - > >1] > N[%] > NIntegrate[f[x], {x, 0, 4}] > > -ArcTan[1/4] - ArcTan[5/12] > -0.6397697828266257 > 2.501822870767894 > > This is because the antiderivative has a jump discontinuity at x=2 > (also at x = -2), so that the Fundamental theorem cannot be used. > > Indeed > > Limit[F[x], x -> 2, Direction -> #1]&/@{-1, 1} > Show@Block[{$DisplayFunction=Identity}, > Plot[F[x],{x,#[[1]],#[[2]]}]&/@Partition[Range[0,4,2],2,1]]; > {-(Pi/2), Pi/2} > (*plot to be displayed*) > > The right way of applying the Fundamental theorem is the following > > (Limit[F[x], x -> 4, Direction -> 1] - Limit[F[x], x -> 2, Direction - > > -1]) + > (Limit[F[x], x -> 2, Direction -> 1] - Limit[F[x], x -> 0, Direction > -> -1]) > N[%] > Pi - ArcTan[1/4] - ArcTan[5/12] > 2.501822870763167 > > Integrate works in precisely this way > > Integrate[f[x], {x, 0, 4}] > N[%] > > Pi - ArcTan[1/4] - ArcTan[5/12] > 2.501822870763167 > > A little later, he (i.e. Adamchik) says "The origin of > discontinuities > along the path of integration is not in the method of indefinite > integration but rather in the integrand." > > Adamchik mentions next that the four zeros of the integrand's > denominator > are two complex-conjugate pairs having real parts +/- 1.95334. It > then > seems that he is saying that, connecting these conjugate pairs by > vertical line segments in the complex plane, we get two branch > cuts... > > BUT didn't the relevant branch cuts for his int cross the real axis > at x = +/- 2, rather than at x = +/- 1.95334? > > (NOTE: The difference between 1.95334 and 2 is not due to numerical > error). > > Exactly what's going on here? > > Show[GraphicsArray[Block[{$DisplayFunction = Identity}, > (ContourPlot[#1[F[x + I*y]], {x, -4, 4}, {y, -4, 4}, Contours -> 50, > PlotPoints -> 50, ContourShading -> False, Epilog -> {Blue, > AbsoluteThickness[2], Line[{{0, 0}, {4, 0}}]}, > PlotLabel -> #1[HoldForm[F[x]]]] & ) /@ {Re, Im}]], ImageSize > - > 500]; > (*contour plots to be displayed*) > > > Consider next the following function > > f[x_] = 1/(5 + Cos[x]); > > Then > > Integrate[f[x], {x, 0, 4*Pi}] > N[%] > NIntegrate[f[x], {x, 0, 4*Pi}] > > Sqrt[2/3]*Pi > 2.565099660323728 > 2.5650996603270704 > > F[x_] = Integrate[f[x], x] > ArcTan[Sqrt[2/3]*Tan[x/2]]/Sqrt[6] > > D[F[x], x]==f[x]//Simplify > True > > Plot[f[x], {x, 0, 4*Pi}, Ticks -> {Range[0, 4*Pi, Pi/2], Automatic}] > Plot[F[x], {x, 0, 4*Pi}, Ticks -> {Range[0, 4*Pi, Pi/2], Automatic}] > > The antiderivative has jump discontinuities at Pi and 3Pi inside the > integration range > > Table[(Limit[F[x], x -> n*(Pi/2), Direction -> #1] & ) /@ {-1, 1}, {n, > 0, 4}] > {{0, 0}, {ArcTan[Sqrt[2/3]]/Sqrt[6], ArcTan[Sqrt[2/3]]/Sqrt[6]}, {-(Pi/ > (2*Sqrt[6])), Pi/(2*Sqrt[6])}, > {-(ArcTan[Sqrt[2/3]]/Sqrt[6]), -(ArcTan[Sqrt[2/3]]/Sqrt[6])}, {0, > 0}} > > Reduce[5 + Cos[x] == 0 && 0 <= Re[x] <= 4*Pi, x] > {ToRules[%]} /. (x_ -> b_) :> x -> ComplexExpand[b] > x /. %; > ({Re[#1], Im[#1]} & ) /@ %; > poi = Point /@ %; > > x == 2*Pi - ArcCos[-5] || x == 4*Pi - ArcCos[-5] || x == ArcC= os[-5] || > x == 2*Pi + ArcCos[-5] > {{x -> Pi - I*Log[5 - 2*Sqrt[6]]}, {x -> 3*Pi - I*Log[5 - 2*Sqrt[6]]}, > {x -> Pi + I*Log[5 - 2*Sqrt[6]]}, > {x -> 3*Pi + I*Log[5 - 2*Sqrt[6]]}} > > Of course F[4Pi]-F[0]=0 incorrectly. > > The reason for the discrepancy in the above result is not because of > any problem with the fundamental theorem of calculus, of course; it is > caused by the multivalued nature of the indefinite integral arctan. > > > Show[GraphicsArray[Block[{$DisplayFunction = Identity}, > (ContourPlot[#1[F[x + I*y]], {x, 0, 4*Pi}, {y, -4, 4}, Contours -> > 50, PlotPoints -> 50, ContourShading -> False, > FrameTicks -> {Range[0, 4*Pi, Pi], Automatic, None, None}, > Epilog -> {{PointSize[0.03], Red, poi}, > {Blue, Line[{{0, 0}, {4*Pi, 0}}]}}] & ) /@ {Re, Im}]], > ImageSize -> 500] > > So, in this example the discontinuities are indeed from the branch > cuts that start and end from the simple poles of the integrand which > is in agreement with V.A. paper! > > > I think I am not aware of something fundamental! > Can someone point out what I miss? > > > Regards > Dimitris