<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, subs command bug?!</title>
    <link>http://www.mapleprimes.com/questions/130529-Subs-Command-Bug</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 16:49:03 GMT</lastBuildDate>
    <pubDate>Tue, 16 Jun 2026 16:49:03 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, subs command bug?!</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, subs command bug?!</title>
      <link>http://www.mapleprimes.com/questions/130529-Subs-Command-Bug</link>
    </image>
    <item>
      <title>rtable_eval</title>
      <link>http://www.mapleprimes.com/questions/130529-Subs-Command-Bug?ref=Feed:MaplePrimes:subs command bug?!:Comments#answer130532</link>
      <itunes:summary>&lt;p&gt;Curiously, something very similar was asked just a day or so ago.&lt;/p&gt;
&lt;pre&gt;&amp;gt; restart:

&amp;gt; b:=Vector([lambda-2, lambda+23]):

&amp;gt; assume(lambda, real);

&amp;gt; subs(lambda=1, b);

                                [lambda~ - 2 ]
                                [            ]
                                [lambda~ + 23]

&amp;gt; eval(b, lambda=1);   
                                [lambda~ - 2 ]
                                [            ]
                                [lambda~ + 23]

&amp;gt; subs(lambda=1, rtable_eval(b));

                                     [-1]
                                     [  ]
                                     [24]

&amp;gt; eval(rtable_eval(b), lambda=1);
                                     [-1]
                                     [  ]
                                     [24]

&amp;gt; rtable_eval(b,inplace): # only need this once

&amp;gt; subs(lambda=1, b);

                                     [-1]
                                     [  ]
                                     [24]

&amp;gt; eval(b, lambda=1);             
                                     [-1]
                                     [  ]
                                     [24]
&lt;/pre&gt;
&lt;!--break--&gt;
&lt;p&gt;acer&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Curiously, something very similar was asked just a day or so ago.&lt;/p&gt;
&lt;pre&gt;&amp;gt; restart:

&amp;gt; b:=Vector([lambda-2, lambda+23]):

&amp;gt; assume(lambda, real);

&amp;gt; subs(lambda=1, b);

                                [lambda~ - 2 ]
                                [            ]
                                [lambda~ + 23]

&amp;gt; eval(b, lambda=1);   
                                [lambda~ - 2 ]
                                [            ]
                                [lambda~ + 23]

&amp;gt; subs(lambda=1, rtable_eval(b));

                                     [-1]
                                     [  ]
                                     [24]

&amp;gt; eval(rtable_eval(b), lambda=1);
                                     [-1]
                                     [  ]
                                     [24]

&amp;gt; rtable_eval(b,inplace): # only need this once

&amp;gt; subs(lambda=1, b);

                                     [-1]
                                     [  ]
                                     [24]

&amp;gt; eval(b, lambda=1);             
                                     [-1]
                                     [  ]
                                     [24]
&lt;/pre&gt;
&lt;!--break--&gt;
&lt;p&gt;acer&lt;/p&gt;</description>
      <guid>130532</guid>
      <pubDate>Fri, 10 Feb 2012 02:36:10 Z</pubDate>
      <itunes:author>acer</itunes:author>
      <author>acer</author>
    </item>
    <item>
      <title>Full/partial evaluation</title>
      <link>http://www.mapleprimes.com/questions/130529-Subs-Command-Bug?ref=Feed:MaplePrimes:subs command bug?!:Comments#answer130536</link>
      <itunes:summary>&lt;p&gt;To better understand this behavior, consider the following&lt;/p&gt;
&lt;pre&gt;proc()&lt;br&gt;local a,v;&lt;br&gt;global g;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a := v;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; g := v;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; assume(v,positive);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; subs(v=1,[a,g,v]);&lt;br&gt;end proc();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [v, 1, 1]&lt;br&gt;&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;The substitution "works" for the global variable, g, but not the local variable, a. The reason for this is that global variables are fully evaluated, while local variables are not, they are evaluated only one level (cf. &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=global)"&gt;?procedure)&lt;/a&gt;. Because &lt;strong&gt;a&lt;/strong&gt; is not fully evaluated, in the &lt;strong&gt;subs&lt;/strong&gt; operation it evaluates to v, which is a different variable than v~. The v's in the call to subs evaluate to v~.&lt;/p&gt;
&lt;p&gt;The same thing is happening with the substitution into a Vector (more generally, an &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=rtable)"&gt;?rtable)&lt;/a&gt; even though you are doing so at top-level (i.e. not inside a proceure).&amp;nbsp; For efficiency, the content of an rtable is not fully evaluated unless you force it to be.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;To better understand this behavior, consider the following&lt;/p&gt;
&lt;pre&gt;proc()&lt;br&gt;local a,v;&lt;br&gt;global g;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; a := v;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; g := v;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; assume(v,positive);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; subs(v=1,[a,g,v]);&lt;br&gt;end proc();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [v, 1, 1]&lt;br&gt;&lt;br&gt;&lt;/pre&gt;
&lt;p&gt;The substitution "works" for the global variable, g, but not the local variable, a. The reason for this is that global variables are fully evaluated, while local variables are not, they are evaluated only one level (cf. &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=global)"&gt;?procedure)&lt;/a&gt;. Because &lt;strong&gt;a&lt;/strong&gt; is not fully evaluated, in the &lt;strong&gt;subs&lt;/strong&gt; operation it evaluates to v, which is a different variable than v~. The v's in the call to subs evaluate to v~.&lt;/p&gt;
&lt;p&gt;The same thing is happening with the substitution into a Vector (more generally, an &lt;a href="http://www.maplesoft.com/support/help/search.aspx?term=rtable)"&gt;?rtable)&lt;/a&gt; even though you are doing so at top-level (i.e. not inside a proceure).&amp;nbsp; For efficiency, the content of an rtable is not fully evaluated unless you force it to be.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <guid>130536</guid>
      <pubDate>Fri, 10 Feb 2012 06:19:33 Z</pubDate>
      <itunes:author>Joe Riel</itunes:author>
      <author>Joe Riel</author>
    </item>
    <item>
      <title>thanks</title>
      <link>http://www.mapleprimes.com/questions/130529-Subs-Command-Bug?ref=Feed:MaplePrimes:subs command bug?!:Comments#comment130534</link>
      <itunes:summary>&lt;p&gt;Thanks for your answer - I missed the previous question.&lt;/p&gt;
