Compute the Second Derivative of the Logarithmic value of the gamma Function in R Programming – trigamma() Function
trigamma()
function in R Language is used to calculate the second derivative of the natural logarithm of the gamma value calculated using the gamma function.
trigamma Function is basically,
trigamma(x) = d2(ln(factorial(n-1)))/dx2
Syntax: trigamma(x)
Parameters:
x: Numeric vector
Example 1:
trigamma( 2 )
trigamma( 4 )
trigamma( 5.2 )
|
Output:
[1] 0.6449341
[1] 0.283823
[1] 0.2119756
Example 2:
x < - c( 2.3 , 3 , 1.2 )
trigamma(x)
trigamma( - 2.3 )
trigamma( - 2 )
|
Output:
[1] 0.5425375 0.3949341 1.2673772
[1] 14.72591
[1] Inf
Last Updated :
12 Jun, 2020
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...