Re: Calculating a simple integral
- To: mathgroup at smc.vnet.net
- Subject: [mg131146] Re: Calculating a simple integral
- From: "Dr. Wolfgang Hintze" <weh at snafu.de>
- Date: Fri, 14 Jun 2013 05:01:15 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <7586978.94875.1370767085206.JavaMail.root@m06> <kpbp4l$96i$1@smc.vnet.net>
On 13 Jun., 08:33, "Dr. Wolfgang Hintze" <w... at snafu.de> wrote:
> On 11 Jun., 08:23, Andrzej Kozlowski <akozlow... at gmail.com> wrote:
>
>
>
>
>
> > No, it's similar to:
>
> > Integrate[(1 -
> > Cos[x])/(x^2*(x^2 - 4*Pi^2)^2), {x, -Infinity, Infinity}]
>
> > 3/(32*Pi^3)
>
> > On 10 Jun 2013, at 10:11, djmpark <djmp... at comcast.net> wrote:
>
> > > Doesn't this have a singularity at 2 Pi that produces non-convergence? It's
> > > similar to:
>
> > > Integrate[1/x^2, {x, \[Epsilon], \[Infinity]},
> > > Assumptions -> \[Epsilon] > 0]
>
> > > 1/\[Epsilon]
>
> > > That diverges as epsilon -> 0.
>
> > > Are you sure you copied the integral correctly?
>
> > > David Park
> > > djmp... at comcast.net
> > >http://home.comcast.net/~djmpark/index.html
>
> > > From: dsmirno... at gmail.com [mailto:dsmirno... at gmail.com]
>
> > > If there is a way to calculate with Mathematica the following integral:
>
> > > in = -((-1 + Cos[kz])/(kz^2 (kr^2 + kz^2)^2 (kz^2 - 4 \[Pi]^2)^2))
> > > Integrate[in, {kz, -Infinity, Infinity}, Assumptions -> kr > 0]
>
> > > Another system calculates the same integral instantly. :)
>
> > > Thanks for any suggestions.
>
> Sorry, but I made indeed a calculation error!
> Correcting it the partial fraction decomposition leads to Dmitry's
> result.
> Furthermore, calculating first the indefinite integral and then taking
> limits leads to a false result.
> Direct calculation of the integral leads to MeierG functions which are
> useless because we cannot enter any numerical value.
> So, rather than provding the correct result Mathematica comes up with
> different false result depending on the method used, and we cannot tel
> which one is correct without "research" work.
> Summarizing, I need to restate my criticism of Mathematica with
> respect to integration (I'm using version 8).
>
> Regards,
> Wolfgang
Sorry once more. Here comes a final, compact and correct derivation
Complete compact calculation of the integral.
The main idea is decomposition into partial fractions.
The integrand is
In[1]:= in = -((-1 + Cos[z])/(z^2*(-4*Pi^2 + z^2)^2*(r^2 + z^2)^2));
Decomposing into partial fractions gives
In[2]:= Apart[1/(z^2*(-4*Pi^2 + z^2)^2*(r^2 + z^2)^2)]
Out[2]= 1/(16*Pi^4*r^4*z^2) +
1/(64*Pi^4*(4*Pi^2 + r^2)^2*(-2*Pi + z)^2) + (-28*Pi^2 - 3*r^2)/(128*
Pi^5*(4*Pi^2 + r^2)^3*(-2*Pi + z)) +
1/(64*Pi^4*(4*Pi^2 + r^2)^2*(2*Pi + z)^2) + (28*Pi^2 + 3*r^2)/(128*
Pi^5*(4*Pi^2 + r^2)^3*(2*Pi + z)) -
1/(r^2*(4*Pi^2 + r^2)^2*(r^2 + z^2)^2) + (-4*Pi^2 -
3*r^2)/(r^4*(4*Pi^2 + r^2)^3*(r^2 + z^2))
Frequently, treating a list of terms is better than the sum in order
to see what's going on in detail
In[3]:= ls = List @@ %
Out[3]= {1/(16*Pi^4*r^4*z^2),
1/(64*Pi^4*(4*Pi^2 + r^2)^2*(-2*Pi + z)^2), (-28*Pi^2 - 3*r^2)/(128*
Pi^5*(4*Pi^2 + r^2)^3*(-2*Pi + z)),
1/(64*Pi^4*(4*Pi^2 + r^2)^2*(2*Pi + z)^2), (28*Pi^2 + 3*r^2)/(128*
Pi^5*(4*Pi^2 + r^2)^3*(2*Pi + z)),
-(1/(r^2*(4*Pi^2 + r^2)^2*(r^2 + z^2)^2)), (-4*Pi^2 -
3*r^2)/(r^4*(4*Pi^2 + r^2)^3*(r^2 + z^2))}
Now integrating the list gives
In[4]:= t =
Timing[Table[
Integrate[(1 - Cos[z])*ls[[k]], {z, -Infinity, Infinity},
Assumptions -> r > 0], {k, 1, Length[ls]}]];
t[[1]]
is = t[[2]]
During evaluation of In[4]:= Integrate::idiv:Integral of (-1+Cos[z])/
(2 \[Pi]-z) does not converge on {-\[Infinity],\[Infinity]}. >>
During evaluation of In[4]:= Integrate::idiv:Integral of (-1+Cos[z])/
(2 \[Pi]+z) does not converge on {-\[Infinity],\[Infinity]}. >>
Out[5]= 4.867
Out[6]= {1/(16*Pi^3*r^4), 1/(64*Pi^3*(4*Pi^2 + r^2)^2),
Integrate[((-28*Pi^2 - 3*r^2)*(1 - Cos[z]))/(128*
Pi^5*(4*Pi^2 + r^2)^3*(-2*Pi + z)), {z, -Infinity, Infinity},
Assumptions -> r > 0], 1/(64*Pi^3*(4*Pi^2 + r^2)^2),
Integrate[((28*Pi^2 + 3*r^2)*(1 - Cos[z]))/(128*
Pi^5*(4*Pi^2 + r^2)^3*(2*Pi + z)), {z, -Infinity, Infinity},
Assumptions ->
r > 0], (Pi*(1 - E^r + r))/(E^
r*(2*r^5*(4*Pi^2 + r^2)^2)), ((-1 + E^(-r))*
Pi*(4*Pi^2 + 3*r^2))/(r^5*(4*Pi^2 + r^2)^3)}
Oops, there appear divergences in the third and fifth term.
Ok, let's calculate the sum of both instead
In[65]:= Integrate[(1 - Cos[z])*(ls[[3]] + ls[[5]]), {z, -Infinity,
Infinity}]
Out[65]= 0
Fine, the terms cancel each other.
Now, collecting the results
In[72]:= (is[[#1]] & ) /@ {1, 2, 4, 6, 7}
Out[72]= {1/(16*Pi^3*r^4), 1/(64*Pi^3*(4*Pi^2 + r^2)^2),
1/(64*Pi^3*(4*Pi^2 + r^2)^2), (Pi*(1 - E^r + r))/(E^
r*(2*r^5*(4*Pi^2 + r^2)^2)), ((-1 + E^(-r))*
Pi*(4*Pi^2 + 3*r^2))/(r^5*(4*Pi^2 + r^2)^3)}
Summing up and simplifying gives my (wh) final result
In[73]:= fwh[r_] = Simplify[Plus @@ %]
Out[73]= (28*E^r*Pi^2*r^5 + 3*E^r*r^7 +
64*Pi^6*(3 + r + E^r*(-3 + 2*r)) +
16*Pi^4*r^2*(7 + r + E^r*(-7 + 6*r)))/(E^
r*(32*Pi^3*r^5*(4*Pi^2 + r^2)^3))
In[74]:= fwh[1.]
Out[74]= 0.0004911297292720861
Dmitry's result is slightly more lengthy
In[71]:= fs[
r_] := (-192*Pi^6 + 128*Pi^6*r - 112*Pi^4*r^2 + 96*Pi^4*r^3 +
28*Pi^2*r^5 + 3*r^7 +
16*Pi^4*(4*Pi^2*(3 + r) + r^2*(7 + r))*Cosh[r] -
16*Pi^4*(4*Pi^2*(3 + r) + r^2*(7 + r))*Sinh[r])/(32*Pi^3*
r^5*(4*Pi^2 + r^2)^3)
But both are identical
In[76]:= FullSimplify[fwh[r] == fs[r]]
Out[76]= True
I can also comfirm that the result is in agreement with numerical
calculations using NIntegrate (as was stated earlier by Dmitry).
Regards,
Wolfgang