Ansicht
Dokumentation

QF00_LOG_GAMMA - Natural logarithm of gamma function

QF00_LOG_GAMMA - Natural logarithm of gamma function

Addresses (Business Address Services)   General Material Data  
This documentation is copyright by SAP AG.
SAP E-Book

Task

The function module calculates the gamma function

Example (factorials)

  DATA:
    N           TYPE I,
    N_FACTORIAL TYPE F,
    X           TYPE F,
    Y           TYPE F.

  X = N + 1.

  CALL FUNCTION 'QF00_LOG_GAMMA'
    EXPORTING ARGUMENT  = X
    IMPORTING LOG_GAMMA = Y.

  N_FACTORIAL = EXP( Y ).

Description

The gamma function is a special mathematical function, defined for z > 0 by the definite integral

GAMMA(z) = INTEGRAL(0..infinity, t**(z-1) * exp(-t) dt)

It is needed for example for various statistical test and estimation procedures. As the function values can be very large, the natural logarithm of the gamma function is implemented rather than the function itself.

LOG_GAMMA(z) = LOG( GAMMA(z) )

For whole number argument z GAMMA(z+1) = z!. The function can therefore also be used to calculate factorials and binomial coefficients. The calculation of function values for negative arguments is not supported.

Reference

W.H.Press, B.P.Flannery, S.A.Teukolsky, W.T.Vetterling, Numerical Recipes in C. Cambridge University Press, Cambridge 1988





Parameters

ARGUMENT
LOG_GAMMA

Exceptions

NOT_POSITIVE

Function Group

QF00

BAL Application Log Documentation   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 1809 Date: 20240523 Time: 143657     sap01-206 ( 25 ms )