Code covered by the BSD License  

Highlights from
BINOMIAL (Binomial coefficient.)

4.2

4.2 | 5 ratings Rate this file 23 Downloads (last 30 days) File Size: 1.65 KB File ID: #5966

BINOMIAL (Binomial coefficient.)

by Mukhtar Ullah

 

01 Oct 2004 (Updated 20 Oct 2010)

Binomial coefficient of arrays

| Watch this File

File Information
Description

BINOMIAL Binomial coefficient.

If the arguments are both non-negative integers with 0 <= K <= N, then
BINOMIAL(N, K) = N!/K!/(N-K)!, which is the number of distinct sets of
K objects that can be chosen from N distinct objects.
When N or K(or both) are N-D matrices, BINOMIAL(N, K) is the coefficient
for each pair of elements.

If N and K are integers that do not satisfy 0 <= K <= N, or N and K are
non-integers , then the general definition is used, that is

      BINOMIAL(N, K) = GAMMA(N+1) / (GAMMA(K+1) / GAMMA(N-K+1))

If N is a non-negative integer, BINOMIAL(N) = BINOMIAL(N, 0:N)

BINOMIAL only supports floating point input arguments.

MATLAB release MATLAB 7.11 (2010b)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (10)
06 Oct 2004 Pink Panzer

Where's the difference to nchoosek?

07 Oct 2004 Mukhtar Ullah

nchoosek can only deal with scalars!

28 Oct 2005 Terry Iverson

Great! Thanks.

20 Nov 2005 James Brown

Very fast implementation. Roughly double as fast than using factorial from Matlab for the implementation!

22 Aug 2006 luc mercier

Remedies a clear lack in matlab built-in functions. Very handy!

28 Aug 2006 O Demands

I was laughing out loud when I got the error mesage: ??? Undefined function or variable 'isfloat'. Only the most incompetent programmer would put in requirements of that type in a trivial function file like this.

12 Apr 2007 Memming Park

what's the difference from MATLAB's built-in nchoosek? (type "open nchoosek" and you can see the source code)

10 May 2007 Mukhtar Ullah

nchoosek is for scalars only.

24 Aug 2011 Thomas Gladwin  
18 Jan 2012 Jianxiao

great,thanks

Please login to add a comment or rating.
Updates
05 Oct 2004

removed a warning that was not needed

05 Oct 2004

generalised to allow arguments not satisfying 0<=k<=n

05 Oct 2004

now supports both single and double data types.

05 Oct 2004

A logical test removed that was no needed

06 Oct 2004

Help documentation improved

07 Oct 2004

Description updated

29 Oct 2004

made flexible for single argument

01 Nov 2004

renamed to binomial

17 Jan 2005

a minor improvement

20 Oct 2010

Code cleanup.

Tag Activity for this File
Tag Applied By Date/Time
binomial coefficient Mukhtar Ullah 22 Oct 2008 07:32:25
combinations Mukhtar Ullah 22 Oct 2008 07:32:25
mathematics Mukhtar Ullah 22 Oct 2008 07:32:25
arrays Mukhtar Ullah 22 Oct 2008 07:32:25
binomial coefficient salman 24 Jan 2012 13:31:50

Contact us at files@mathworks.com