<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>There is no added value when using NDcost, you can directly use
      numderivative like this</p>
    <p>function [f,g,ind]=costf(p,ind)
      <br>
          f=norm(fun(p))^2<sup class="moz-txt-sup"><span
          style="display:inline-block;width:0;height:0;overflow:hidden"></span></sup>;
      <br>
          g=2*numderivative(fun,p)'*fun(p);
      <br>
      endfunction <br>
    </p>
    <p>S.<br>
    </p>
    <div class="moz-cite-prefix">Le 08/01/2020 à 16:45, David Brant a
      écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:1578498330586-0.post@n3.nabble.com">
      <pre class="moz-quote-pre" wrap="">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: <a class="moz-txt-link-freetext" href="https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html">https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html</a>
_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users">https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
<a class="moz-txt-link-freetext" href="http://www.utc.fr/~mottelet">http://www.utc.fr/~mottelet</a>
</pre>
  </body>
</html>