我想计算这个积分:
int=function(strike,tau,alpha1,lambda,alpha,beta,delta,mi){
Call=function(v){
out=exp(-log(strike)*1i*v)*exp(-r*tau)*CF_GH((v-(alpha1+1))*1i,tau,lambda,alpha,beta,delta,mi)/
(alpha1**2 + alpha1-v**2+1i*v*(2*alpha1+1))
}
return(Call)
}
int2=function(strike,tau,alpha1,lambda,alpha,beta,delta,mi){
out=integrate(int(strike,tau,alpha1,lambda,alpha,beta,delta,mi),lower = 0,upper = Inf)$value
out
}
带
CF_GH=function(v,tau,lambda,alpha,beta,delta,mi){
a1 = delta*sqrt(lambda**2-(beta+1i*v)**2)
a2 = delta*sqrt(alpha**2 - beta**2)
a3 = exp(1i*mi*v)*((alpha**2 - beta**2)/(alpha**2 -(beta+1i*v)**2))^(lambda/2)
espon = a3*BesselK(a1,lambda)/BesselK(a2,lambda)
phi=exp(espon*tau)
phi
}
但错误是:
整合错误(int(strike,tau,alpha1,lambda,alpha,beta,:
功能评估给出了错误类型的结果