if (FALSE) {
nu <- function(x)(200+100*cos(pi*x))*(x>=0);
g <- function(x) 2*exp(-x)
h.l <- h.fn(nu=nu,g=g,to=5);
h <- splinefun(h.l$x,h.l$y);
x <- 1:500/100;
max(nu(x)+sapply(x,function(x)integrate(function(u)g(x-u)*h(u),0,x)$value) - h(x))
}
Run the code above in your browser using DataLab