# Different Results from Integrate & NIntegrate

Strangely enough, I believe I am getting different results from Mathematica's Integrate and NIntegrate[] functions when they are evaluated at some point.

Here is the function I am integrating:

Integrate[-((E^(2 n x μ) (-1 +
Gamma[2,
n x μ]) (λR^2))/((λR^2 + (E^(n x μ) ((n \
μ - λR^2)))))^2) (n μ E^(-n x μ)), {x,
0, ∞}]


and here is the result from symbolic integration:

ConditionalExpression[(λR^2)/(n^2 μ^2 -
n μ (λR^2)), Re[n μ] > 0]


So, when I campare analytic result with one that is obtained numerically, I get

(λR^2)/(n^2 μ^2 - n μ (λR^2)) /. {n ->
1, μ -> 1.0, λR -> 0.99}


49.2513

And, when I integrate numerically, I get

NIntegrate[-((E^(2 n x μ) (-1 +
Gamma[2,
n x μ]) (λR^2))/((λR^2 + (E^(n x μ) ((n \
μ - λR^2)))))^2) (n μ E^(-n x μ)) /. {n ->
1, μ -> 1.0, λR -> 0.99}, {x, 0, ∞}]


40.8463 Am I missing something???

For the analytic result, on different platforms, are people getting a different result than mine?

Mathematica Version: 9.0.1.0, MS Windows 64bit

• Aren't you forgetting to square the first lambda_R in when you do the definite integral? – S.S. Feb 21 '17 at 12:20
• @S.S. Yes, you are correct. I fixed it and they are still different. – PiE Feb 21 '17 at 13:49
• @PierreMFiorini What is Enxμ in your expression? Should it be E^(n x μ)? Also, your symbolic integral doesn't really evaluate for me in a reasonable time. – MarcoB Feb 21 '17 at 14:55
• @MarcoB you're right, slipped an error in formatting. – Feyre Feb 21 '17 at 15:24
• If I substitute values for the parameters I got the same result for the symbolic and numerical integration. E.g. with {n -> 1, \[Mu] -> 1, \[Lambda]R -> 99/100} Integrate gives -((5000*(-58806 + 199*Pi^2 + 597*Log[9801/199]^2 + 1194*PolyLog[2, -(199/9801)]))/5851197) which is approximately 40.8463. – Dimitris Feb 21 '17 at 15:48

I guess this is a problem of version 9.0. In Mathematica 10 I get the correct result:

expr = -((E^(2 n x μ) (-1 +
Gamma[2, n x μ]) (λR^2))/((λR^2 + (E^(n x μ) ((n μ - λR^2)))))^2) (n μ E^(-n x μ));

Integrate[expr, {x, 0, Infinity}]

(* Out: ConditionalExpression[
1/(-λR^2 + n*μ) + PolyLog[2, λR^2/(λR^2 - n*μ)]/λR^2,
Re[n*μ] > 0] *)

% /. {n -> 1, μ -> 1., λR -> 0.99}
(* Out: 40.84631507906563 *)


Comparing with version 9 one notices the absence of PolyLog function.

• @PMF: You are welcome. With so many parameters, Mathematica manages to find the correct value. Another demonstration of its symbolic capabilities. I suggest that you include some assumptions in your parameters. May be in this way Mathematica 9 obtains the correct result. Another trick is given here mathematica.stackexchange.com/questions/65914/… – Dimitris Feb 22 '17 at 10:47
• @MarcoB Thanks for the edit. – Dimitris Feb 22 '17 at 10:50