Compute the trigamma function of x (the logarithmic second derivative of gamma(x))


julia> using SpecialFunctions

julia> trigamma(2.5)
  1. Calculate the trigamma value for a real number:

    julia> trigamma(3.5)

    This example computes the trigamma function for the real number 3.5.

  2. Compute the trigamma value for a negative number:

    julia> trigamma(-2.7)

    The trigamma function can also be used for negative numbers.

  3. Evaluate trigamma for complex numbers:
    julia> trigamma(1 + 2im)
    0.18128155925929737 - 0.15873464760702674im

    The trigamma function can be applied to complex numbers as well.

Common mistake example:

julia> trigamma("2.5")
ERROR: MethodError: no method matching trigamma(::String)

In this example, the input provided is a string instead of a numeric type. Ensure that the input to trigamma is a valid number 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

Checking you are not a robot: