<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 integrate compiled function?</title>
    <link>http://www.mapleprimes.com/questions/134984-How-Do-I-Integrate-Compiled-Function</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Tue, 16 Jun 2026 12:35:40 GMT</lastBuildDate>
    <pubDate>Tue, 16 Jun 2026 12:35:40 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, How do I integrate compiled function?</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, How do I integrate compiled function?</title>
      <link>http://www.mapleprimes.com/questions/134984-How-Do-I-Integrate-Compiled-Function</link>
    </image>
    <item>
      <title>?int/numeric</title>
      <link>http://www.mapleprimes.com/questions/134984-How-Do-I-Integrate-Compiled-Function?ref=Feed:MaplePrimes:How do I integrate compiled function?:Comments#answer134985</link>
      <itunes:summary>&lt;p&gt;Have you tried using unevaluation quotes around your function to avoid symbolic argument errors.&amp;nbsp; See &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=int/numeric' target='_new'&gt;?int/numeric&lt;/a&gt; for details, half way down the page.&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Georgios Kokovidis&lt;/p&gt;
&lt;p&gt;Dr&amp;auml;ger Medical&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Have you tried using unevaluation quotes around your function to avoid symbolic argument errors.&amp;nbsp; See &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=int/numeric' target='_new'&gt;?int/numeric&lt;/a&gt; for details, half way down the page.&lt;/p&gt;
&lt;!--break--&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Georgios Kokovidis&lt;/p&gt;
&lt;p&gt;Dr&amp;auml;ger Medical&lt;/p&gt;</description>
      <guid>134985</guid>
      <pubDate>Mon, 11 Jun 2012 02:29:26 Z</pubDate>
      <itunes:author>gkokovidis</itunes:author>
      <author>gkokovidis</author>
    </item>
    <item>
      <title>usual three ways</title>
      <link>http://www.mapleprimes.com/questions/134984-How-Do-I-Integrate-Compiled-Function?ref=Feed:MaplePrimes:How do I integrate compiled function?:Comments#answer134992</link>
      <itunes:summary>&lt;p&gt;There are three common ways to get around premature evaluation of the arguments.&lt;/p&gt;
&lt;p&gt;One way is to use a procedure which returns unevaluated if the arguments do not satisfy some type requirements, eg. all numeric, say.&lt;/p&gt;
&lt;p&gt;Sometimes creating such a procedure can be made easier, by using the `unapply` command with its 'numeric' option. You may or may not find that helpful here.&lt;/p&gt;
&lt;p&gt;Another way is to use unevaluation quotes, as Georgios suggested. These first two ways involve the expression-form calling sequence, where the variable ranges are each given like name=range(numeric).&lt;/p&gt;
&lt;p&gt;A third way is to use the operator-form calling sequence, for which the various ranges of integration (or fsolving, or plotting, or Optimizing) are just range(numeric) instead of being name=range(numeric). Unfortunately this does not seem to work for the Compiled multivariate proc, unless it is wrapped in yet another proc.&lt;/p&gt;
&lt;pre&gt;f:= proc(kF1, kF2, m, k, omega, q)
      kF1+kF2+m+k+omega+q;
    end proc:

# First, using the original procedure `f`.

evalf(Int('f'(q,r,s,t,u,v),[q=0..1,r=0..2,s=0..3,t=0..4,u=0..5,v=0..6])); # Georgios
                          7560.000000

evalf(Int(f,[0..1,0..2,0..3,0..4,0..5,0..6]));
                          7560.000000

evalf(Int((q,r,s,t,u,v)-&amp;gt;f(q,r,s,t,u,v),[0..1,0..2,0..3,0..4,0..5,0..6]));
                          7560.000000

# Now, using Compiled procedure `cf`.

cf:=Compiler:-Compile(f):

evalf(Int('cf'(q,r,s,t,u,v),[q=0..1,r=0..2,s=0..3,t=0..4,u=0..5,v=0..6])); # Georgios
                          7560.000000

CF:=unapply('cf'(q,r,s,t,u,v),[q,r,s,t,u,v],numeric):
evalf(Int(CF(q,r,s,t,u,v),[q=0..1,r=0..2,s=0..3,t=0..4,u=0..5,v=0..6]));
                          7560.000000

evalf(Int(cf,[0..1,0..2,0..3,0..4,0..5,0..6])); # a pity
Error, (in evalf/int) incompatible dimensions

# The following workaround (to the "pity" above) incurs the cost of an extra
# function call (of which there may be many, for multidimensional integration!).
evalf(Int((q,r,s,t,u,v)-&amp;gt;cf(q,r,s,t,u,v),[0..1,0..2,0..3,0..4,0..5,0..6]));
                          7560.000000
&lt;/pre&gt;
&lt;p&gt;And what's life without a few kludges to make it interesting. Somehow evalf/Int is poking at the operator-form integrand and deciding that it doesn't demand the same number of parameters as there have been supplied numeric ranges of integration. We could try and force the operator-form to work, but without having to wrap it in another (potentially costly) procedure call.&lt;/p&gt;
&lt;pre&gt;newcf := FromInert(subsindets(ToInert(eval(cf)),
                     specfunc(anything,_Inert_PARAMSEQ),
                     t-&amp;gt;op(indets(ToInert(eval(f)),
                                  specfunc(anything,_Inert_PARAMSEQ))))):

