progress on diff(sum) and sum(kron_delta)



I think I've made some progress on computing derivatives
of sums and sums of kron_delta. It is doubtless possible
to find bugs in this but all the same I think it's an improvement.

I've attached the code. Here is an example session.

(%i1) display2d : false $
(%i2) load ("sum_kron_delta.mac") $
(%i3) load ("diff_sum.mac") $
(%i4) 'sum ('diff ('sum (A[i]*x[i]^2, i, 1, n), x[j]), j, 1, n);
(%o4) 2*'sum(if true then x[j]*A[j] else 0,j,1,n)
(%i5) ''%;
(%o5) 2*'sum(x[j]*A[j],j,1,n)
(%i6) 'diff ('sum (u[k - 1] * u[k] * u[k + 1], k, 1, m), u[l]);
(%o6) 'diff('sum(u[k-1]*u[k]*u[k+1],k,1,m),u[l],1)
(%i7) ''%;
(%o7) 'sum(u[k-1]*u[k]*kron_delta(k+1,l)+u[k-1]*kron_delta(k,l)*u[k+1]
                                        +kron_delta(k-1,l)*u[k]*u[k+1],k,1,m)
(%i8) declare (sum, linear) $
(%i9) ''%o7;
(%o9) (if 1 <= l+1 and l+1 <= m and %elementp(l+1,integers) then u[l+1]*u[l+2]
           else 0)
 +(if 1 <= l and l <= m and %elementp(l,integers) then u[l-1]*u[l+1] else 0)
 +(if 1 <= l-1 and l-1 <= m and %elementp(l-1,integers) then u[l-2]*u[l-1]
       else 0)
(%i10) declare (l, integer);
(%o10) done
(%i11) assume (0 <= l and l <= m + 1) $
(%i12) ''%o7;
(%o12) (if l+1 <= m then u[l+1]*u[l+2] else 0)
 +(if 1 <= l and l <= m then u[l-1]*u[l+1] else 0)
 +(if 1 <= l-1 then u[l-2]*u[l-1] else 0)

I threw in a little bit of stuff for simplifying set operations -- I'm inclined
to think all set operations should be simplifications, but I'll push that
agenda another day.

Thanks to Stavros and Michael Valenzuela and everybody who
has expressed interest in this topic over the past few years.

best

Robert Dodier
-------------- next part --------------
A non-text attachment was scrubbed...
Name: diff_sum.mac
Type: application/octet-stream
Size: 1195 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20130521/7c7af0cb/attachment-0002.obj>;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sum_kron_delta.mac
Type: application/octet-stream
Size: 1894 bytes
Desc: not available
URL: <http://www.math.utexas.edu/pipermail/maxima/attachments/20130521/7c7af0cb/attachment-0003.obj>;