There may be other things wrong, but your rules
match ki*kj
but do NOT match a*ki*kj.
you must match the arbitrary multiplier a as well.
I suggest you look at letrules, which may do your work better.
You also do not require that i, j, l are different.
Another possibility is that you run through all the values
for i:1 thru 3 do for j:1 through 3 do ....
exp1:ratsubst(D([i,j])..., k([i])*k([j)],exp1)
RJF
Valerij Pipin wrote:
> Greetings to All!
>
> I tried to use some table's defined rules for averaging of wave vectors.
> The problem that apply1,2 or applyb1,2 reject to work if expression is consisted from
> more than one wave vector together with others vectors or tensors. However, for expression consisted from pure k-vector's product everething is ok. Below is part of code.
>
> DEFCON(k,k,w);
>
> matchdeclare([i,j,l],true);
> DEFRULE (k1, k([i]), t*e([i]));
> DEFRULE (k2, k([i])*k([j]), D([i,j])*(1-t^2)/2-e([i])*e([j])*(1-3*t^2)/2);
> DEFRULE (k3, k([i])*k([j])*k([l]),t*(1-t^2)/2*(D([i,j])*e([l])+D([i,l])*e([j])+D([l,j])*e([i]))
> + t/2*(3-5*t^2)*e([i])*e([j])*e([l]));
> exp1 : -a*t*B([],[a])*gr([a])*k([i])+ a*t*B([],[n])*gr([],[m])*k([n])*k([i])*k([m])$
> ;;;; So apply1(exp1,k3,k1) dont work !
> ;;;; apply1(exp1,k1) work but result is wrong!
> ;;;; however apply1(k([n])*k([i])*k([m]),k3) works fine
>
>
> The tensor for averaging can be quite huge. Whether I have to edit its expression and substitute all k-products by apply1(k([i])*k([j])*....., kn) or there is a way around?
> The simple command apply1(exp1, kn,.....,k1) whoud be preferable.
>
> Many thanks for any ideas and help
>
>
> All the best,
> Valerij
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>