beta

Calling Sequence

Arguments

x, y

2 positive real scalars, vectors or matricesof equal sizes.

z

a real or a matrix of the same size than x
with z(i,j) = beta(x(i,j),y(i,j)).

Description

Computes the complete beta function :

For small x and y (x+y≤2 elementwise),
the algorithm uses the expression in function of the gamma function, else it
applies the exponential function onto the result of the
betaln function provided with the DCDFLIB: Library of
Fortran Routines for Cumulative Distribution Functions, Inverses, and
Other Parameter (see cdfbet for more
information about DCDFLIB).

Examples

// example 2 : an error study based on the relation B(1,x) = 1/x// (computing 1/x must lead to only a relative error of eps_m, so// it may be used near as a reference to evaluate the error in B(1,x))x=logspace(-8,8,20000)';e=beta(ones(x),x)-(1)./x;er=abs(e).*x;ind=find(er~=0);eps=ones(x(ind))*number_properties("eps");clf()plot2d(x(ind),[er(ind)eps2*eps],style=[123],logflag="ll",leg="er@eps_m@2 eps_m")xtitle("approximate relative error in computing beta(1,x)")show_window()