Re: Definite Integration in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg74501] Re: Definite Integration in Mathematica
- From: dh <dh at metrohm.ch>
- Date: Fri, 23 Mar 2007 19:08:46 -0500 (EST)
- References: <etqo3f$10i$1@smc.vnet.net> <ett6i6$gd2$1@smc.vnet.net>
Hello Dimitris, Yes, you are right, Mathematica chooses an antiderivative function that has branch cuts at approx. +/-2. However, this is not the only possible antiderivative, there are others with different branch cuts. But it is not too easy to find them. Daniel dimitris wrote: > Hello Daniel! > > Of course I am aware of branch cuts and the stuff! > > May be I was not too clear in order someone to understand me! > > Read the first 4 pages of the paper of V Adamichik's Definite > Integration > in Mathematica v. 3.0. available from here: > > http://library.wolfram.com/infocenter/Articles/3157/ > > I will try to set my question as clear as I can! > > The integral that appears in V.A. paper is > > f = HoldForm[Integrate[(4 + 2*x + x^2)/(17 + 2*x - 7*x^2 + x^4), {x, > 0, 4}]] > > and the integrand is a smooth integrable function in the whole real > axis. > > Mathematica's answer of (symbolic) definite integration is > > ReleaseHold@% > Pi - ArcTan[1/4] - ArcTan[5/12] > > which agrees with the result obtained by numerical integration > > {(N[#1, 20] & )[%], ReleaseHold[f /. Integrate[x___] :> NIntegrate[x, > WorkingPrecision -> 40, > AccuracyGoal -> 20]]} > {2.5018228707631675676, 2.50182287076316756755} > > Everything is ok up to now! And as I have shown in an old post you can > using Mathematica to get a continuus > antiderivative in the integration range but this is not my goal! I am > very happy by Mathematica's antiderivative which is rather simple > contrary to my expression. > > Mathematica uses (an extended version of) Risch algorithm in order to > get an antiderivative > for [(x^2 + 2*x + 4)/(x^4 - 7*x^2 + 2*x + 17) > > Simplify[Integrate[(x^2 + 2*x + 4)/(x^4 - 7*x^2 + 2*x + 17), x]] > ArcTan[(1 + x)/(4 - x^2)] > > and due to the jump discontinuity of ArcTan at x=2 the correct way in > order to apply the Newton-Leibniz formula > is > > (% /. x -> 4) - Limit[%, x -> 2, Direction -> -1] + Limit[%, x -> 2, > Direction -> 1] - (% /. x -> 0) > Pi - ArcTan[1/4] - ArcTan[5/12] > > Again everything is clear and absolutely easy to understand! > > My query appears exactly after this point! > > Victor Adamchik tries next (in the same article) to explain the > situation. > > He states that discontinuities of antiderivatives along the path of > integration are due to the nature of the integrand-not the method of > indefinite integration. In the above example, the integrand has four > singular poles that become branch points for the antiderivative. > Connected in pairs these points make two branch cuts. The path of > integration crosses one of them > > The poles of the integrand are at the following points in the complex > plain > > NSolve[x^4 - 7*x^2 + 2*x + 17 == 0, x] > {{x -> -1.9533360788744223 - 0.2440276635405635*I}, {x -> > -1.9533360788744223 + 0.2440276635405635*I}, > {x -> 1.9533360788744223 - 0.7559723364594371*I}, {x -> > 1.9533360788744223 + 0.7559723364594371*I}} > > (ContourPlot[Evaluate[#1[ArcTan[(1 + x)/(4 - x^2)] /. x -> x + I*y]], > {x, -3, 4}, {y, -3, 4}, ContourShading -> False, > Contours -> 20, PlotPoints -> 40, Epilog -> {Hue[0], > Thickness[0.005], Line[{{0, 0}, {4, 0}}]}] & ) /@ {Re, Im} > > What I don't understand is exactly his statement "... Connected in > pairs these points make two branch cuts..." > and how is connected with the jump discontinuity at x=2. > > These pairs of chosen branch cuts by Mathematica for the > antiderivative cross the horizontal axis at x=+/-2? > > If the answer is yes at last I have understand it! > > > dh <dh at metrohm.ch> wrote: > > Hi Dimitris, > if an anylytic function is multivalued with singularities, people > often > try nevertheless to define a continuous single valued function. This > is > not possible globally, there are always places where we will have a > misfit. One therefore cuts the plane and defines "branch cuts" where > the > new function is not continuous. Away from these cuts the function is > continuous. Note that these cuts are not clear cut. As long as we get > a > continuos function, we can choose the cuts as we please. Further, as > the > original function is multivalued, we can define even more different > continuous functions. > Now concerning the fundmental theorem, it seems clear that if we > cross > the branch cut the theorem can not be applied. It only works if the > antiderivative is continuous in the integration range. In your case: > ArcTan[(1 + x)/(4 - x^2)], the branch cut was chosen so that we have > a > discontinuity at x=2. If we had chosen the branch cuts differently, > we > may have been able to find a function that is continuous in 0..4. But > this is not easily done! At least not analytically. However, you may > easily do so numerically in the real domain (although the function > may > not be non-analytical (no power series)). > Daniel > > dimitris wrote: >> 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 == ArcCos[-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 >> >> > >