📄 binomial.m
字号:
function b = binomial(m,n)% BINOMIAL -- binomial coefficient% % b = binomial(m,n)% % Calculates the binomial coefficient%% (m) m!% (n) = ---------% n! (m-n)!% % m and n can be vectors or matrices, as long as one of them is a% scalar, or they are both the same size.%% Examples:% (5) (6) (7)% binomial([5,6,7],2) = [(2),(2),(2)]%% (5) (5) (5) % binomial(5,[1,2,3]) = [(1),(2),(3)]%% (5) (6) (7) % binomial([5,6,7],[1,2,3]) = [(1),(2),(3)]% Copyright (c) 2004 by Fritz Keinert (keinert@iastate.edu),% Dept. of Mathematics, Iowa State University, Ames, IA 50011.% This software may be freely used and distributed for non-commercial% purposes, provided this copyright statement is preserved, and% appropriate credit for its use is given.%% Last update: Feb 20, 2004b = factorial(m) ./ (factorial(n) .* factorial(m-n));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -