<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi!<br>
     <br>
    diffcode 1.1.1-1: I once filed the bug 13431 and I see the status is
    RESOLVED MOVED. But the bug persists in the ATOMS version under
    5.5.1 Linux 64 bits. The fix is very easy but I need it to be
    installed OK for my students instead of instructing them to apply
    the fix by themselves.<br>
    <br>
    The fix is to modify the file<br>
    <blockquote>
      <blockquote>SCILABHOME/share/scilab/contrib/diffcode/1.1.1-1/macros/diffcode_CDcost.sci<br>
      </blockquote>
      <p>replacing<br>
      </p>
      <blockquote>  f=fun(x)<br>
      </blockquote>
      by<br>
      <blockquote>  f=fun(x,varargin(:)) // JPD ajouté le varargin<br>
      </blockquote>
    </blockquote>
    The following example crashes without the fix.<br>
    <br>
    Thanks,<br>
    <br>
    JPD<br>
    <br>
    function [val]= fexlum(x,varargin);<br>
      val=0;<br>
      o=varargin(1);<br>
      p=varargin(2);<br>
      <br>
      val = sqrt((p(1)-x)^2 + (p(2)-x^2)^2);<br>
      val = val + sqrt((o(1)-x)^2 + (o(2)-x^2)^2);<br>
    endfunction<br>
    <br>
    x0=2;<br>
    oo = [2,1];<br>
    pp = [1,-1];<br>
    <br>
    [fopt,xopt,gopt]=optim(list(diffcode_CDcost,...<br>
          fexlum,oo,pp),x0,'nd')<br>
    <br>
    x=-1:0.1:1;<br>
    plot2d(x,x^2)<br>
    plot2d([oo(1),xopt],[oo(2),xopt^2])<br>
    plot2d([pp(1),xopt],[pp(2),xopt^2])<br>
  </body>
</html>