Intelligent approach for differentiation through sums?



There are two parts to this email.

(1) A progress update
(2) Future directions / questions to avoid reinventing the wheel a sixth
time.

---Progress update---
I think I will keep my approach to simply to apply Kroncker delta functions
to the sums when there is an indexed variable and offload the rest of the
problem to the diff routine.

I have a large bit of code for working with Kronecker delta functions in
sums. I found two small pieces of coding floating around this mailing list
I was able to augment and correct. For instance, Barton from this mailing
list provided some code for simplifying products of kronecker functions,
but it fail to give the correct result on expressions such as kron_delta(a,b)
* kron_delta(c,d). So I extended it to work correctly and take advantage of
the fact the kronecker delta function in Maxima is nary.

Rules and methods I have so far include:
(1) Extensions to Leo's msum
  (a) Extended to work for msums with kron_deltas of 5 variables (not sure
how to extend to this nary)
  (b) Extended to break apart msums on addition to allow the other msum
rules to work more frequently.
(2) expand/contract kron_deltas originally by Barton
  (a) Conversion to and from n-ary kronecker delta <--> corresponding
product of binary kronecker deltas
  (b) Fixed the bug mentioned above.

---Future directions---
(1) Simplify products of identical sums. Please let me know if there is
already a way
  (sum(x[i],i,1,N))*(sum(x[j],j,1,N))*sum(x[k],k,1,N) --->
  (sum(x[i],i,1,N))^3
(2) Begin the "diffthru" method
  (a) ChainRule : diffthru( f(sums of x[i]), w.r.t x[j] ) --> diff( f(sums
of x[i]), w.r.t sums of x[i]) * diffthru( sums of x[i], w.r.t. x[j])
  (b) Basic Assumption : diffthru( msum( f(x[i])), w.r.t. x[j] ) --> msum(
diff(f(x[i], x[i]) * kron_delta(i,j) )
  (c) Lazy vs "Correct" modes. Basically provide an easy to use mode and a
mode which is more rigorous:
    (c_i) Lazy mode : Shown above
    (c_ii) "Correct" mode : diffthru( msum( f(x[i]), i, A, B), x[j] ) -->
if( (A<=j) and (j<=B) and ((j-A) is interger) and (A not minf) and (B not
inf) ) then msum( diff(f(x[i], x[i]) * kron_delta(i,j), i, A, B) else 0
(3) Code cleanup, Code comments, submission of code.


---Final comments---
If anyone wants what I already have, please email me and I'll distribute my
code. I would appreciate help, but I doubt anyone actually has time for it.






On Wed, Feb 20, 2013 at 11:13 AM, Robert Dodier <robert.dodier at gmail.com>wrote:

> On 2013-02-19, Mike Valenzuela <mickle.mouse at gmail.com> wrote:
>
> > I am trying to figure out how to implement some rules that will allow
> > differentiation under (finite) sums.
>
> I think tellsimp is a workable approach. The hard part is probably
> convincing Maxima not to simplify diff(foo, bar) --> 0 when foo doesn't
> explicitly depend on bar. You might try stating rules for, say, mydiff
> instead of diff (i.e. you control all the rules and there are no
> built-ins) and then simplifying or substituting mydiff --> diff at the
> end. I am interested in problems like this but unfortunately I may not
> have much time to devote to it. Keep me posted all the same.
>
> best
>
> Robert Dodier
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>