evalf(Int(newcf,[0..1,0..2,0..3,0..4,0..5,0..6]));
                          7560.000000
&lt;/pre&gt;
&lt;!--break--&gt;
&lt;p&gt;acer&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;There are three common ways to get around premature evaluation of the arguments.&lt;/p&gt;
&lt;p&gt;One way is to use a procedure which returns unevaluated if the arguments do not satisfy some type requirements, eg. all numeric, say.&lt;/p&gt;
&lt;p&gt;Sometimes creating such a procedure can be made easier, by using the `unapply` command with its 'numeric' option. You may or may not find that helpful here.&lt;/p&gt;
&lt;p&gt;Another way is to use unevaluation quotes, as Georgios suggested. These first two ways involve the expression-form calling sequence, where the variable ranges are each given like name=range(numeric).&lt;/p&gt;
&lt;p&gt;A third way is to use the operator-form calling sequence, for which the various ranges of integration (or fsolving, or plotting, or Optimizing) are just range(numeric) instead of being name=range(numeric). Unfortunately this does not seem to work for the Compiled multivariate proc, unless it is wrapped in yet another proc.&lt;/p&gt;
&lt;pre&gt;f:= proc(kF1, kF2, m, k, omega, q)
      kF1+kF2+m+k+omega+q;
    end proc:

# First, using the original procedure `f`.

evalf(Int('f'(q,r,s,t,u,v),[q=0..1,r=0..2,s=0..3,t=0..4,u=0..5,v=0..6])); # Georgios
                          7560.000000

evalf(Int(f,[0..1,0..2,0..3,0..4,0..5,0..6]));
                          7560.000000

evalf(Int((q,r,s,t,u,v)-&amp;gt;f(q,r,s,t,u,v),[0..1,0..2,0..3,0..4,0..5,0..6]));
                          7560.000000

# Now, using Compiled procedure `cf`.

cf:=Compiler:-Compile(f):

evalf(Int('cf'(q,r,s,t,u,v),[q=0..1,r=0..2,s=0..3,t=0..4,u=0..5,v=0..6])); # Georgios
                          7560.000000

CF:=unapply('cf'(q,r,s,t,u,v),[q,r,s,t,u,v],numeric):
evalf(Int(CF(q,r,s,t,u,v),[q=0..1,r=0..2,s=0..3,t=0..4,u=0..5,v=0..6]));
                          7560.000000

evalf(Int(cf,[0..1,0..2,0..3,0..4,0..5,0..6])); # a pity
Error, (in evalf/int) incompatible dimensions

# The following workaround (to the "pity" above) incurs the cost of an extra
# function call (of which there may be many, for multidimensional integration!).
evalf(Int((q,r,s,t,u,v)-&amp;gt;cf(q,r,s,t,u,v),[0..1,0..2,0..3,0..4,0..5,0..6]));
                          7560.000000
&lt;/pre&gt;
&lt;p&gt;And what's life without a few kludges to make it interesting. Somehow evalf/Int is poking at the operator-form integrand and deciding that it doesn't demand the same number of parameters as there have been supplied numeric ranges of integration. We could try and force the operator-form to work, but without having to wrap it in another (potentially costly) procedure call.&lt;/p&gt;
&lt;pre&gt;newcf := FromInert(subsindets(ToInert(eval(cf)),
                     specfunc(anything,_Inert_PARAMSEQ),
                     t-&amp;gt;op(indets(ToInert(eval(f)),
                                  specfunc(anything,_Inert_PARAMSEQ))))):

evalf(Int(newcf,[0..1,0..2,0..3,0..4,0..5,0..6]));
                          7560.000000
&lt;/pre&gt;
&lt;!--break--&gt;
&lt;p&gt;acer&lt;/p&gt;</description>
      <guid>134992</guid>
      <pubDate>Mon, 11 Jun 2012 06:43:58 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
    <item>
      <title>Thank you</title>
      <link>http://www.mapleprimes.com/questions/134984-How-Do-I-Integrate-Compiled-Function?ref=Feed:MaplePrimes:How do I integrate compiled function?:Comments#comment135009</link>
      <itunes:summary>&lt;p&gt;Thanks! &amp;nbsp;I've tried &amp;nbsp;'f(x,y)' &amp;nbsp; while the correct way is 'f'(x,y)&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Thanks! &amp;nbsp;I've tried &amp;nbsp;'f(x,y)' &amp;nbsp; while the correct way is 'f'(x,y)&lt;/p&gt;</description>
      <guid>135009</guid>
      <pubDate>Mon, 11 Jun 2012 11:41:19 Z</pubDate>
      <itunes:author>slizovskiy</itunes:author>
      <author>slizovskiy</author>
    </item>
    <item>
      <title>Thank you</title>
      <link>http://www.mapleprimes.com/questions/134984-How-Do-I-Integrate-Compiled-Function?ref=Feed:MaplePrimes:How do I integrate compiled function?:Comments#comment135010</link>
      <itunes:summary>&lt;p&gt;thanks, that was very useful!&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;thanks, that was very useful!&lt;/p&gt;</description>
      <guid>135010</guid>
      <pubDate>Mon, 11 Jun 2012 11:43:02 Z</pubDate>
      <itunes:author>slizovskiy</itunes:author>
      <author>slizovskiy</author>
    </item>
  </channel>
</rss>