<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Hi all<br /> <br /> I've not been using Scilab for optimization tasks for years and I decided to dig up my old codes; I didn't follow such items in the mailing list so the current questionning has probably ever been treated (?!?!):<br /> <br /> why numderivative leads to different result than derivative (since derivative will be removed in the next release)? ... algorithms + step calculation  are probably different (while they are using finite difference method ... I don't know)<br /> <br />To myself first, I've made a (very) basic example based on the famous Rosembrock function to perform tests</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Thanks for any support</div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace"> </div>
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">Paul<br /> <br /> ###############################################################################"<br /> mode(0)<br /> clear<br /> <br /> // function<br /> function f = rosembrock(x)<br />     f = ( 1 - x(1))^2 + 100*( x(2)-x(1)^2 )^2;<br /> endfunction<br /> <br /> // cost function<br /> function [f,g,ind] = cost(x,ind)<br />     f = rosembrock(x);<br /> //    g = derivative(rosembrock, x.',order = 4); <br />     g = numderivative(rosembrock, x.',order = 4); <br /> endfunction<br /> <br /> <br /> //initial_parameters = [10 10]<br /> initial_parameters = [100 100]<br /> //lower_bounds = [90 90];<br /> lower_bounds = [0 0];<br /> upper_bounds = [1000 1000];<br /> //[fopt , xopt] = optim(cost,initial_parameters) <br /> [fopt , xopt] = optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'ar',100,100)</div>
</body></html>