Bessel K Ratio | R Documentation |
Calculates the ratio of Bessel K functions of different orders
besselRatio(x, nu, orderDiff, useExpScaled = 700)
x |
Numeric, |
nu |
Numeric. The order of the Bessel function in the denominator. |
orderDiff |
Numeric. The order of the numerator Bessel function minus the order of the denominator Bessel function. |
useExpScaled |
Numeric, |
Uses the function besselK
to calculate the ratio of two
modified Bessel function of the third kind whose orders are
different. The calculation of Bessel functions will underflow if the
value of x
is greater than around 740. To avoid underflow the
exponentially-scaled Bessel functions can be returned by
besselK
. The ratio is actually unaffected by exponential
scaling since the scaling cancels across numerator and denominator.
The Bessel function ratio is useful in calculating moments of the Generalized Inverse Gaussian distribution, and hence also for the moments of the hyperbolic and generalized hyperbolic distributions.
The ratio
\frac{K_{\nu+k}(x)}{K_{\nu}(x)}
of two modified Bessel functions of the third kind whose orders differ
by k
.
David Scott d.scott@auckland.ac.nz
besselK
, gigMom
nus <- c(0:5, 10, 20)
x <- seq(1, 4, length.out = 11)
k <- 3
raw <- matrix(nrow = length(nus), ncol = length(x))
scaled <- matrix(nrow = length(nus), ncol = length(x))
compare <- matrix(nrow = length(nus), ncol = length(x))
for (i in 1:length(nus)){
for (j in 1:length(x)) {
raw[i,j] <- besselRatio(x[j], nus[i],
orderDiff = k)
scaled[i,j] <- besselRatio(x[j], nus[i],
orderDiff = k, useExpScaled = 1)
compare[i,j] <- raw[i,j]/scaled[i,j]
}
}
raw
scaled
compare
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.