问题
I would like to integrate function f4
with respect to x
and then find the derivative of the new function with respect to t
. I can calculate the integral numerically. Is there any way to calculate this integral and derivative symbolically in R?
lambda=1
ci=1
aa <- function(u,k,t){
f4 <- function(x){
f1 <- function(x){ lambda*exp(2*sqrt(lambda)*ci*t*cos(x)-
(1+lambda)*ci*t +u*(sqrt(lambda)*cos(x)-1)) }
f2 <- function(x){cos(u*sqrt(lambda)*sin(x)) -
cos(u*sqrt(lambda)*sin(x) + 2*x) }
f3 <- function(x){ 1 + lambda - 2*sqrt(lambda)*cos(x) }
(f1(x)*f2(x))/f3(x)
}
((1/pi)*(integrate(f4, lower = 0, upper = pi)$value ))
}
D(aa,"t")
来源:https://stackoverflow.com/questions/34856279/symbolic-derivative-and-integral