Question: Invalid substitution simplification?

I want to simplify the following expression to 2a-2bk+k(n+6). But the following command is invalid.

algsubs(n2+n1=n+6,a+(n1-b)*k+a+(n2-b)*k);

 

However, the above expression can be simplified when k is fixed to a number, such as k=2.

algsubs(n2+n1=n+6,a+(n1-b)*2+a+(n2-b)*2);

I wonder what went wrong.

It seems to be recognized only if n1+ n2 is combined.

algsubs(n1+n2=n+6,simplify(a+(n1-b)*k+a+(n2-b)*k))

Please Wait...