In current Maxima:
(%i1) ex: if X then 0 else 1;
(%o1) if X then 0 else 1 <<< OK
(%i2) subst(true,X,ex);
(%o2) if true then 0 else 1 <<<
simplification does not result in 0
(%i3) block([X:true],ev(ex));
(%o3) 0 <<<
re-evaluation does result in 0
Is there any good reason that (if true then A else B) doesn't *simplify *to
A?
Consider for that matter:
(%i1) ex: [abs(x), if x<0 then -x else x];
(%o1) [abs(x),if x < 0 then -x else x] <<< OK
(%i2) assume(x<0);
(%o2) [x < 0]
(%i3) expand(ex,0,0);
(%o3) [-x,if x < 0 then -x else x] <<< abs(x) does simplify, but the
equivalent conditional doesn't
Why does resimplifying abs(x) take advantage of the assumption, but
resimplifying IF does not?
I'll be happy to code this up (not very hard!) unless someone sees a
problem with it.
-s