1
$\begingroup$

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

$\endgroup$
  • 2
    $\begingroup$ Aren't you forgetting to square the first lambda_R in when you do the definite integral? $\endgroup$ – S.S. Feb 21 '17 at 12:20
  • $\begingroup$ @S.S. Yes, you are correct. I fixed it and they are still different. $\endgroup$ – PiE Feb 21 '17 at 13:49
  • $\begingroup$ @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. $\endgroup$ – MarcoB Feb 21 '17 at 14:55
  • $\begingroup$ @MarcoB you're right, slipped an error in formatting. $\endgroup$ – Feyre Feb 21 '17 at 15:24
  • $\begingroup$ 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. $\endgroup$ – Dimitris Feb 21 '17 at 15:48
2
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ @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/… $\endgroup$ – Dimitris Feb 22 '17 at 10:47
  • $\begingroup$ @MarcoB Thanks for the edit. $\endgroup$ – Dimitris Feb 22 '17 at 10:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.