       Re: Calculate n in binomial distribution

• To: mathgroup at smc.vnet.net
• Subject: [mg101581] Re: Calculate n in binomial distribution
• From: dh <dh at metrohm.com>
• Date: Fri, 10 Jul 2009 06:48:30 -0400 (EDT)
• References: <h229dp\$i0v\$1@smc.vnet.net>

```
Hi Peter,

I think there is a bug in Minimize for the Integer domain. Consider:

Minimize[(x - 6.1)^2, x, Integers]  giving: {1.21, {x -> 5}}

Minimize[(x - 6.)^2, x, Integers]   giving: {1., {x -> 5}}

Minimize[(x - 6)^2, x, Integers]    giving: {0, {x -> 6}}

Minimize seems to have problems mixing integers and reals. I think you

should report this to Wolfram.

Daniel

Peter Breitfeld wrote:

> Suppose I have the following distribution:

>

> cf[n_,p_,k_]=CDF[BinomialDistribution[n,p],k]

>

> Now I want to calculate n so that the biggest n such that e.g.

>

> cf[n,0.2,7]<0.3

>

>

> ListPlot[Abs[cf[#,0.2,7]-0.3]&/@Range], where I see, that a value of

> about n=46 gives an approximation nearest to 0.3

>

> To get this value of n I tried

>

> Minimize[{Abs[cf[n,0.2,7]-0.3],n>7},n,Integers]

>

> Out:  {0.699765, {n->11}}

>

> which is obviously wrong.

>

> Why?

>

> Is it, because Abs isn't differentiable at the peak?

>

> I tried other ways too, like Reduce NMinimize, FindMinimum, but no success.

>

```

• Prev by Date: Re: matrix equation
• Next by Date: Jens
• Previous by thread: fractal_teardrops.gif (GIF Image, 658x1009 pixels) - Scaled (90%)
• Next by thread: Re: Re: Calculate n in binomial distribution