Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

Calculating a simple integral

73 Aufrufe
Direkt zur ersten ungelesenen Nachricht

dsmir...@gmail.com

ungelesen,
09.06.2013, 04:26:4209.06.13
an
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.

Peter Klamser

ungelesen,
10.06.2013, 04:02:0110.06.13
an
in=-((-1+Cos[kz])/(kz^2 (kr^2+kz^2)^2 (kz^2-4 \[Pi]^2)^2))//ExpandAll

bring two terms in a sum:

t1=1/(kr^4 kz^6+2 kr^2 kz^8+kz^10-8 kr^4 kz^4 \[Pi]^2-16 kr^2 kz^6
\[Pi]^2-8 kz^8 \[Pi]^2+16 kr^4 kz^2 \[Pi]^4+32 kr^2 kz^4 \[Pi]^4+16
kz^6 \[Pi]^4)

t2=Cos[kz]/(kr^4 kz^6+2 kr^2 kz^8+kz^10-8 kr^4 kz^4 \[Pi]^2-16 kr^2
kz^6 \[Pi]^2-8 kz^8 \[Pi]^2+16 kr^4 kz^2 \[Pi]^4+32 kr^2 kz^4
\[Pi]^4+16 kz^6 \[Pi]^4)

int$int1 = \[Integral]t1 \[DifferentialD]kz

brings you a solution that should be treated with Limit twice:

Limit[int$int1, kz -> \[Infinity]] // ComplexExpand

and

Limit[int$int1, kz -> -\[Infinity]] // ComplexExpand

The same procedure with t2.

Kind regards from Peter

2013/6/9 <dsmir...@gmail.com>:

Andrzej Kozlowski

ungelesen,
10.06.2013, 04:02:2210.06.13
an

On 9 Jun 2013, at 21:45, Dmitry Smirnov <dsmir...@gmail.com> wrote:

> Thanks a lot for all your advises!
>
> Unfortunately none of them works. Because:
> 1) I have to calculate integral symbolicaly, not numerically.
> 2) It can't be divided into two parts because each of them diverges.
However, the whole expression is always finite. For example at the point
kz=2*Pi both numerator and denominator turn into zero.

The function has removable singularities at 2Pi and -2Pi. It has a pole
of order 2 at I and at -I and it is easy to compute the residues there.
Unfortunately this is not enough to compute the integral since the
modulus of Cos[z]-1 grows as z becomes large, so the standard trick of
residue calculus (integrating over a half-circle) can't be used.

AK



