> Unfortunately I seem to be running into a little problem. subst appears
> not to remove the simp flag from an expression.
subst *does* resimplify any parts of the expression it has changed.
It does *not* resimplify other parts of the expression. For example:
expr: abs(x)+abs(b)$
assume(a>0,b>0)$
subst(a,x,expr) => abs(b)+a /* resimplifies abs(a) but
not abs(b) */
Unfortunately, there is a little glitch/bug in this optimization....
subst(b,b,expr) => abs(x)+abs(b)
Subst notices that the result of substituting is the same as the
input, so doesn't resimplify.
You can construct more perverse examples of this (where checking for
subst(x,x,...) won't suffice), e.g.
resimplify(ex):=expand(ex,0,0)
expr: sin(2*min(x,-x))$
trigexpand:true$ a simplification flag
resimplify(expr) => 2*cos(min(-x,x))*sin(min(-x,x)) OK
subst(-x,x,expr) => sin(2*min(-x,x)) didn't
resimplify because subexpr is unchanged
I wonder if instead of checking whether the result is the same as the
input, it should instead check whether any substitutions have been
performed in the subexpression? Not a very common or prominent case,
but....
-s