About Kronecker's delta symbol under a summation sign




On Mon, 8 Feb 2010, Leo Butler wrote:

< 
< 
< On Mon, 8 Feb 2010, Christophe Pouzat wrote:
< 
< < Dear List,
< < 
< < I apologize in advance for a potentially naive question, but I was not
< < able to find an answer by myself from the documentation and / or from
< < previous posts. So here it is:
< < 
< < When I type:
< < 
< < (%i5) sum(kron_delta(i,j),i, 1,N);
< < 
< < I would like to get the answer:
< < 
< < (%o5) 1
< < 
< < It is assumed here that N is an integer >= 1 and that j is also an
< < integer with 1 <= j <= N. I've tried to make Maxima "aware" of my
< < assumptions with:
< < 
< < (%i1) declare(N,integer)$
< < (%i2) assume(N >= 1)$
< < (%i3) declare(j, integer)$
< < (%i4) assume(j >= 1 and j <= N)$
< < 
< < But that does not seem to be enough...
< < Of course,
< < 
< < (%i6) sum(kron_delta(i,j),i,1,N), N=10, j=5;
< < 
< < works.
< < 
< < Thanks in advance for your time and help,
<  
< Christophe,
< You can see that the sum in question is 1 if 1<=j<=N and j-1 is
< an integer and it is 0 otherwise; this is true regardless of the integrality of N
< and j.
< 
< What I suggest is writing a simplification rule for sum. Unfortunately,
< the outative property of sum makes this troublesome, so one can write
< a simplication rule for some undefined function msum, and then use this:
< 
< /* write the simplification rules */
 
Here is a better idea: prevent Maxima's simplifier from acting while we
define our rule:

matchdeclare([aa,bb,cc,dd,gg],true);
simp:false; /* turn off simplification */
tellsimp('sum(gg*kron_delta(aa,bb),aa,dd,cc), if dd<=bb and bb<=cc and featurep(bb-dd,integer) then subst(aa=bb,gg) else 0);
simp:true;  /* turn it back on */

/* some examples */
declare([b,j],integer);
sum(f(i)*kron_delta(i,j),i,3,N);
assume(N>1,b>1,b<N);
sum(a^y*kron_delta(a,b),a,1,N);

Leo

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.