%% Compute Beta Function for Integer Arguments
% Compute the beta function for integer arguments w = 3 and z = 1, ..., 10. Based on the definition, the beta function can be calculated as
% B\left(z,3\right)=\frac{\Gamma \left(z\right)\Gamma \left(3\right)}{\Gamma \left(z+3\right)}=\frac{\left(z-1\right)!\;2!}{\left(z+2\right)!}=\frac{2}{z\left(z+1\right)\left(z+2\right)}.
% Set the output format to rational to show the results as ratios of integers.

format rat
B = beta((1:10)',3)

%
% Copyright 2019 The MathWorks, Inc.