<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, Change of variable in a sum</title>
    <link>http://www.mapleprimes.com/questions/38303-Change-Of-Variable-In-A-Sum</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Sat, 13 Jun 2026 20:08:44 GMT</lastBuildDate>
    <pubDate>Sat, 13 Jun 2026 20:08:44 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, Change of variable in a sum</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, Change of variable in a sum</title>
      <link>http://www.mapleprimes.com/questions/38303-Change-Of-Variable-In-A-Sum</link>
    </image>
    <item>
      <title>Summation by parts</title>
      <link>http://www.mapleprimes.com/questions/38303-Change-Of-Variable-In-A-Sum?ref=Feed:MaplePrimes:Change of variable in a sum:Comments#answer68722</link>
      <itunes:summary>&lt;p&gt;Unfortunately, Maple does not have good facilities for low-level manipulation of sums.&amp;nbsp; The sumtools or SumTools package would seem to be good places for these (analogous to IntegrationTools), but these are dedicated to sophisticated methods for finding closed-form summations.&amp;nbsp; Well, here's a first attempt at writing a procedure for this.&amp;nbsp; By the way, your rewriting is not quite right: it would require S(0) = 0 (try it for N=1).&amp;nbsp; The procedure below corrects that.&lt;/p&gt;
&lt;pre&gt;
SumByParts:= proc(E::Sum(algebraic,name=range), S::algebraic)
&amp;nbsp;&amp;nbsp; local M,q,v,x,a,b,k;
&amp;nbsp;&amp;nbsp; if op(0,E) = 'sum' then return Parts(Sum(op(E)),S) end if; 
&amp;nbsp;&amp;nbsp; if not typematch(E, 
       Sum(q::algebraic,x::name=a::algebraic..b::algebraic),'M')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then error &amp;quot;Wrong type&amp;quot; end if;
&amp;nbsp;&amp;nbsp; assign(M);
&amp;nbsp;&amp;nbsp; if type(q,`*`) and member(S,[op(q)]) then v:= q/S
&amp;nbsp;&amp;nbsp; else v:= normal(q/S) 
&amp;nbsp;&amp;nbsp; end if;
&amp;nbsp;&amp;nbsp; Sum((S - eval(S,x=x-1))*sum(eval(v,x=k),k=x..b) 
        + eval(S,x=a-1)*v,x=a..b)
&amp;nbsp;&amp;nbsp; end proc;
&amp;nbsp;&lt;/pre&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;pre&gt;
&amp;gt; Q:= Sum((a(j+1)-a(j))*j,j=1..N);
&amp;nbsp; SumByParts(Q, j);
&amp;nbsp;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;maple&gt;Sum(a(N+1)-a(j),j = 1 .. N)&lt;/maple&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Unfortunately, Maple does not have good facilities for low-level manipulation of sums.&amp;nbsp; The sumtools or SumTools package would seem to be good places for these (analogous to IntegrationTools), but these are dedicated to sophisticated methods for finding closed-form summations.&amp;nbsp; Well, here's a first attempt at writing a procedure for this.&amp;nbsp; By the way, your rewriting is not quite right: it would require S(0) = 0 (try it for N=1).&amp;nbsp; The procedure below corrects that.&lt;/p&gt;
&lt;pre&gt;
SumByParts:= proc(E::Sum(algebraic,name=range), S::algebraic)
&amp;nbsp;&amp;nbsp; local M,q,v,x,a,b,k;
&amp;nbsp;&amp;nbsp; if op(0,E) = 'sum' then return Parts(Sum(op(E)),S) end if; 
&amp;nbsp;&amp;nbsp; if not typematch(E, 
       Sum(q::algebraic,x::name=a::algebraic..b::algebraic),'M')
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; then error &amp;quot;Wrong type&amp;quot; end if;
&amp;nbsp;&amp;nbsp; assign(M);
&amp;nbsp;&amp;nbsp; if type(q,`*`) and member(S,[op(q)]) then v:= q/S
&amp;nbsp;&amp;nbsp; else v:= normal(q/S) 
&amp;nbsp;&amp;nbsp; end if;
&amp;nbsp;&amp;nbsp; Sum((S - eval(S,x=x-1))*sum(eval(v,x=k),k=x..b) 
        + eval(S,x=a-1)*v,x=a..b)
