Hello again. Thank you for the comments. I have written these codes. iy=function(x) { res=NULL ress=0 for (i in (1:2)) { for (xx in x[i]) { fy=function(y) (exp(-exp(y+log(xx)))*(-exp(y+log(xx)))^2)/(1-exp(-exp(y+log(xx)))) res=c(res,integrate(fy,-6.907,-1.246)$value) ress=ress+res } } return(ress) } iy(c(1,1)) integrate(fy,-6.907,-1.246)$value
In 1D optimize() works perfectly on iy(). However the problem is in 2D and more, optimize() does not work and I need to apply optim(). I could not apply optim() on iy(). Beside, I tried to use Ryacas, I faced with this error: [1] "Starting Yacas!" Error in socketConnection(host = "127.0.0.1", port = 9734, server = FALSE, : cannot open the connection In addition: Warning message: In socketConnection(host = "127.0.0.1", port = 9734, server = FALSE, : 127.0.0.1:9734 cannot be opened Cheers, Maryam [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.