About Kronecker's delta symbol under a summation sign




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 */
matchdeclare([aa,bb,cc,dd,gg],true);
tellsimp(msum(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);

/* now test them */
declare(j,integer);
sum(f(i)*kron_delta(i,j),i,3,N);
subst(nounify(sum)=msum,%);
sum(i^2*kron_delta(i,j),i,3,N);
subst(nounify(sum)=msum,%);
assume(N>4,4<j,j<N);
sum(i^2*kron_delta(i,j),i,3,N);
subst(nounify(sum)=msum,%);

I'm sure that others on the list have a more elegant solution.

Leo

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