I have an integral in this form:

NIntegrate[ (5184(-11 + k(98 + k(-16 + k(-40 + k(17 + 2k(7 + k)))))))/

((1 + E^((1/2)(-1 + k)))(1 + k)^3(-7 + k*(2 + k))^3), {k, 0, Infinity}]

when I set , MaxRecursion to 12 answer is of the order of 10^11 when set to 30 answer is of order 10^25 when set 40 order is 10^28 when set to 100 and above order is 10^34 and is constant up to 400 but I have an error in answer.

How should I proceed to get the correct result?

=================

Hi, welcome to Mathematica.SE, please consider taking the tour so you learn the basics of the site. Once you gain enough reputation by making good questions you will be able to vote up and down both questions and answers. When you see good ones, please vote them up by clicking the grey triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. As you receive help, try to give it too, by answering questions in your area of expertise.

– rhermans

Nov 26 ’14 at 12:00

You get “an error” that actually contains information “Integrate failed to converge to prescribed accuracy after 100 recursive bisections”.

– rhermans

Nov 26 ’14 at 12:14

yes rhermans this is my integral error.

– Ehsan F

Nov 26 ’14 at 12:16

1

The function diverges at (22–√−1)(2 \sqrt{2}-1), and it looks like the integral also diverges, the answer then is Infinity

– rhermans

Nov 26 ’14 at 12:29

=================

2 Answers

2

=================

There are too many singularities in your integrand (according to Reduce there are infinity of them, but these are complex valued) and then there are 3 real valued poles {-1., -3.82843, 1.82843} (I did not check for zero/pole cancellations). So the only real pole in the range of the integration is 1.82843 or -1 + 2 Sqrt[2]

integrand = 5184 ((-11 + k (98 + k (-16 + k (-40 + k (17 + 2 k (7 + k))))))/

((1 + E^(1/2 (-1 + k))) (1 + k)^3 (-7 + k (2 + k))^3));

poles = Reduce[Denominator[integrand] == 0, k]

So trying to integrate this is a losing battle. But you can get little better numbers if you exclude the -1 + 2 Sqrt[2] and increase WorkingPrecision. At least the order of the numerical result does not change as much.

NIntegrate[integrand, {k, 0, Infinity}, Method -> PrincipalValue,

Exclusions -> -1 + 2 Sqrt[2], MaxRecursion -> 12, WorkingPrecision -> 100]

With MaxRecursion -> 30

With MaxRecursion -> 40

With MaxRecursion -> 100

btw, Integrate says also it does not converge:

Integrate[integrand, {k, 0, Infinity}]

So may be you need to change the integrand?

The consistent behavior displayed by the OP’s integral — increase recursion, increase the magnitude of the integral — normally is the result of a divergent integral. It’s possible the OP seeks the principal value of the integral. There is one pole of order 3 in the interval of integration

f = (5184 (-11 + k (98 + k (-16 + k (-40 + k (17 + 2 k (7 + k))))))) /

((1 + E^((1/2) (-1 + k))) (1 + k)^3 (-7 + k*(2 + k))^3);

Solve[Denominator[f] == 0 && k > 0, k, Reals]

pole = k /. First[%];

(* {{k -> -1 + 2 Sqrt[2]}, {k -> -1 + 2 Sqrt[2]}, {k -> -1 + 2 Sqrt[2]}} *)

Since the order is odd there is some hope that the principal value exists. But it does not exist since the series expansion shows that the term of degree -2 does not vanish:

N@Series[f, {k, pole, 0}]

If one is interested in further confirmation, subtract out the divergent term and see whether the integral converges:

coeff = SeriesCoefficient[f, {k, pole, -2}];

NIntegrate[f – coeff/(k – pole)^2, {k, 0, pole, Infinity}, Method -> “PrincipalValue”]

(* -277.122 *)