MathGroup Archive 2002

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

Search the Archive

RE: A Bug?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg35322] RE: [mg35277] A Bug?
  • From: "DrBob" <majort at cox-internet.com>
  • Date: Mon, 8 Jul 2002 03:17:26 -0400 (EDT)
  • Reply-to: <drbob at bigfoot.com>
  • Sender: owner-wri-mathgroup at wolfram.com

There's a bug, but not the one you think.

"Indeterminate" is the right answer to your problem, because for F[x]==1
and i==n, we have the term

Binomial[n, n] 1^n (1 - 1)^(n - n)

This involves 0^0, which is Indeterminate.  Contrast this with what
happens when you use SetDelayed rather than Set:

Clear[F, oStatCDF]
oStatCDF[x_, r_, n_, F_] :=
   Sum[Binomial[n, i] F[x]^i (1 - F[x])^(n - i), {i, r, n}]
F[x_] := 1
oStatCDF[x, r, n, F]

0

THAT is a bug.

Bobby

-----Original Message-----
From: Johannes Ludsteck
To: mathgroup at smc.vnet.net
[mailto:johannes.ludsteck at wiwi.uni-regensburg.de] 
Subject: [mg35322] [mg35277] A Bug?

Dear MathGroup members,

let Mathematica evaluate
In[1]:= oStatCDF[x_,r_,n_,F_]=
  Sum[Binomial[n,i] F[x]^i (1-F[x])^(n-i), {i,r,n}]

Out[1]= (1 - F[x])^(n - r) F[x]^r Gamma[1 + n]
			Hypergeometric2F1[1,-n + r, 1 + r,
				-F[x]/(1 - F[x])]/
			(Gamma[1 + n - r] Gamma[1 + r])

Looks fine, but now define
In[2]:= F[x_]:=1
and substitute this into oStatCDF
In[3]:= oStatCDF[x,r,n,F]
Out[3]= Indeterminate

This does not look fine, since I would expect a more
determinate result. Now try to help Mathematica by
substituting F[x_]=1 by hand. Then
F[x]^i (1-F[x])^(n-i) simplifies to 1^i 0^(n-i) == 1

In[4]:= simp[r_,n_]=Sum[Binomial[n,i] ,{i,r,n}]
Out[4]= (Gamma[1+n] Hypergeometric2F1[1,-n+r,1+r,-1])
		/ (Gamma[1+n-r] Gamma[1+r])

Now apply simp to r = 5 and n = 100 to obtain
In[5]:= simp[5,10]
Out[5]= 638

Of course, 638 != Indeterminate

Is this a Bug or did I make a mistake?

Best regards,
	Johannes Ludsteck

<><><><><><><><><><><><>
Johannes Ludsteck
Economics Department
University of Regensburg
Universitaetsstrasse 31
93053 Regensburg
Phone +49/0941/943-2741





  • Prev by Date: Re: A Bug?
  • Next by Date: Re: AppendTo VERY slow
  • Previous by thread: Re: A Bug?
  • Next by thread: Quantile function