Question: NLPSolve of an integral expression?


I have encountered difficulties with an optimization problem to be solved with NLPSolve. I want to minimize the integral of a parametrized function. However, when I call NLPSolve it seems that the integration variable of the int-command gets replaced for some reason I don't understand. A piece of code is quoted below. Does anybody see what I am doing wrong? Any hint will be appreciated.

> h := proc (c0, c1, c2, R, r) options operator, arrow; sqrt(R^2-r^2)*(c0+c1*r^2/R^2+c2*r^4/R^4) end proc;
> K := proc (c0, c1, c2, R, r) options operator, arrow; ((diff(h(c0, c1, c2, R, r), r))*(1+(diff(h(c0, c1, c2, R, r), r))^2)+r*(diff(h(c0, c1, c2, R, r), r, r)))/(r*(1+(diff(h(c0, c1, c2, R, r), r))^2)^(3/2)) end proc;
> f := proc (c0, c1, c2, R, r) options operator, arrow; r*sqrt(1+(diff(h(c0, c1, c2, R, r), r))^2)*K(c0, c1, c2, R, r)^2 end proc;
> F := proc (c0, c1, c2, R) evalf(int(f(c0, c1, c2, R, x), x = 0 .. R)) end proc;
> E := proc (c0, c1, c2) F(c0, c1, c2, 3.91) end proc;
> NLPSolve(E(c0, c1, c2), initialpoint = [c0 = .1035805, c1 = 1.001279, c2 = -.561381]);
Error, (in Optimization:-NLPSolve) integration range or variable must be specified in the second argument, got 1. = 0. .. 3.91


Please Wait...