what is the MATLAB function to evaluate ncr value when n is real

57 Ansichten (letzte 30 Tage)
what is the MATLAB function to evaluate ncr value when n is real
  6 Kommentare
PJS KUMAR
PJS KUMAR am 25 Aug. 2018
expecting result for instances like nCr(0.5,2) , nCr(-3,2)
Walter Roberson
Walter Roberson am 25 Aug. 2018
What numeric values do you expect for the cases nCr(0.5,2) and nCr(-3,2) ? Number of combinations is only defined for positive integers.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Kaushik Lakshminarasimhan
Kaushik Lakshminarasimhan am 25 Aug. 2018
If n and r are both non-negative integers, and n >= r, use:
nCr = nchoosek(n,r)
If n and/or r can be negative, you can use the more general form:
nCr = gamma(n+1)/(gamma(r+1)*gamma((n-r)+1))
If either n or r is an integer <= -1, then the nCr is not defined.

Weitere Antworten (0)

Kategorien

Mehr zu Simulation finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by