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

조회 수: 57 (최근 30일)
what is the MATLAB function to evaluate ncr value when n is real
  댓글 수: 6
PJS KUMAR
PJS KUMAR 2018년 8월 25일
expecting result for instances like nCr(0.5,2) , nCr(-3,2)
Walter Roberson
Walter Roberson 2018년 8월 25일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Kaushik Lakshminarasimhan
Kaushik Lakshminarasimhan 2018년 8월 25일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simulation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by