Compute the Logarithmic Derivative of the gamma Function in R Programming – digamma() Function
Last Updated :
12 Jun, 2020
digamma()
function in R Language is used to calculate the logarithmic derivative of the gamma value calculated using the gamma function.
digamma Function is basically,
digamma(x) = d(ln(factorial(n-1)))/dx
Syntax: digamma(x)
Parameters:
x: Numeric vector
Example 1:
digamma( 2 )
digamma( 4 )
digamma( 5.2 )
|
Output:
[1] 0.4227843
[1] 1.256118
[1] 1.549434
Example 2:
x < - c( 2.3 , 3 , 1.2 )
digamma(x)
digamma( - 2.3 )
digamma( - 2 )
|
Output:
[1] 0.6000399 0.9227843 -0.2890399
[1] 3.317323
[1] NaN
Warning message:
In digamma(-2) : NaNs produced
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...