> bin.coef<-function(n,k) gamma(n+1)/(gamma(k+1)*gamma(n-k+1))
> bin.coef(5,2)
[1] 10
> bin.coef(50,30)
[1] 4.712921e+13
But better would be:
> bin.coef<-function(n,k) exp(lgamma(n+1)-lgamma(k+1)-lgamma(n-k+1))
> bin.coef(5,2)
[1] 10
> bin.coef(50,30)
[1] 4.712921e+13
in this case it can handle larger n
Steve Bousquin wrote:
>
> I was talking about the notation for binomial coefficients (C(n,k))where
> n is over k and they are in parentheses. That part of the question was
> supposed to ask whether a function existed that would let one enter n
> and k and get (n!/k!(n-k)!).
>
> Steve Bousquin wrote:
> >
> > I can't seem to find an operator in the manuals for calculating
> > factorials. I mean !, not experiments. Also, is there a way to work
> > with the over-under type of notation?
> >
> > Steve Bousquin
>
> --
>
> ==============================================
> Steve Bousquin
>
> Colorado State University
> Department of Rangeland Ecosystem Science/GDPE
> NR209
> Fort Collins, CO 80523
> USA
>
> sbous@lamar.colostate.edu
> ==============================================
> -----------------------------------------------------------------------
> This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
> send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
> message: unsubscribe s-news
-- Vadim Kutsyy kutsyy@umich.edu http://www.stat.lsa.umich.edu/~kutsyy ----------------------------------------------------------------------- This message was distributed by s-news@wubios.wustl.edu. To unsubscribe send e-mail to s-news-request@wubios.wustl.edu with the BODY of the message: unsubscribe s-news