       Re: Re: Calculate n in binomial distribution

• To: mathgroup at smc.vnet.net
• Subject: [mg101601] Re: [mg101581] Re: Calculate n in binomial distribution
• From: Bob Hanlon <hanlonr at cox.net>
• Date: Fri, 10 Jul 2009 23:23:28 -0400 (EDT)

```As a general rule, never mix exact and inexact and expect exact results

Minimize[Rationalize[(x - 6.1)^2], x, Integers]

{1/100, {x -> 6}}

Minimize[Rationalize[(x - 6.)^2], x, Integers]

{0, {x -> 6}}

Bob Hanlon

---- dh <dh at metrohm.com> wrote:

=============

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: Symbolic summation
• Next by Date: Re: Re: Polynomial rewriting question
• Previous by thread: Re: Calculate n in binomial distribution
• Next by thread: Re: Calculate n in binomial distribution