Question: expanding expression using algsubs

Given this

z := -d*(y+a)+a;

and say we want to replace  a-a*d by c  so that the result is  c - d*y, but this does not work:

algsubs((a-a*d)=c,z);

since Maple does not "see" the d*a expression as it is not expanded yet.  Only when writing this it works:

algsubs((a-a*d)=c,expand(z));

At first I thought since this is an "algebraic" substitution, then Maple will figure it out on its own. But it seems that the expression being substititued has to explicity show there for it to work? Looking it help, it says

"Like subs, it does not expand products or powers before substitution"

So my question is: Is the rule of thumb when using algsubs, is to always expand the expression as in the above example?

Is there another Maple command or a package, which would have found this substition on its own? (i.e. without expanding first)

 

 

 

 

Please Wait...