Many thanks Stéphane. Is it also possible to do this if the gradient is not known or impractical to obtain using NDcost as i had intended with something like [fopt,popt,gopt]=optim(list(NDcost,fun),p0') ? Regards, Dave -- Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html