3.66667

3.7 | 3 ratings Rate this file 62 downloads (last 30 days) File Size: 1.5 KB File ID: #5966

BINOMIAL (Binomial coefficient.)

by Mukhtar Ullah

 

01 Oct 2004 (Updated 17 Jan 2005)

No BSD License  

Binomial coefficient of arrays

Download Now | 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 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
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.

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

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
arrays Mukhtar Ullah 22 Oct 2008 07:32:25
mathematics Mukhtar Ullah 22 Oct 2008 07:32:25
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com