MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Calculate n in binomial distribution

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101638] Re: Calculate n in binomial distribution
  • From: Ray Koopman <koopman at sfu.ca>
  • Date: Sun, 12 Jul 2009 05:49:42 -0400 (EDT)
  • References: <h229dp$i0v$1@smc.vnet.net> <h27fe4$cmb$1@smc.vnet.net>

Further to my previous post, here is a better binomsearch:

  binomsearch2[p_,k_,test_] := Module[{lo = k, mid, hi = k+1, c},
  While[cf[hi,p,k] > test, lo = hi; hi *= 2];
  While[lo <= hi,
    If[(c = cf[mid = Quotient[lo+hi,2],p,k]) === test, Return[mid]];
    If[c < test, hi = mid - 1, lo = mid + 1]];
  lo]


  • Prev by Date: Re: Symbolic summation
  • Next by Date: Re: binomial expansion of quantity raised to power of 1/2
  • Previous by thread: Re: Calculate n in binomial distribution
  • Next by thread: Re: Calculate n in binomial distribution