A basic combinatorial prob problem, which you will no doubt recognize, would
have a solution: 1 - (1 - p)^n Any suggestion to calculate this, when n -> 10^5 ? Best I can think of is clip (n*p, -nan, 1) _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
Assuming 0 <= p <= 1, I don't see the problem there. --
Barbier de Reuille Pierre On 13 February 2013 13:05, Neal Becker <[hidden email]> wrote: A basic combinatorial prob problem, which you will no doubt recognize, would _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
Pierre Barbier de Reuille wrote:
> Assuming 0 <= p <= 1, I don't see the problem there. > I had just assumed there'd be numerical accuracy issues, but maybe not. _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
On Wed, Feb 13, 2013 at 8:34 AM, Neal Becker <[hidden email]> wrote:
> Pierre Barbier de Reuille wrote: > >> Assuming 0 <= p <= 1, I don't see the problem there. >> > > I had just assumed there'd be numerical accuracy issues, but maybe not. Any numerical problems that you might have with the power gets swamped because you can only get within floating point precision of 1. If the results were zero, then there are special function to get better precision for tiny numbers. AFAICS. Josef > > _______________________________________________ > SciPy-User mailing list > [hidden email] > http://mail.scipy.org/mailman/listinfo/scipy-user _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
[hidden email] wrote:
> On Wed, Feb 13, 2013 at 8:34 AM, Neal Becker <[hidden email]> wrote: >> Pierre Barbier de Reuille wrote: >> >>> Assuming 0 <= p <= 1, I don't see the problem there. >>> >> >> I had just assumed there'd be numerical accuracy issues, but maybe not. > > Any numerical problems that you might have with the power gets swamped > because you can only get within floating point precision of 1. > > If the results were zero, then there are special function to get > better precision for tiny numbers. > > AFAICS. > > Josef Here, 0 <= p < 10^-8 _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
Neal Becker wrote:
> [hidden email] wrote: > >> On Wed, Feb 13, 2013 at 8:34 AM, Neal Becker <[hidden email]> wrote: >>> Pierre Barbier de Reuille wrote: >>> >>>> Assuming 0 <= p <= 1, I don't see the problem there. >>>> >>> >>> I had just assumed there'd be numerical accuracy issues, but maybe not. >> >> Any numerical problems that you might have with the power gets swamped >> because you can only get within floating point precision of 1. >> >> If the results were zero, then there are special function to get >> better precision for tiny numbers. >> >> AFAICS. >> >> Josef > > Here, 0 <= p < 10^-8 _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
1 - exp(n*log(1.-p)) should do too. Taking logs is an easy way to handle this sort of problems. On 13 February 2013 14:45, Neal Becker <[hidden email]> wrote:
_______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
On Thu, Feb 14, 2013 at 1:31 PM, nicky van foreest <[hidden email]> wrote:
> 1 - exp(n*log(1.-p)) > > should do too. Taking logs is an easy way to handle this sort of problems. Possibly better depending on the values: -np.expm1(n * np.log(1-p)) You could use np.log1p(-p), but given the values of p, it doesn't appear to be worth it. > On 13 February 2013 14:45, Neal Becker <[hidden email]> wrote: >> >> Neal Becker wrote: >> >> > [hidden email] wrote: >> > >> >> On Wed, Feb 13, 2013 at 8:34 AM, Neal Becker <[hidden email]> >> >> wrote: >> >>> Pierre Barbier de Reuille wrote: >> >>> >> >>>> Assuming 0 <= p <= 1, I don't see the problem there. >> >>>> >> >>> >> >>> I had just assumed there'd be numerical accuracy issues, but maybe >> >>> not. >> >> >> >> Any numerical problems that you might have with the power gets swamped >> >> because you can only get within floating point precision of 1. >> >> >> >> If the results were zero, then there are special function to get >> >> better precision for tiny numbers. >> >> >> >> AFAICS. >> >> >> >> Josef >> > >> > Here, 0 <= p < 10^-8 >> Sorry, that should be 10^-8 < p < 1, so 1-p is between 0 and 1-10^-8 >> >> _______________________________________________ >> SciPy-User mailing list >> [hidden email] >> http://mail.scipy.org/mailman/listinfo/scipy-user > > > > _______________________________________________ > SciPy-User mailing list > [hidden email] > http://mail.scipy.org/mailman/listinfo/scipy-user > -- Robert Kern _______________________________________________ SciPy-User mailing list [hidden email] http://mail.scipy.org/mailman/listinfo/scipy-user |
Free forum by Nabble | Edit this page |