简体   繁体   English

第二类修饰贝塞尔函数的导数是否有特定的R函数?

[英]Is there a specific R function for the derivative of modified Bessel function of the second kind?

My problem is as it says in the title, I am trying to use the derivative (with respect to v ) of the modified Bessel function of the second kind K_v(x) but with no success. 我的问题是正如标题中所述,我正在尝试使用第二种K_v(x)的经过修改的Bessel函数的导数(相对于v ),但没有成功。

I read in one of the documentation that besselDK(v,x) would work as a derivative, apparently this is not a recognized function in R. I tried to use the expansion for the derivative, namely 我读过其中一个文档,其中besselDK(v,x)可以作为派生类使用,显然这在R中不是公认的函数。我尝试将扩展名用于派生类,即

besselK(v,x)*(1- (1/2v) -log(e*x/2v))

but this doesn't work to give me the correct plot as well. 但这也无法给我正确的情节。 I am trying to plot a function which includes this. 我试图绘制一个包含此功能。

P <- function(x) (1/2)*log(exp(1)/(2*pi*x^(2)))+(3*exp(1/x^(2))/(sqrt(2*pi*x^(2))))*besselK((1/x^(2)),1/2)*(log(exp(1)/x^(2)))
x <- seq(0.1,2,0.01)
plot(x, P(x), xlim=c(0,2), ylim=c(0,1.2), type="l")

From the code above, I get a straight line as a plot. 从上面的代码中,我得到一条直线作为图。 In the correct plot, it should be a curve bending between 1 and 1.5, could someone please tell me the right way to go about it? 在正确的图中,应该是一条介于1到1.5之间的曲线,有人可以告诉我正确的处理方法吗?

The derivative at nu = 1/2 is given here . 这里给出nu = 1/2的导数。

f <- function(nu,x){
  besselK(x, nu)
}

library(gsl) # for expint_E1
fprime <- function(x){
  sqrt(pi/2/x) * expint_E1(2*x) * exp(x)
}

nu <- 1/2
h <- 1e-6
x <- 2
(f(nu+h, x) - f(nu,x)) / h 
## [1] 0.02474864
fprime(x)
## [1] 0.02474864

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM