<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - comments on Post, Optimization workaround for Operator Form</title>
    <link>http://www.mapleprimes.com/posts/95113-Optimization-Workaround-For-Operator-Form</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Wed, 10 Jun 2026 23:52:54 GMT</lastBuildDate>
    <pubDate>Wed, 10 Jun 2026 23:52:54 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest comments added to the Post, Optimization workaround for Operator Form</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - comments on Post, Optimization workaround for Operator Form</title>
      <link>http://www.mapleprimes.com/posts/95113-Optimization-Workaround-For-Operator-Form</link>
    </image>
    <item>
      <title>Thanks</title>
      <link>http://www.mapleprimes.com/posts/95113-Optimization-Workaround-For-Operator-Form?ref=Feed:MaplePrimes:Optimization workaround for Operator Form:Comments#comment95126</link>
      <itunes:summary>&lt;p&gt;Thanks for posting the workaround, acer. Yes, there seems to be a bug in NLPSolve in this particular situation (operator form, with failure of codegen automatic differentiation routines). Providing your own gradient routine is a good workaround.&lt;/p&gt;
&lt;p&gt;Paulina&lt;/p&gt;</itunes:summary>
      <description>The latest comments added to the Post, Optimization workaround for Operator Form</description>
      <guid>95126</guid>
      <pubDate>Thu, 15 Jul 2010 14:32:41 Z</pubDate>
      <itunes:author>pchin</itunes:author>
      <author>pchin</author>
    </item>
    <item>
      <title>worrisome</title>
      <link>http://www.mapleprimes.com/posts/95113-Optimization-Workaround-For-Operator-Form?ref=Feed:MaplePrimes:Optimization workaround for Operator Form:Comments#comment126007</link>
      <itunes:summary>&lt;p&gt;Things like this below are worrisome, indicating that codegen[GRADIENT] may be problematic for some innocuous-looking objective procedures.&lt;/p&gt;
&lt;pre&gt;&amp;gt; restart:
&amp;gt; f := proc(x)
&amp;gt;     x^2;
&amp;gt; end proc:

&amp;gt; codegen[GRADIENT](f);  # ok

                          proc(x) return 2*x end proc;

&amp;gt; evalhf( %(4.5) );

                                     9.


&amp;gt; restart:
&amp;gt; f := proc(x)
&amp;gt;     print(f);
&amp;gt;     x^2;
&amp;gt; end proc:

&amp;gt; codegen[GRADIENT](f);  # ok

                    proc(x) print(f); return 2*x; end proc;

&amp;gt; evalhf( %(4.5) );

                             4.50000000000000000
                                     9.

&amp;gt; restart:
&amp;gt; f := proc(x)
&amp;gt;     [];  # just another no-op, you'd imagine
&amp;gt;     x^2;
&amp;gt; end proc:

&amp;gt; codegen[GRADIENT](f);  # jeepers

                          proc(x) return  end proc;

&amp;gt; evalhf( %(4.5) );

                              Float(undefined)
&lt;/pre&gt;
&lt;p&gt;The last example was an objective that itself was non-evalhfable. But the following example is more troublesome, and produces a wrong numeric result for the gradient.&lt;/p&gt;
&lt;pre&gt;&amp;gt; restart:

&amp;gt; f := proc(x)
&amp;gt;     5.7;  # not an assignment, but also not a return value!
&amp;gt;     x^2;
&amp;gt; end proc:

&amp;gt; codegen[GRADIENT](f);
                           proc(x) return 0 end proc

&amp;gt; %(4.5);
                                       0
&lt;/pre&gt;
&lt;p&gt;All this means that `&lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=fdiff"&gt;fdiff&lt;/a&gt;` may be sometimes be more attractive as a means to get a useful gradient (even if numerical diferentiation is "frowned upon" on stability grounds).&lt;/p&gt;
&lt;p&gt;The procedure in the top-post could be changed to automatically handle an (indeterminate) variable number of arguments (to the original objective). It could also be altered to supply optional arguments to `&lt;a href="http://www.maplesoft.com/support/help/Maple/view.aspx?path=fdiff"&gt;fdiff&lt;/a&gt;`, such as the 'workprec'=n argument which controls the working precision that `fdiff sets for itself internally. This would help in the case that one wanted `fdiff` to not raise Digits too high (internally, temporarily) when calling the objective procedure for its computation of finite differences. &lt;!--break--&gt;&lt;/p&gt;
&lt;p&gt;acer&lt;/p&gt;</itunes:summary>
      <description>The latest comments added to the Post, Optimization workaround for Operator Form</description>
      <guid>126007</guid>
      <pubDate>Tue, 27 Sep 2011 21:49:59 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
  </channel>
</rss>