digamma

digamma(x)

Compute the digamma function of x (the logarithmic derivative of gamma(x))

Examples

julia> using SpecialFunctions

julia> digamma(2)
0.42278433509846713

julia> digamma(0.5)
-1.9635100260214235
  1. Calculate the digamma function of a positive number:

    julia> digamma(3.7)
    0.6471423733718684

    This example calculates the digamma function of the number 3.7.

  2. Calculate the digamma function of a negative number:

    julia> digamma(-2.5)
    -0.5240777691836912

    The digamma function can also handle negative numbers. This example calculates the digamma function of -2.5.

  3. Calculate the digamma function of a complex number:
    julia> digamma(1 + 2im)
    0.42278433509846713 - 1.5707963267948966im

    The digamma function can be applied to complex numbers as well. This example calculates the digamma function of the complex number 1 + 2im.

Common mistake example:

julia> digamma(0)
ERROR: DomainError with -Inf result

In this example, the function call digamma(0) leads to a DomainError because the digamma function is not defined for zero. It's important to ensure that the input values are within the valid domain to avoid such errors.

See Also

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: