Documentation/Calc Functions/GAMMA

    From The Document Foundation Wiki
    This page contains changes which are not marked for translation.

    Function name:

    GAMMA

    Category:

    Statistical Analysis

    Summary:

    Calculates the value of the gamma function for a specified real number. The gamma function extends the concept of the factorial function to non-integer and negative numbers.

    Syntax:

    GAMMA(Number)

    Returns:

    Returns a real number, which is the value of the gamma function for the number passed as argument.

    Arguments:

    Number is a real number, or a reference to a cell containing that number, for which the gamma function is to be calculated.

    • If Number is non-numeric, then GAMMA reports a #VALUE! error.
    • If Number is equal to 0, or equal to any negative integer, then GAMMA reports an invalid argument error (Err:502).

    Additional details:

    • The formula for the gamma function (represented by the Greek letter [math]\displaystyle{ \Gamma }[/math]) is usually expressed as:
    [math]\displaystyle{ \Gamma(x)~=~\int_{0}^{\infty } \: t^{x-1} \: e^{-t}\:dt }[/math]
    This formula is valid for any positive real number (x).
    • In addition, the gamma function satisfies the following recursive relationship:
    [math]\displaystyle{ \Gamma(x+1)~=~x \: \Gamma(x) }[/math]
    This recursion enables the value of the gamma function to be evaluated for negative, non-integer numbers.
    • The following figure shows a plot of the gamma function for numbers x in the range [-4, 4].
    Gamma function plot.png
    • For more information about the gamma function, visit Wikipedia's Gamma function page.

    Examples:

    Formula Description Returns
    =GAMMA(A1) where cell A1 contains the number 10. Calculates the gamma function for an input value of 10. Note that for positive integers (natural numbers), the relation [math]\displaystyle{ \Gamma(n)=(n-1)! }[/math] applies. In this case, [math]\displaystyle{ (10-1)!=9!=362880 }[/math], demonstrating the relation. 362880
    =GAMMA(-0.2) Calculates the gamma function for an input value of -0.2. -5.82114856862652
    =GAMMA(0.8) Calculates the gamma function for an input value of 0.8. This could also be calculated from the previous example, using the relation [math]\displaystyle{ \Gamma(x+1)=x \Gamma(x) }[/math]. [math]\displaystyle{ -0.2 \times -5.82114856862652 = 1.1642297137253 }[/math]. 1.1642297137253
    =GAMMA(-1.5) Calculates the gamma function for an input value of -1.5. 2.36327180120735

    Related LibreOffice functions:

    FACT

    GAMMALN

    GAMMALN.PRECISE

    ODF standard:

    Section 6.18.31, part 2

    Related (or similar) Excel functions:

    GAMMA since v.2013.