Group Abstract Group Abstract

Message Boards Message Boards

NIntergrate for values very close to zero?

Posted 9 years ago
POSTED BY: Niall Hughes
3 Replies
Posted 9 years ago

thanks a lot to both of you. The first one seems to work but takes quite a while. I'm had pretty good success so far with the second approach.

cheers.

POSTED BY: Niall Hughes

I also favour the analytical/exact solution, but this might work, too, and evaluates practically instantaneously.

t = 0.8 - (x/4000); 
p = Binomial[10000, 5000] t^5000 (1 - t)^(5000); 
intp = NIntegrate[p, {x, 0, 1}, WorkingPrecision -> 10]; 
b = p/intp; Plot[{b}, {x, 0, 1}, PlotLegends -> Automatic]

enter image description here

Note that

NIntegrate[b, {x, 0, 1}]

gives 1.

Cheers,

Marco

POSTED BY: Marco Thiel

This is a case where you can find the exact value for the integral, if you are willing to wait a few minutes:

t = 8/10 - (x/4000);
p = Binomial[10000, 5000] t^5000 (1 - t)^5000;
intp = Integrate[Expand[p], {x, 0, 1}];
intp // N
Plot[p/intp, {x, 0, 1}]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard