The BETA routine returns the value of the Euler beta function B(Z, W). The Euler beta function is defined as:



This routine is written in the IDL language. Its source code can be found in the file in the lib subdirectory of the IDL distribution.


To evaluate the beta function at the point (1.0, 1.1) and print the result:

PRINT, BETA(1.0, 1.1)

IDL prints:


The exact solution is:

((1.00 * .95135077) / (1.10 * .95135077)) = 0.909091


Result = BETA( Z, W [, /DOUBLE] )

Return Value

If both arguments are scalar, the function returns a scalar. If both arguments are arrays, the function matches up the corresponding elements of Z and W, returning an array with the same dimensions as the smallest array. If one argument is a scalar and the other argument is an array, the function uses the scalar value with each element of the array, and returns an array with the same dimensions as the input array.

If both of the arguments are double-precision or if the DOUBLE keyword is set, the result is double-precision, otherwise the result is single-precision.


Z, W

The point at which the beta function is to be evaluated. Z and W can be scalar or array. Z or W may be complex.



Set this keyword to force the computation to be done in double-precision arithmetic.

Thread Pool Keywords

This routine is written to make use of IDL’s thread pool, which can increase execution speed on systems with multiple CPUs. The values stored in the !CPU system variable control whether IDL uses the thread pool for a given computation. In addition, you can use the thread pool keywords TPOOL_MAX_ELTS, TPOOL_MIN_ELTS, and TPOOL_NOTHREAD to override the defaults established by !CPU for a single invocation of this routine. See Thread Pool Keywords for details.

Version History




Added Z and W arguments to accept complex input

Resources and References

For more information on the Euler beta function, see's entry on the BETA function.

See Also