function [ n_data, x, y, fxy ] = beta_values ( n_data ) %% BETA_VALUES returns some values of the Beta function. % % Discussion: % % Beta(X,Y) = ( Gamma(X) * Gamma(Y) ) / Gamma(X+Y) % % Both X and Y must be greater than 0. % % In Mathematica, the function can be evaluated by: % % Beta[X,Y] % % Properties: % % Beta(X,Y) = Beta(Y,X). % Beta(X,Y) = Integral ( 0 <= T <= 1 ) T**(X-1) (1-T)**(Y-1) dT. % Beta(X,Y) = Gamma(X) * Gamma(Y) / Gamma(X+Y) % % Modified: % % 13 August 2004 % % Author: % % John Burkardt % % Reference: % % Milton Abramowitz and Irene Stegun, % Handbook of Mathematical Functions, % US Department of Commerce, 1964. % % Stephen Wolfram, % The Mathematica Book, % Fourth Edition, % Wolfram Media / Cambridge University Press, 1999. % % Parameters: % % Input/output, integer N_DATA. The user sets N_DATA to 0 before the % first call. On each call, the routine increments N_DATA by 1, and % returns the corresponding data; when there is no more data, the % output value of N_DATA will be 0 again. % % Output, real X, Y, the arguments of the function. % % Output, real FXY, the value of the function. % n_max = 17; b_vec = [ ... 0.5000000000000000E+01, ... 0.2500000000000000E+01, ... 0.1666666666666667E+01, ... 0.1250000000000000E+01, ... 0.5000000000000000E+01, ... 0.2500000000000000E+01, ... 0.1000000000000000E+01, ... 0.1666666666666667E+00, ... 0.3333333333333333E-01, ... 0.7142857142857143E-02, ... 0.1587301587301587E-02, ... 0.2380952380952381E-01, ... 0.5952380952380952E-02, ... 0.1984126984126984E-02, ... 0.7936507936507937E-03, ... 0.3607503607503608E-03, ... 0.8325008325008325E-04 ]; x_vec = [ ... 0.2E+00, ... 0.4E+00, ... 0.6E+00, ... 0.8E+00, ... 1.0E+00, ... 1.0E+00, ... 1.0E+00, ... 2.0E+00, ... 3.0E+00, ... 4.0E+00, ... 5.0E+00, ... 6.0E+00, ... 6.0E+00, ... 6.0E+00, ... 6.0E+00, ... 6.0E+00, ... 7.0E+00 ]; y_vec = [ ... 1.0E+00, ... 1.0E+00, ... 1.0E+00, ... 1.0E+00, ... 0.2E+00, ... 0.4E+00, ... 1.0E+00, ... 2.0E+00, ... 3.0E+00, ... 4.0E+00, ... 5.0E+00, ... 2.0E+00, ... 3.0E+00, ... 4.0E+00, ... 5.0E+00, ... 6.0E+00, ... 7.0E+00 ]; if ( n_data < 0 ) n_data = 0; end n_data = n_data + 1; if ( n_max < n_data ) n_data = 0; x = 0.0; y = 0.0; fxy = 0.0; else x = x_vec(n_data); y = y_vec(n_data); fxy = b_vec(n_data); end