Re: Simplification of definite integral?
- To: mathgroup at smc.vnet.net
- Subject: [mg40751] Re: Simplification of definite integral?
- From: "Carl K. Woll" <carlw at u.washington.edu>
- Date: Wed, 16 Apr 2003 01:35:50 -0400 (EDT)
- Organization: University of Washington
- References: <200304130617.CAA27308@smc.vnet.net> <b7dq00$67a$1@smc.vnet.net> <b7gf2c$dr1$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Wolfgang, It might help to understand a little bit about what is going wrong when using Integrate for definite integrals. First, note that NIntegrate should always produce a correct answer. Also, when using Integrate with indefinite integrals, Integrate always produces a correct antiderivative, or to be more specific, a function which when differentiated will produce the integrand. It is only when Integrate is used with definite limits that problems can arise. There are two possibilites here. Either Integrate can produce the antiderivative of its integrand, or Integrate cannot figure out the antiderivative of its integrand.When Integrate can produce the antiderivative of its integrand, it will determine the definite integral by simply plugging in the limits of integration. I don't know the algorithm Mathematica uses when Integrate cannot produce the antiderivative of its integrand, and so I will not consider this case any further. The above discussion should give you a clue about where Mathematica is going wrong. If Mathematica simply plugs in the limits of integration, and the antiderivative contains branch cuts, there is no guarantee that the two limits will lie on the same branch, and if they are not on the same branch Integrate will give an incorrect answer. Consider the following simple but contrived example: Integrate[1/(x-1),{x,-I,I}] -Log[-1 - I] + Log[-1 + I] The integral of 1/(x-1) is of course Log[x-1] and so Mathematica found the indefinite integral and plugged in the limits. However, Log has a branch along the negative real axis, and integrating from -I to I will cross this branch, and so the two limits are not on the same branch. Let's compare a numerical approximation of the above integral to the answer provided by NIntegrate: Integrate[1/(x-1),{x,-I,I}]//N NIntegrate[1/(x-1),{x,-I,I}] 0. + 4.71239 I 0. - 1.5708 I We see that Integrate gives an incorrect answer, and the two answers differ by 2Pi, as expected by the residue theorem. In your example, Mathematica is indeed capable of finding the antiderivative of your integrand. I won't bother copying Mathematica's output, but I will point out that the answer contains two functions with branch cuts, Log and CosIntegral. The Log terms don't present a problem here (as they vanish at the limits), but the CosIntegral does, since Mathematica puts the branch cut along the negative real axis and so having both CosIntegral[-2d+2x] and CosIntegral[2d+2x] presents a problem for the lower limit of x=-Infinity. Actually, this example is a little weird. Consider: (Integrate[Sin[x-d]/(x-d) Sin[x+d]/(x+d),x]/.x->Infinity)- (Integrate[Sin[x-d]/(x-d) Sin[x+d]/(x+d),x]/.x->-Infinity) Pi Sin[2 d] ----------- 2 d where I simply plug in the limits of integration into the indefinite integral, and the correct answer pops out. I think what is happening here is that Mathematica is going through a Limit process which undergoes a hiccup at x->-Infinity. At any rate, here are a couple more suggestions on how to get the correct answer. FullSimplify[Integrate[Sin[x-d]/(x-d) Sin[x+e]/(x+e),{x,-Infinity,Infinity}]/.e->d] Pi Cos[d] Sin[d] ---------------- d <<Calculus`Limit` Integrate[Sin[x-d]/(x-d) Sin[x+d]/(x+d),{x,-a,a}]; Limit[%,a->Infinity] Pi Cos[d] Sin[d] ---------------- d The second suggestion uses the Limit package, which you should avoid in general. For David Cantrell's example we can do something similar (if you have loaded the Limit package you should restart the kernel). Integrate[Sin[x - 1]/(x - 1+d) Sin[x + 1]/(x + 1), {x,2,Infinity}]/.d->0 %//N Cos[2] Log[3] Pi Sin[2] 2 Cos[2] CosIntegral[2] - 2 Cos[2] CosIntegral[6] - 2 Sin[2] SinIntegral[2] - 2 Sin[2] SinIntegral[6] ------------- + --------- + -------------------------------------------------------------------------- --------------------------- 4 4 8 -0.140037 In conclusion, be very careful of results returned by Integrate for definite integrals. You should probably always do a numerical check on the answer using NIntegrate. If the answer given by Integrate is incorrect, you can try using options such as Principal Value, or you can try perturbing your integral a little bit in the hope that the resulting antiderivative doesn't have a branch cut along the path of integration. It would be nice if you had the option of changing the location of the branch cuts of various functions. Carl Woll Physics Dept U of Washington "David W. Cantrell" <DWCantrell at sigmaxi.org> wrote in message news:b7gf2c$dr1$1 at smc.vnet.net... > Vladimir Bondarenko <vvb at mail.strace.net> wrote: > > Sunday, April 13, 2003, 3:17:27 AM, "Dr. Wolfgang Hintze" <weh at snafu.de> > > wrote: > > > > DWH> How do I get a satisfactory result from mathematica for this > > function > > > > DWH> f[d]:=Integrate[Sin[x-d]/(x-d) Sin[x+d]/(x+d),{x,-Infinity, > > Infinity}] > > > > DWH> I tried > > > > DWH> f[d]//ComplexExpand > > > > DWH> and several assumptions but I didn't succeed. Any hints? > > > > I am not sure of what is 'a satisfactory result'? Do you mean something > > like this > > > > Integrate[Sin[x - d]/(x - d) Sin[x + d]/(x + d), {x, -Infinity, > > Infinity}, Assumptions -> d > 0, PrincipalValue -> True]//TrigReduce > > > > (Pi*Sin[2*d])/(2*d) > > That is indeed satisfactory, at least to me. [However I'm surprised that > PrincipalValue -> True was required; after all, the singularities are > _removable_. Indeed, with the sinc function, the integrand could be easily > rewritten without singularities.] > > But please do not overlook the fact that Mathematica can make mistakes with > integrals of this type even when no singularities are involved. As a simple > example, consider > > Integrate[Sin[x - 1]/(x - 1) Sin[x + 1]/(x + 1), {x, 2, Infinity}] > > The answer should clearly be purely real, yet Mathematica's answer is > approximately -0.854198 - 0.326841*I. (Based on numerical investigations, > I suspect the correct answer is approximately -0.14 .) > > Regards, > David Cantrell >
- References:
- Simplification of definite integral?
- From: "Dr. Wolfgang Hintze" <weh@snafu.de>
- Simplification of definite integral?