maxima-bounces at math.utexas.edu wrote on 06/08/2011 08:55:11 AM:
> Other useful simplifications for kron_delta include:
>
> kron_delta(i,j)*kron_delta(i,k) =>
kron_delta(i,j)*kron_delta(i,k)*kron_delta(j,k)
To apply this rule, try something similar to (substitution for "*" by a
lambda form is
a trick that is worth knowing):
(%i1) crunch_kron(e) := subst("*" = lambda([[s]],
block([r : [], p : 1],
for sk in s do (
if mapatom(sk) then p : p * sk
else if op(sk)='kron_delta then r : append(args(sk),r)
else p : p * sk),
p * apply('xkron_delta, r))),e)$
(%i2) load('simplifying)$
(%i3) simp_xkron_delta([e]) := (
e : setify(e),
xreduce("*", map(lambda([s], apply('kron_delta, s)),
cartesian_product(e,e))))$
(%i4) simplifying(xkron_delta, simp_xkron_delta)$
(%i5) crunch_kron(z + f(kron_delta(a,4) * kron_delta(a,b)));
(%o5) z+f(kron_delta(4,a)*kron_delta(4,b)*kron_delta(a,b))
(%i6) subst(b=5,%);
(%o6) z+f(0)
The function simp_xkron_delta is inefficient--the kron_delta function
should be extended to (efficiently)
accept n arguments.
--Barton