Definite Integration Question

*To*: mathgroup at smc.vnet.net*Subject*: [mg73071] Definite Integration Question*From*: "dimitris" <dimmechan at yahoo.com>*Date*: Thu, 1 Feb 2007 03:14:56 -0500 (EST)

Hello to all of you! Firstly, I apologize for the lengthy post! Secondly, I have tried to send this message the last three days so I apologize if it appears more than one time! In this thread: http://groups.google.com/group/comp.soft-sys.math.mathematica/ browse_thread/thread/a8fe50abf3e1edfa/d982d913a8c0b250? lnk=gst&q=integrate&rnum=13&hl=en#d982d913a8c0b250 I mention Victor Adamchik's Mathematica 3.0's Definite Integration article (also in notebook format see http://library.wolfram.com/ infocenter/Articles/3157/). David Cantrell made some very interesting comments. Since there were no responses to his queries (as far as I know) I would like to present again some of the posted issues. 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 in this particular -(*) see below-definite integral works in precisely this way Integrate[f[x], {x, 0, 4}] N[%] Pi - ArcTan[1/4] - ArcTan[5/12] 2.501822870763167 (*) At this point Adamchik makes a quite surprising comment (as David pointed out in his original post) "Mathematica evaluates definite integrals in precisely that way". Of course, later in his article he mentions the "real story", that, "... above procedure cannot cover the whole variety of definite integrals...". E.g. Integrate[Cos[Sin[x]], x] Plot[Cos[Sin[x]], {x, 0, 2*Pi}, Axes -> False, Frame -> {True, True, False, False}]; Integrate[Cos[Sin[x]], {x, 0, 2*Pi}] N[%] NIntegrate[Cos[Sin[x]], {x, 0, 2*Pi}] Integrate[Cos[Sin[x]], x] (*plot to be displayed*) 2*Pi*BesselJ[0, 1] 4.807878861268827 4.807878861268819 Now, since David Cantrell's queries were stated very readable and clear and further I also have more or less the same questions I just copy from his original post (with slightly modifications for my needs). 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." If that were true, since the integrand cannot be changed, it would seem that there would be absolutely no way to avoid discontinuities along the path of integration. But that is simply not the case! Here, for example, is an antiderivative which is continuous along the whole real line: FF[x_]=ArcTan[(4x + Sqrt[2( 15 + Sqrt[241])])/(2 - Sqrt[2(-15 + Sqrt[241])])] + ArcTan[(4x - Sqrt[2( 15 + Sqrt[241])])/(2 + Sqrt[2(-15 + Sqrt[241])])]; Plot[FF[x],{x,0,4}]; (*plot to be displayed*) Doing a small parentheses in David's post, at this moment I will use Mathematica in order to find an antiderivative which is continuous along the whole real line: Times@@Apply[#1[[1]] - #1[[2]] & , Solve[Denominator[f[x]] == 0, x], 1] Apart[(4 + 2*x + x^2)/%] Map[FullSimplify, %, 1] (Integrate[#1, x] & ) /@ % FullSimplify[%] Plot[%, {x, 0, 4}]; Chop[N[(%% /. x -> 4) - (%% /. x -> 0)]] FullSimplify[D[%%%, x] == f[x]] Returning now to David's post while it might be difficult to use Mathematica to find FF(x), it is at least easy to use Mathematica to confirm that it is an antiderivative of f(x). Indeed Simplify[D[FF[x], x] == f[x]] True (Continuing to copy from David's original post) 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? NSolve[Denominator[f[x]] == 0, x] 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]; 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]; {{x -> -1.9533360788744223 - 0.2440276635405635*I}, {x -> -1.9533360788744223 + 0.2440276635405635*I}, {x -> 1.9533360788744223 - 0.7559723364594371*I}, {x -> 1.9533360788744223 + 0.7559723364594371*I}} (*contour plots to be displayed*) Later on, he says "Thinking hard, we can build an antiderivative that does not have a branch cut crossing a given interval of integration. However, we can never get rid of branch cuts!" I agree. Nevertheless, integration along the real line is often so useful that it would be nice to be able to ask Mathematica, as an option, to give an antiderivative (such as my contint-FF[x] in the current post-above) which is continuous along the real line. In the last part of that section, Adamchik notes that "...Integrate may not be able to detect all singular points on the interval of integration, which will result in a warning message..." But it's also worth noting that such a failure may occur without any warning message. A recent example was posted to this newsgroup by Dimitris in the thread "integrate"; (see here: http://groups.google.com/group/comp.soft- sys.math.mathematica/browse_thread/thread/33845242cee3b5d/ e919391644135bdf?lnk=gst&q=integrate&rnum=11&hl=en#e919391644135bdf ) the problem with his last item seems to be caused by branch cuts of EllipticF[z, m]. I would appreciate any kind of comments! Thanks in advance! Dimitris

**Re: Apart question**

**Limit question**

**Re: Apart question**

**Limit question**