(%i1) (x:a,a:b,b:c,c:d,d:e)$
OK:
(%i2) substitute('cos = lambda([w],1-w^2/2), cos(x));
(%o2) 1-a^2/2
Not OK:
(%i3) f : substitute([li[2] = lambda([w],w+w^2/4)], li[2](x));
(%o3) lambda([w],w+w^2/4)(a)
Try ev as a workaround:
(%i4) ev(f,lambda);
(%o4) b^2/4+b
But I wanted a^2/4+a, not b^2/4+b. Try noeval
(%i5) ev(f, lambda,noeval);
(%o5) lambda([w],w+w^2/4)(a)
Is this a substitute bug? This function sublis is controlled by an option variable sublis_apply_lambda, but
the user documentation for subst doesn't mention a similar option variable for subst.
--Barton