symbolic derivative and integral

只愿长相守 提交于 2019-12-23 20:58:52

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!