psi: Psi Function

Description Usage Arguments Details Value Examples

Description

The Psi function is defined as

ψ(z) = \frac{d}{dz} \log Γ(z) = \frac{Γ'(z)}{Γ(z)}

which is also called the digamma function.

Usage

1
sp.psi(z)

Arguments

z

real or complex argument.

Details

The computation utilizes an asymptotic expansion and a recurrence relation.

Value

Returns the value of the Psi function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
Psi <- Vectorize(sp.psi)
print(Psi(1), digits = 16)
# [1] -0.5772156649015329               # Euler's Gamma constant
print(Psi(1/2), digits = 16)
# [1] -1.963510026021424                # -Gamma - 2*log(2)

## Not run: 
x <- seq(-5, 5, length.out = 501)
y <- Psi(x)
plot(x, y, type = 'l', col = "blue",
        main = "Psi function")
grid()
## End(Not run)

specfun documentation built on May 2, 2019, 4:44 p.m.

Related to psi in specfun...