Question: How to include constant variables in summation and substitute them

Dear all,

I'm trying to substitute a combination of variables in an equation that is partly covered in a summation.

For example consider the equation with two variables A and B, and two function W(t) and q(z):

eq1:=A*B*(sum(W[n](t)*q[n](z), n))

now I want to do the substitution:

algsubs(A*W[n](t) = 5, eq1)

I would very much like to get the following result where the substitution is actually carried out (the result may also be included in the summation).

eq1 := 5*B*(sum(q[n](z), n))

I just can't get this to work. What might get it to work is a function that includes all the variables multiplied with the summation in the summation, however I couldn't find one that does this.

Can anyone help? Thanks! 

Please Wait...