<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, how do I get sums produced by "add" to immediately evaluate?</title>
    <link>http://www.mapleprimes.com/questions/144314-How-Do-I-Get-Sums-Produced-By-add</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Tue, 09 Jun 2026 09:30:07 GMT</lastBuildDate>
    <pubDate>Tue, 09 Jun 2026 09:30:07 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, how do I get sums produced by "add" to immediately evaluate?</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, how do I get sums produced by "add" to immediately evaluate?</title>
      <link>http://www.mapleprimes.com/questions/144314-How-Do-I-Get-Sums-Produced-By-add</link>
    </image>
    <item>
      <title>I really do want to use evalhf, because we're going to use </title>
      <link>http://www.mapleprimes.com/questions/144314-How-Do-I-Get-Sums-Produced-By-add?ref=Feed:MaplePrimes:how do I get sums produced by "add" to immediately evaluate?:Comments#answer144336</link>
      <itunes:summary>&lt;p&gt;I really do want to use evalhf, because we're going to use (a more complicated example than) this to create a sound file using AudioTools, and evalf is too slow.&amp;nbsp; But I do need it to be not-too-complicated, because this is intended to be part of a lab for my calculus students.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;I really do want to use evalhf, because we're going to use (a more complicated example than) this to create a sound file using AudioTools, and evalf is too slow.&amp;nbsp; But I do need it to be not-too-complicated, because this is intended to be part of a lab for my calculus students.&lt;/p&gt;</description>
      <guid>144336</guid>
      <pubDate>Fri, 08 Mar 2013 07:26:52 Z</pubDate>
      <itunes:author>webreg2003</itunes:author>
      <author>webreg2003</author>
    </item>
    <item>
      <title>How to use evalhf</title>
      <link>http://www.mapleprimes.com/questions/144314-How-Do-I-Get-Sums-Produced-By-add?ref=Feed:MaplePrimes:how do I get sums produced by "add" to immediately evaluate?:Comments#answer144341</link>
      <itunes:summary>&lt;p&gt;The trick to using &lt;strong&gt;evalhf &lt;/strong&gt;here is that the integration needs to be done at the time &lt;strong&gt;h&lt;/strong&gt; is created, not at the time that &lt;strong&gt;h&lt;/strong&gt; is called. And there's extra complexity that &lt;em&gt;n&lt;/em&gt; = 2 needs to be handled as a separate case to avoid division by zero. So, you need to define &lt;strong&gt;h&lt;/strong&gt; this way:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;h := subs(J= int(f(x)*sin(n*x), x= -Pi..Pi)/Pi, n-&amp;gt; `if`(n=2, 1, J));&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Your &lt;strong&gt;f&lt;/strong&gt; and &lt;strong&gt;g&lt;/strong&gt; can remain the same. If you define &lt;strong&gt;h&lt;/strong&gt; as above, then the call &lt;strong&gt;evalhf(g(2)) &lt;/strong&gt;will work. This is correct usage, not effective usage. To use &lt;strong&gt;evalhf &lt;/strong&gt;effectively, you need to pack as much computation as possible into each invocation of &lt;strong&gt;evalhf&lt;/strong&gt;.&lt;strong&gt;&lt;br&gt;&lt;/strong&gt;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;The trick to using &lt;strong&gt;evalhf &lt;/strong&gt;here is that the integration needs to be done at the time &lt;strong&gt;h&lt;/strong&gt; is created, not at the time that &lt;strong&gt;h&lt;/strong&gt; is called. And there's extra complexity that &lt;em&gt;n&lt;/em&gt; = 2 needs to be handled as a separate case to avoid division by zero. So, you need to define &lt;strong&gt;h&lt;/strong&gt; this way:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;h := subs(J= int(f(x)*sin(n*x), x= -Pi..Pi)/Pi, n-&amp;gt; `if`(n=2, 1, J));&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Your &lt;strong&gt;f&lt;/strong&gt; and &lt;strong&gt;g&lt;/strong&gt; can remain the same. If you define &lt;strong&gt;h&lt;/strong&gt; as above, then the call &lt;strong&gt;evalhf(g(2)) &lt;/strong&gt;will work. This is correct usage, not effective usage. To use &lt;strong&gt;evalhf &lt;/strong&gt;effectively, you need to pack as much computation as possible into each invocation of &lt;strong&gt;evalhf&lt;/strong&gt;.&lt;strong&gt;&lt;br&gt;&lt;/strong&gt;&lt;/p&gt;</description>
      <guid>144341</guid>
      <pubDate>Fri, 08 Mar 2013 08:55:09 Z</pubDate>
      <itunes:author>Carl Love</itunes:author>
      <author>Carl Love</author>
    </item>
    <item>
      <title>evalhf</title>
      <link>http://www.mapleprimes.com/questions/144314-How-Do-I-Get-Sums-Produced-By-add?ref=Feed:MaplePrimes:how do I get sums produced by "add" to immediately evaluate?:Comments#comment144340</link>
      <itunes:summary>&lt;p&gt;If I were to rate various aspects of Maple based on the experience level required to use them, on a scale from 0 to 10, I'd say that using &lt;strong&gt;evalhf &lt;/strong&gt;correctly would be level 3, and using it effectively would be level 4.5. If you're doing symbolic integrations inside an &lt;strong&gt;add&lt;/strong&gt; loop, the savings you get from using &lt;strong&gt;evalhf &lt;/strong&gt;are going to be miniscule. Nonetheless, I will post an answer to your question.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;If I were to rate various aspects of Maple based on the experience level required to use them, on a scale from 0 to 10, I'd say that using &lt;strong&gt;evalhf &lt;/strong&gt;correctly would be level 3, and using it effectively would be level 4.5. If you're doing symbolic integrations inside an &lt;strong&gt;add&lt;/strong&gt; loop, the savings you get from using &lt;strong&gt;evalhf &lt;/strong&gt;are going to be miniscule. Nonetheless, I will post an answer to your question.&lt;/p&gt;</description>
      <guid>144340</guid>
      <pubDate>Fri, 08 Mar 2013 08:26:46 Z</pubDate>
      <itunes:author>Carl Love</itunes:author>
      <author>Carl Love</author>
    </item>
    <item>
      <title>Aha!&amp;nbsp; So "subs" will force add to evaluate</title>
      <link>http://www.mapleprimes.com/questions/144314-How-Do-I-Get-Sums-Produced-By-add?ref=Feed:MaplePrimes:how do I get sums produced by "add" to immediately evaluate?:Comments#comment144448</link>
      <itunes:summary>&lt;p&gt;Aha!&amp;nbsp; So "subs" will force add to evaluate its operands - that's exactly what I needed!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So, I can leave my f, g and h the same, but then "set" the definition of g with&lt;/p&gt;
&lt;p&gt;g:=subs(t=g(x), x-&amp;gt;t)&lt;/p&gt;
&lt;p&gt;and then evalhf(g(2)) returns a value.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is a bit eccentric, but seems to work fine.&amp;nbsp; Does it meet your criteria for being effective?&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Aha!&amp;nbsp; So "subs" will force add to evaluate its operands - that's exactly what I needed!&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So, I can leave my f, g and h the same, but then "set" the definition of g with&lt;/p&gt;
&lt;p&gt;g:=subs(t=g(x), x-&amp;gt;t)&lt;/p&gt;
&lt;p&gt;and then evalhf(g(2)) returns a value.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is a bit eccentric, but seems to work fine.&amp;nbsp; Does it meet your criteria for being effective?&lt;/p&gt;</description>
      <guid>144448</guid>
      <pubDate>Sun, 10 Mar 2013 22:22:46 Z</pubDate>
      <itunes:author>webreg2003</itunes:author>
      <author>webreg2003</author>
    </item>
  </channel>
</rss>