Dear all,

I am a new user to R and I am using pracma and nloptr libraries to minimize
a numerical integration subject to a single constraint . The integrand
itself is somehow a complicated function of x and y that is computed
through several steps.  i formulated the integrand in a separate function
called f which is a function of x &y. I want to find the optimal value of x
such that the integration over y is minimum. Here is my code, it is not
working. I got an error: 'y' is missing


library('nloptr')
 library('pracma')



f <- function(x,y) {#here i should put the commands representing my function

return(   )
}


 #constraint function


eval_g0 <- function(x) {

    return( )
}


# objective function


eval_f0 <- function(x) {
romberg(f, 0.5, 0.5001)}


ARL1 <- nloptr( x0=c(0.653),
                eval_f=eval_f0,
                lb = c(0),
                ub = c(6),
                eval_g_ineq = eval_g0,
                opts = list("algorithm"="NLOPT_LN_COBYLA", "maxeval"=1000),
                                 )
print( )



 Thanks

        [[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.

Reply via email to