&lt;p&gt;Do you consider this a desirable behavior (the need to set an "inplace" flag if one of the variables has assumptions set)? I would personally prefer the substitution behavior to be the same regardlsess of the assumptions. &lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Thanks for your answer - I missed the previous question.&lt;/p&gt;
&lt;p&gt;Do you consider this a desirable behavior (the need to set an "inplace" flag if one of the variables has assumptions set)? I would personally prefer the substitution behavior to be the same regardlsess of the assumptions. &lt;/p&gt;</description>
      <guid>130534</guid>
      <pubDate>Fri, 10 Feb 2012 03:06:19 Z</pubDate>
      <itunes:author>itsme</itunes:author>
      <author>itsme</author>
    </item>
    <item>
      <title>thanks</title>
      <link>http://www.mapleprimes.com/questions/130529-Subs-Command-Bug?ref=Feed:MaplePrimes:subs command bug?!:Comments#comment130538</link>
      <itunes:summary>&lt;p&gt;i see! Thanks for taking the time to explain.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It might be useful to at some stage include this behavior as a "gotcha" in the 'subs' (or 'assume') help page - just a trivial example would probably be helpful.&amp;nbsp;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;i see! Thanks for taking the time to explain.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It might be useful to at some stage include this behavior as a "gotcha" in the 'subs' (or 'assume') help page - just a trivial example would probably be helpful.&amp;nbsp;&lt;/p&gt;</description>
      <guid>130538</guid>
      <pubDate>Fri, 10 Feb 2012 07:00:22 Z</pubDate>
      <itunes:author>itsme</itunes:author>
      <author>itsme</author>
    </item>
    <item>
      <title>rtable_eval</title>
      <link>http://www.mapleprimes.com/questions/130529-Subs-Command-Bug?ref=Feed:MaplePrimes:subs command bug?!:Comments#comment130541</link>
      <itunes:summary>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/130529-Subs-Command-Bug#comment130538"&gt;@itsme&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/130433-Sequence-Of-Matrices#comment130443"&gt;Here&lt;/a&gt; is an Answer to the similar question of a few days ago. It illustrates that the issue is about evaluation rules for rtables, and not about assumptions.&lt;/p&gt;
&lt;p&gt;So, if there were to be some extra Help examples, they would be better placed on pages like &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=subs' target='_new'&gt;?subs&lt;/a&gt; or &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=eval' target='_new'&gt;?eval&lt;/a&gt; or &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=Vector' target='_new'&gt;?Vector&lt;/a&gt; than they would on &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=assume' target='_new'&gt;?assume&lt;/a&gt;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/130529-Subs-Command-Bug#comment130538"&gt;@itsme&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.mapleprimes.com/questions/130433-Sequence-Of-Matrices#comment130443"&gt;Here&lt;/a&gt; is an Answer to the similar question of a few days ago. It illustrates that the issue is about evaluation rules for rtables, and not about assumptions.&lt;/p&gt;
&lt;p&gt;So, if there were to be some extra Help examples, they would be better placed on pages like &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=subs' target='_new'&gt;?subs&lt;/a&gt; or &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=eval' target='_new'&gt;?eval&lt;/a&gt; or &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=Vector' target='_new'&gt;?Vector&lt;/a&gt; than they would on &lt;a href='http://www.maplesoft.com/support/help/search.aspx?term=assume' target='_new'&gt;?assume&lt;/a&gt;&lt;/p&gt;</description>
      <guid>130541</guid>
      <pubDate>Fri, 10 Feb 2012 09:20:49 Z</pubDate>
      <itunes:author>pagan</itunes:author>
      <author>pagan</author>
    </item>
  </channel>
</rss>