&amp;nbsp;&amp;nbsp; end proc;
&amp;nbsp;&lt;/pre&gt;
&lt;p&gt;For example:&lt;/p&gt;
&lt;pre&gt;
&amp;gt; Q:= Sum((a(j+1)-a(j))*j,j=1..N);
&amp;nbsp; SumByParts(Q, j);
&amp;nbsp;&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;maple&gt;Sum(a(N+1)-a(j),j = 1 .. N)&lt;/maple&gt;&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <guid>68722</guid>
      <pubDate>Mon, 24 Nov 2008 01:28:14 Z</pubDate>
      <itunes:author>Robert Israel</itunes:author>
      <author>Robert Israel</author>
    </item>
    <item>
      <title>hm ...</title>
      <link>http://www.mapleprimes.com/questions/38303-Change-Of-Variable-In-A-Sum?ref=Feed:MaplePrimes:Change of variable in a sum:Comments#comment82495</link>
      <itunes:summary>&lt;p&gt;That does not work for, for your example I get &amp;quot;Error, (in Sum) Usage: Sum(expr,name) or Sum(expr,name=a..b) or Sum(expr,name=RootOf(...))&amp;quot;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;That does not work for, for your example I get &amp;quot;Error, (in Sum) Usage: Sum(expr,name) or Sum(expr,name=a..b) or Sum(expr,name=RootOf(...))&amp;quot;&lt;/p&gt;</description>
      <guid>82495</guid>
      <pubDate>Tue, 25 Nov 2008 23:29:20 Z</pubDate>
      <itunes:author>Axel Vogt</itunes:author>
      <author>Axel Vogt</author>
    </item>
    <item>
      <title>Sum</title>
      <link>http://www.mapleprimes.com/questions/38303-Change-Of-Variable-In-A-Sum?ref=Feed:MaplePrimes:Change of variable in a sum:Comments#comment87558</link>
      <itunes:summary>&lt;p&gt;Hmm... Did you by any chance have the &lt;b&gt;student&lt;/b&gt; package loaded, or some other package that defines &lt;b&gt;Sum&lt;/b&gt; ?&amp;nbsp;&amp;nbsp; &lt;br /&gt;
Normally &lt;b&gt;Sum&lt;/b&gt; is not a defined procedure, so that error message couldn't occur.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Hmm... Did you by any chance have the &lt;b&gt;student&lt;/b&gt; package loaded, or some other package that defines &lt;b&gt;Sum&lt;/b&gt; ?&amp;nbsp;&amp;nbsp; &lt;br /&gt;
Normally &lt;b&gt;Sum&lt;/b&gt; is not a defined procedure, so that error message couldn't occur.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description>
      <guid>87558</guid>
      <pubDate>Wed, 26 Nov 2008 07:49:30 Z</pubDate>
      <itunes:author>Robert Israel</itunes:author>
      <author>Robert Israel</author>
    </item>
    <item>
      <title>aha ...</title>
      <link>http://www.mapleprimes.com/questions/38303-Change-Of-Variable-In-A-Sum?ref=Feed:MaplePrimes:Change of variable in a sum:Comments#comment87559</link>
      <itunes:summary>&lt;p&gt;Thank you: yes, I have it loaded for handy use of 'changevar' and will try again tonight without that&lt;/p&gt;
&lt;p&gt;&lt;u&gt;Edited&lt;/u&gt;: yes, not loading that package makes it work for me as well.&lt;/p&gt;</itunes:summary>
      <description>&lt;p&gt;Thank you: yes, I have it loaded for handy use of 'changevar' and will try again tonight without that&lt;/p&gt;
&lt;p&gt;&lt;u&gt;Edited&lt;/u&gt;: yes, not loading that package makes it work for me as well.&lt;/p&gt;</description>
      <guid>87559</guid>
      <pubDate>Thu, 27 Nov 2008 00:16:27 Z</pubDate>
      <itunes:author>Axel Vogt</itunes:author>
      <author>Axel Vogt</author>
    </item>
  </channel>
</rss>