I have a code which gives this kind of output :
W = Sum[v[j]*b[j], {j, 1, 3}];
AA = (v[1]*b[1] + v[2]*b[2] + v[3]*b[3])*2 + 3 ;
I know that if i want to substitute, for example, v[1] with 2 I have to do:
AA = (v[1]*b[1] + v[2]*b[2] + v[3]*b[3])*2 + 3 /. v[1] -> 2
But if i want to substitute the expression of W
how should i do? Because if i do this:
W = Sum[v[j]*b[j], {j, 1, 3}];
AA = (v[1]*b[1] + v[2]*b[2] + v[3]*b[3])*2 + 3 /.
W -> (b[1] v[1] + b[2] v[2] + b[3] v[3])
I unfortunately obtain:
3 + 2 (b[1] v[1] + b[2] v[2] + b[3] v[3])
Please help me.