Re: Definite Integration in Mathematica

• To: mathgroup at smc.vnet.net
• Subject: [mg74488] Re: Definite Integration in Mathematica
• From: "David W.Cantrell" <DWCantrell at sigmaxi.net>
• Date: Fri, 23 Mar 2007 19:01:42 -0500 (EST)
• References: <etqo3f\$10i\$1@smc.vnet.net> <ett73k\$h3g\$1@smc.vnet.net>

```"Michael Weyrauch" <michael.weyrauch at gmx.de> wrote:
> Hello,
>
>   another nice example, where the result for the integral given by
> Mathematica just cannot be right.

I understand your point, but it's impossible to have a result here which
is "right" throughout the complex plane.

> The indefinite integral of a continuuos function cannot have a jump.

along the real line; the integrand

(x^2 + 2x + 4)/(x^4 - 7x^2 + 2x + 17)

is indeed continuous there. But computer algebra systems sometimes give
antiderivatives which are "right" only piecewise. You're welcome to
consider that unfortunate in this case because we can do better; see below.

> That -- to my opinion -- is mathematical
> nonsens. We all learned that integration "smoothens", i.e. if the
> integrand is somewhat "ugly" the integral is less "ugly". (Never mind my
> English!).
>
> So the result should actually be presented as
>
> F[x_]=ArcTan[(1 + x)/(4 - x^2)]*UnitStep[2 - x] +
> (Pi + ArcTan[(1 + x)/(4 - x^2)])*UnitStep[-2 + x]

No, not if you're wanting an antiderivative valid along the whole real
line. Your F has a jump discontinuity at x = -2. Furthermore, it is
Indeterminate at x = +2, although that singularity is removable.

Back in December, in the thread which led to this one, I gave an
antiderivative which is continuous along the whole real line:

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])])]

David W. Cantrell

> This is a perfectly nice function without jumps and  it is the
> antiderivative of your integrand, and the fundamental theorem of calculus
> works with it...
>
> So, despite my love for Mathematica, here it fools me....
>
> Regards   Michael
>
> "dimitris" <dimmechan at yahoo.com> schrieb im Newsbeitrag
> news:etqo3f\$10i\$1 at smc.vnet.net...
> > 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
> >
> >

```

• Prev by Date: Re: Definite Integration in Mathematica
• Next by Date: Re: Re: Definite Integration in Mathematica
• Previous by thread: Re: Definite Integration in Mathematica
• Next by thread: Re: Definite Integration in Mathematica