>
> Finally I have taken this one and some similar integrals in other
system and saved the results into file.
>
> Thanks again for the efforts!
>
>
> 2013/6/9 Andrzej Kozlowski <akozl...@gmail.com>
>
> On 9 Jun 2013, at 10:32, dsmir...@gmail.com wrote:
>
> > 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.
> >
>
>
>
> Which version of Mathematica are you using?
>
> Mathematica does quite quickly calculate answers to this integral for
numerical values of kr. For example, for kr=1 I get:
>
> Integrate[(Cos[x] - 1)/(x^2*(x^2 - 4*Pi^2)^2*(x^2 + 1)^2),
> {x, -Infinity, Infinity}]
>
> (-3*E - 28*E*Pi^2 + 16*(-8 + E)*Pi^4 + 64*(-4 + E)*Pi^6)/(32*
> E*(Pi + 4*Pi^3)^3)
>
> Numerically this gives:
>
> N[%]
>
> -0.00049113
>
> which agrees with the value returned by NIntegrate, so it should be
correct. The general case takes a lot longer but there is still an
answer:
>
> Integrate[(Cos[x] - 1)/(x^2*(x^2 - 4*Pi^2)^2*(x^2 + a^2)^2),
> {x, -Infinity, Infinity}, Assumptions -> a > 0]
>
> (1/(128*a^5*Pi^4*(a^2 + 4*Pi^2)^3))*(-11*a^7*Pi -
> 92*a^5*Pi^3 + 448*a^2*Pi^5 +
> 768*Pi^7 + 2*I*a^7*CosIntegral[2*Pi] +
> 40*I*a^5*Pi^2*CosIntegral[2*Pi] -
> 2*I*a^7*ExpIntegralEi[-2*I*Pi] -
> 40*I*a^5*Pi^2*ExpIntegralEi[-2*I*Pi] +
> 16*a*Pi^(7/2)*(5*a^2 + 4*Pi^2)*MeijerG[{{1/2, 1}, {}},
> {{-(1/2), 1/2, 1}, {0}}, -((I*a)/2), 1/2] +
> 16*a*Pi^(7/2)*(5*a^2 + 4*Pi^2)*
> MeijerG[{{1/2, 1}, {}}, {{-(1/2), 1/2, 1}, {0}}, (I*a)/2,
> 1/2] +
> 32*a^3*Pi^(7/2)*
> MeijerG[{{1/2, 1}, {}}, {{-(1/2), 1, 3/2}, {0}}, -((I*a)/2),
> 1/2] +
> 128*a*Pi^(11/2)*MeijerG[{{1/2, 1}, {}}, {{-(1/2), 1, 3/2}, {0}},
> -((I*a)/2), 1/2] + 32*a^3*Pi^(7/2)*MeijerG[{{1/2, 1}, {}},
> {{-(1/2), 1, 3/2}, {0}}, (I*a)/2, 1/2] +
> 128*a*Pi^(11/2)*
> MeijerG[{{1/2, 1}, {}}, {{-(1/2), 1, 3/2}, {0}}, (I*a)/2,
> 1/2] + 2*a^7*SinIntegral[2*Pi] +
> 40*a^5*Pi^2*SinIntegral[2*Pi])
>
> I have no idea if this is correct or not and don't see how this could
be useful. What sort of answer does the other system give? And why do
you think this is a "simple" integral? (There might be a way to evaluate
it using the calculus of residues but probably it needs some clever
trick since the obvious approaches don't seem to work.)
>
>
>
> Andrzej Kozlowski
>
>
>


Dmitry Smirnov

ungelesen,
10.06.2013, 04:02:4210.06.13
an

I believe that oscillating function as (Cos[z]-1) allows one to calculate
this integral by the residues. Anyway you can check numerically that the
correct answer is following:

-1/32/((kr^2 + 4*Pi^2)^3*kr^5*Pi^3)*(192*Pi^6*Sinh[kr] +
16*Pi^4*Sinh[kr]*kr^3 + 64*Pi^6*Sinh[kr]*kr - 192*Pi^6*Cosh[kr] -
112*Pi^4*Cosh[kr]*kr^2 + 112*Pi^4*Sinh[kr]*kr^2 -
16*Pi^4*Cosh[kr]*kr^3 - 64*Pi^6*Cosh[kr]*kr + 192*Pi^6 - 3*kr^7 -
28*kr^5*Pi^2 - 96*kr^3*Pi^4 - 128*kr*Pi^6 + 112*kr^2*Pi^4)


djmpark

ungelesen,
10.06.2013, 04:03:4310.06.13
an
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
djm...@comcast.net
http://home.comcast.net/~djmpark/index.html

Bob Hanlon

ungelesen,
10.06.2013, 04:04:2310.06.13
an

This is far from instantly,

$Version


"9.0 for Mac OS X x86 (64-bit) (January 24, 2013)"


in = ((1 - Cos[kz])/
(kz^2 (kr^2 + kz^2)^2 (kz^2 - 4 Pi^2)^2));


in2 = (in*(1 + Cos[kz]) // Simplify)/
(1 + Cos[kz]) // Simplify


(2*Sin[kz/2]^2)/(kz^2*(kr^2 + kz^2)^2*(kz^2 - 4*Pi^2)^2)


in (and in2) is an even function of kz


in == (in /. kz -> -kz) ==
in2 == (in2 /. kz -> -kz) // Simplify


True


Clear[f]


Timing[f[kr_?Positive] =
2*Integrate[in2, {kz, 0, Infinity},
Assumptions -> kr > 0]]


{
285.13703099999997903069015592336654663086`8.47565353\

646281, (1/(32*kr^5*Pi^3*(kr^2 + 4*Pi^2)^3))*
(I*(-3*I*kr^7 - 28*I*kr^5*Pi^2 +
8*Pi^(5/2)*(5*kr^2 + 4*Pi^2)*
MeijerG[{{1, 1, 3/2}, {}}, {{1, 1, 3/2},
{0, 1/2}}, -((I*kr)/2), 1/2] -
8*Pi^(5/2)*(5*kr^2 + 4*Pi^2)*
MeijerG[{{1, 1, 3/2}, {}}, {{1, 1, 3/2},
{0, 1/2}}, (I*kr)/2, 1/2] + 16*kr^2*Pi^(5/2)*
MeijerG[{{1, 1, 3/2}, {}}, {{1, 3/2, 2},
{0, 1/2}}, -((I*kr)/2), 1/2] +
64*Pi^(9/2)*MeijerG[{{1, 1, 3/2}, {}},
{{1, 3/2, 2}, {0, 1/2}}, -((I*kr)/2), 1/2] -
16*kr^2*Pi^(5/2)*MeijerG[{{1, 1, 3/2}, {}},
{{1, 3/2, 2}, {0, 1/2}}, (I*kr)/2, 1/2] -
64*Pi^(9/2)*MeijerG[{{1, 1, 3/2}, {}},
{{1, 3/2, 2}, {0, 1/2}}, (I*kr)/2, 1/2]))}


LogPlot[f[kr] // Chop, {kr, .1, 3},
Frame -> True, Axes -> False,
PlotRange -> All]



Bob Hanlon

Roland Franzius

ungelesen,
10.06.2013, 04:04:4310.06.13
an
Am 09.06.2013 10:26, schrieb dsmir...@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. :)
>

Did you check the numerics?

The expression is a square of

f[x_,a_] = Sin[x/2]((x (x - 2 Pi)(x + 2 Pi)) /(x^2+a^2)

This function looks like a multiple Sinc function with a canceling of
zeroes of the numerator function sin(x/2) at x = 0 and +- 2pi by the
denominator polynomial.

Mathematica sticks in Nirwana with the definite integral but
accomplishes to find the indefinite integral

F[x_,a_] = Integrate[f[x,a]^2,x]

But, of course, with doubious imaginary parts and a definitely wrong
Limit[ F[x,a]-F[-x,a],x->oo]

despite the fact, that the derivative of F wrt to x is correct.

Another hint here, that the new developments in finding definite
integrals are probably full of errors implemented.

When setting
$Assumptions=x \in Reals && a>0
I got an errormessage by NIntegrate, that x > 1/4096 :-(


But the FourierTransform package is working

FL[a_]= Limit[ Sqrt[2 Pi] FourierTansform[f[x,a]^2,x,k ], k->0]

Compare numerically eg

FL[0.05`20]

and

NIntegrate[ f[x,0.05`20]^2,{x,-oo,oo},WorkingPrecision->20]

Hope ist helps.

--

Roland Franzius

Andrzej Kozlowski

ungelesen,
10.06.2013, 04:05:0410.06.13
an

On 9 Jun 2013, at 10:32, dsmir...@gmail.com wrote:

> 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. :)
>

Dmitry Smirnov

ungelesen,
10.06.2013, 04:05:2410.06.13
an

Thanks a lot for all your advises!

Unfortunately none of them works. Because:
1) I have to calculate integral symbolicaly, not numerically.
2) It can't be divided into two parts because each of them diverges.
However, the whole expression is always finite. For example at the point
kz=2*Pi both numerator and denominator turn into zero.

Finally I have taken this one and some similar integrals in other system
and saved the results into file.

Thanks again for the efforts!


2013/6/9 Andrzej Kozlowski <akozl...@gmail.com>

>

Andrzej Kozlowski

ungelesen,
10.06.2013, 04:05:4410.06.13
an

On 9 Jun 2013, at 21:45, Dmitry Smirnov <dsmir...@gmail.com> wrote:

> Thanks a lot for all your advises!
>
> Unfortunately none of them works.

What do you mean by that? I sent you a symbolic answer. Is it wrong? Have you checked it.

(Your part 2) has nothing to do with anything that I wrote.)

AK

Nasser M. Abbasi

ungelesen,
10.06.2013, 04:01:4110.06.13
an
You did not say which version you used.

I do get result from 9.01, but it took about 2 minutes

--------------------------
ClearAll["`*"];
in = -((-1 + Cos[kz])/(kz^2 (kr^2 + kz^2)^2 (kz^2 - 4 \[Pi]^2)^2));
Assuming[kr > 0, Integrate[in, {kz, -Infinity, Infinity}]]

-(1/(32 kr^5 \[Pi]^3 (kr^2+4 \[Pi]^2)^3))(-3 kr^7-
28 kr^5 \[Pi]^2+112 kr^2 \[Pi]^4+192 \[Pi]^6+4 kr \[Pi]^(5/2)
(5 kr^2+4 \[Pi]^2) MeijerG[{{1/2,1},{}},{{-(1/2),1/2,1},{0}},
-((I kr)/2),1/2]+4 kr \[Pi]^(5/2) (5 kr^2+4 \[Pi]^2)
MeijerG[{{1/2,1},{}},{{-(1/2),1/2,1},{0}},(I kr)/2,1/2]+
8 kr^3 \[Pi]^(5/2) MeijerG[{{1/2,1},{}},{{-(1/2),1,3/2},{0}},
-((I kr)/2),1/2]+32 kr \[Pi]^(9/2) MeijerG[{{1/2,1},{}},
{{-(1/2),1,3/2},{0}},-((I kr)/2),1/2]+8 kr^3 \[Pi]^(5/2)
MeijerG[{{1/2,1},{}},{{-(1/2),1,3/2},{0}},(I kr)/2,1/2]+
32 kr \[Pi]^(9/2) MeijerG[{{1/2,1},{}},{{-(1/2),1,3/2},{0}},(I kr)/2,1/2])
--------------------------------------

But something does not seem to be right. Can't evaluate any of
the MeijerG functions in the result for any kr value. For
example

N[MeijerG[{{1/2, 1}, {}}, {{-(1/2), 1/2, 1}, {0}}, -((I kr)/2), 1/
2] /. kr -> 0]

gives error

MeijerG::hdiv: MeijerG[{{0.5,1.},{}},{{-0.5,0.5,1.},{0.}},0.,0.5]
does not exist. Arguments are not consistent. >>


--Nasser





Brambilla Roberto Luigi (RSE)

ungelesen,
11.06.2013, 02:24:4211.06.13
an
I have for semplicity rewritten your integral as

f[x_,a_]:= Sqrt[2]Sin[x/2]/(x(x^2+a^2)(x+2Pi)(x-2Pi))
(*this function is NOT singular in 0,2Pi,-2Pi*)



The numerical integration is readily obtained

kr=0.09;

int1=2 NIntegrate[f[kz,kr]^2,{kz,0,Infinity}]
(*the integrand is even*)

0.691084



Also the indefinite integral is obtained in a couple of minutes (ver.8)

int2=Integrate[f[kz,kr]^2,{kz,0,Infinity}]=....

The result is a long expression that can be rewritten as

foo1[x_,y_]:=Im[MejerG[{{1,1,3/2},{}},{{1,1,3/2},{0,1/2}},x,y]]

foo2[x_,y_]:=Im[MejerG[{{1,1,3/2},{}},{{1,3/2,2},{0,1/2}},x,y]]

A=3 kr^7+28 kr^5 Pi2+

+16 Pi^5/2(5 kr^2+4Pi^2)*foo1[I kr/2,1/2]+

+32Pi^5/2(kr^2+4Pi^2)*foo2[I kr/2,1/2]

249.281

B=32 kr^5 Pi^3 (kr^2+4PI^2)

360.71

int2=A/B

0.691084

Bye Roberto






RSE SpA ha adottato il Modello Organizzativo ai sensi del D.Lgs.231/2001, inforza del quale l'assunzione di obbligazioni da parte della Societ=E0 avviene con firma di un procuratore, munito di idonei poteri.
RSE adopts a Compliance Programme under the Italian Law (D.Lgs.231/2001). According to this RSE Compliance Programme, any commitment of RSE is taken by the signature of one Representative granted by a proper Power of Attorney. Le informazioni contenute in questo messaggio di posta elettronica sono riservate e confidenziali e ne e' vietata la diffusione in qualsiasi modo o forma. Qualora Lei non fosse la persona destinataria del presente messaggio, Lainvitiamo a non diffonderlo e ad eliminarlo, dandone gentilmente comunicazione al mittente. The information included in this e-mail and any attachments are confidential and may also be privileged. If you are not the correct recipient, you are kindly requested to notify the sender immediately, to cancel it and not to disclose the contents to any other person.

Andrzej Kozlowski

ungelesen,
11.06.2013, 02:23:4111.06.13
an
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 <djm...@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
> djm...@comcast.net
> http://home.comcast.net/~djmpark/index.html
>
>
>
> From: dsmir...@gmail.com [mailto:dsmir...@gmail.com]
>
>

Dr. Wolfgang Hintze

ungelesen,
13.06.2013, 02:32:1613.06.13
an
On 11 Jun., 08:23, Andrzej Kozlowski <akozlow...@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...@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...@comcast.net
> >http://home.comcast.net/~djmpark/index.html
>
> > From: dsmirno...@gmail.com [mailto:dsmirno...@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.

I have found a rather simple exact expression for the the integral in
question

in = -((-1 + Cos[z])/(z^2 (r^2 + z^2)^2 (z^2 - 4 \[Pi]^2)^2))
ix = Integrate[in, {z, -Infinity, Infinity}, Assumptions -> r > 0]

= (32*Pi^4*(r^2 + 4*(r^4*(4 + r) + Pi^2*(1 + 4*r^3))) -
E^r*(-3*r^7 + 12*r^9 + 32*Pi^2*r^5*(-1 + 5*r^2) +
128*Pi^6*(1 - r + 4*r^3) +
16*Pi^4*r^2*(2 + r*(-7 + 4*r*(8 + 9*r)))))/(E^
r*(64*r^5*(4*Pi^3 + Pi*r^2)^3))

which only contains elementary functions (no cumbersome and error-
prone MeierG).

Derivation
~~~~~~~~
My starting point was Andrzej's observation that a simplified version
of the integrand is easily integrable:
Indeed, let

in2 = -((-1 + Cos[z])/(z^2 (z^2 - 4 \[Pi]^2)^2));

then

Integrate[in2, {z, -Infinity, Infinity}, Assumptions -> r > 0]
3/(32*Pi^3)

Now we decompose the term which completes the integrand,

ir = 1/(r^2 + z^2)^2;

into partial fractions:

ir1 = 1/((I*r + z)^2*((-I)*r + z)^2);
Simplify[ir == ir1]
True

Apart[ir1];
ip = List @@ %
{-(1/(4*r^2*((-I)*r + z)^2)), -(I/(4* r^3*((-I)*r + z))), -(1/
(4*r^2*(I*r + z)^2)), I/(4*r^3*(I*r + z))}

Integrating directly a term involving a quadratic denominator leads to
the "unpleasant" MeierG-functions we would like to avoid.

But we can get rid of the second power by diferentiating (like 1/x' =
-1/x^2) as follows

g = 1/((-I)*r + z);
ip[[1]] == (I/(4*r^2))*D[g, r]
True

Hence we need to calculate just one integral (which takes 77 seconds
on my PC)

ig = Integrate[in2*g, {z, -Infinity, Infinity}, Assumptions -> r > 0]
(I*(20*Pi^2*r^3 + 3*r^5 + 32*Pi^4*(-1 + E^(-r) + r)))/(32*
Pi^3*(4*Pi^2*r + r^3)^2)

Now the sums of the first and the third term of ip leads to

ix0 = Simplify[(I/(4*r^2))*D[ig*4*r^2, r] - (I/(4*r^3))*ig]

(- 16*Pi^4*r^2*(-2*(1 + 16*r^2 + 4*r^3) +
E^r*(2 - 7*r + 32*r^2 + 36*r^3)))/(E^ r*(128*Pi^3*r^5*(4*Pi^2 +
r^2)^3))

Because this quantity is real the final result is twice this
expression (ix = 2 ix0).
End of derivation.

The idea is clear, but I'm not sure that no handling error has crept
in. So please check my result.

BTW the function ix(r) reminds me of some potential between two
particles ...

Regards,
Wolfgang

Dr. Wolfgang Hintze

ungelesen,
13.06.2013, 02:33:5713.06.13
an
On 11 Jun., 08:23, Andrzej Kozlowski <akozlow...@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...@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...@comcast.net
> >http://home.comcast.net/~djmpark/index.html
>
> > From: dsmirno...@gmail.com [mailto:dsmirno...@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

Andrzej Kozlowski

ungelesen,
14.06.2013, 04:48:1614.06.13
an
Very nice.

By the way, this method (differentiating with respect to a parameter)
was often used by the physicist Richard Feynman. In fact, he once made a
bet (see Needham's book "Visual Complex Analysis") that he could use
this method so solve any integral that other people can do by contour
integration. He lost his bet but this seems to be an example of a
situation where contour integration does not work (or at least I can't
see how to make it work). In fact, I myself thought about using
Feynman's method to obtain an elementary expression for this integral,
but I forgot to use partial fractions first, so never got anywhere.

However, I doubt that this is how the "other program" does it. I would
be interested in seeing what expression the "other program" gives for
the indefinite integral. In my opinion, one of the weaknesses of
Mathematica's integration is that it does not allow one to choose the
method of indefinite integration. Mathematica has an implementation of
the Risch algorithm (which always returns an indefinite integral in
terms of elementary functions, if such an answer exists) but it often
returns answers in terms of special functions. If properly implemented
these can have advantages over "elementary" solutions, but the fact that
Mathematica does not allow us to choose which method to use means that
we can't tell if an elementary antiderivative exists or not. This is
also the situation in this case. So, concerning how the "other program"
gets the answer, there seem to be two most likely possibilities. One is
that it also computes a primitive function (indefinite integral) in
terms of special functions (MeierG?) but gets the limits right. The
other possibility is that it uses the Risch algorithm to get an
elementary anti-derivative.

Andrzej Kozlowski

Brambilla Roberto Luigi (RSE)

ungelesen,
14.06.2013, 04:48:3614.06.13
an
Using Mathematica 5.1 or 8 I obtained:

in = -((-1 + Cos[z])/(z^2 (r^2 + z^2)^2 (z^2 - 4 =A6=D0^2)^2));

*numerically*
r = 0.1;
NIntegrate[in, {z, -Infinity, Infinity}]
0.50377

*analytically*
f1[x_] := MeijerG[{{1, 1,3/2},{}},{{1, 1, 3/2}, {0, 1/2}}, x, 1/2]
f2[x_] := MeijerG[{{1, 1,3/2},{}},{{1, 3/2, 2}, {0, 1/2}}, x, 1/2]

A = (3r^7+28r^5Pi^2) + 16Pi^(5/2) (5r^2+4Pi^2) f1[ I r/2] + 32Pi^(5/2) (r^2+4Pi^2) f2[ I r/2];

B = 32r^5Pi^3 (r^2+4Pi^2);

Im[A/B]

0.50377

Why to hate Meijer functions with parameter 1/2?

Roberto Brambilla


-----Messaggio originale-----
Da: Dr. Wolfgang Hintze [mailto:w...@snafu.de]
Inviato: gioved=A8=AC 13 giugno 2013 8.39
A: math...@smc.vnet.net
Oggetto: Re: Calculating a simple integral
RSE SpA ha adottato il Modello Organizzativo ai sensi del D.Lgs.231/2001, in=
forza del quale l'assunzione di obbligazioni da parte della Societ=A8=A4 av=
viene con firma di un procuratore, munito di idonei poteri.
RSE adopts a Compliance Programme under the Italian Law (D.Lgs.231/2001). Ac=
cording to this RSE Compliance Programme, any commitment of RSE is taken by=
the signature of one Representative granted by a proper Power of Attorney.=
Le informazioni contenute in questo messaggio di posta elettronica sono ris=
ervate e confidenziali e ne e' vietata la diffusione in qualsiasi modo o for=
ma. Qualora Lei non fosse la persona destinataria del presente messaggio, La=
invitiamo a non diffonderlo e ad eliminarlo, dandone gentilmente comunicazi=
one al mittente. The information included in this e-mail and any attachments=
are confidential and may also be privileged. If you are not the correct rec=
ipient, you are kindly requested to notify the sender immediately, to cancel=

Dr. Wolfgang Hintze

ungelesen,
14.06.2013, 04:50:1714.06.13
an
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

0 neue Nachrichten