Re: pitfall in analytic function
- To: mathgroup at smc.vnet.net
- Subject: [mg41574] Re: pitfall in analytic function
- From: "David W. Cantrell" <DWCantrell at sigmaxi.org>
- Date: Tue, 27 May 2003 01:47:36 -0400 (EDT)
- References: <31378N138@web2news.com> <20030518.031910@whim.org>
- Sender: owner-wri-mathgroup at wolfram.com
[I've added other groups to which this same question was originally posed.] rob at whim.org (Rob Johnson) wrote: > In article <31378N138 at web2news.com>, > "Narasimham G.L." <google.news.invalid at web2news.net> wrote: > >I tried to integrate a transcendental function having factor (x-2), > >analytic on the whole line, even at x=2, but unable to get through with > >the smooth function at x=2.The following Mathematica prgram was run, and > >although at x=2 it is a smooth plot ( minimum value is around -1.204 at > >x=2.1), it proves to be a stumbling block in performing integration. > > First let's look at this problem mathematically rather than immediately > running to Mathematica: > > |\ 2^x - x^2 > | --------- dx > \| x - 2 > > |\ 2^x - 4 > = | -(x+2) + ------- dx > \| x - 2 > > |\ 2^x - 4 > = -(x+2)^2/2 + | ------- dx [1] > \| x - 2 > > Let u = (x-2)ln(2), then 4 e^u = 2^x. Therefore, [1] > > |\ e^u - 1 > = -(x+2)^2/2 + 4 | ------- du [2] > \| u > > You can easily get the series for the integral in [2] from the series > for e^u: > > |\ e^u - 1 u^2 u^k > | ------- du = C + u + --- + ... + ---- + ... [3] > \| u 4 k k! > > This series converges for all u. > > The integral in [3] can also be given by the the Exponential Integral, > EI(u): > > |\ e^u - 1 > | ------- du = EI(u) - ln(u) + C [4] > \| u I suspect that you actually intended to write EI(u) - ln(|u|) + C above. > Therefore, the indefinite integral could be written as > > |\ 2^x - x^2 > | --------- dx > \| x - 2 > > = -(x-2)^2/2 + 4 ( EI((x-2)ln(2)) - ln(|x-2|) ) + C [5] Typo: The first term above should be -(x+2)^2/2. > >Plot [ (2^x-x^2)/(x-2), { x,0,4 }] > >y1=Integrate [(2^x-x^2)/(x-2),{x,0,x}] > >Plot[y1 ,{x,0, 4} ]; > >y2= -2 x - x^2/2 + 4 ExpIntegralEi[-2 Log[2] + x Log[2]] - > > 4 (ExpIntegralEi[-2 Log[2]] - Log[2]) - 4 Log[2 - x]; > >Plot[y2 ,{x,2.1, 4} ]; > >Plot[y2 ,{x,0, 4} ]; > > I see that Mathematica did not get the correct integral since it > gives Log[2-x] instead of Log[Abs[2-x]]. While I certainly like your [5] better than Mathematica's proposed antiderivative, I think it is debatable whether or not Mathematica got a correct antiderivative. After all, the integrand has a singularity, albeit a removable one, at x = 2. That being the case, it seems to me that it is reasonable to allow an antiderivative to have a singularity at x = 2 also. Indeed, your [5] and Mathematica's antiderivative both have singularities at x = 2. The big difference between your [5] and Mathematica's antiderivative is that the singularity in yours is removable, that in Mathematica's is not. I certainly think that your [5] is much nicer, but I'd be reluctant to say that Mathematica's is actually wrong. > If you replace Log[2-x] > above with Log[Abs[2-x]], the plot comes out fine. Agreed (unless we plot so exceedingly close to x = 2 that numerical troubles near the singularity become apparent). BTW, an antiderivative which might fully satisfy the OP is { -(x+2)^2/2 + 4 ( EI((x-2)ln(2)) - ln(|x-2|) ) if x <> 2 { { 4( gamma + ln(ln(2)) - 2 ) if x = 2 where gamma is the Euler-Mascheroni constant. Regards, David Cantrell