Oh, by the way: The source code comment to maxima-substitute (defined in comm.lisp)
says "The args to SUBSTITUTE are assumed to be simplified." Oops--not only is that
untrue, but maxima-substitute sometimes receives arguments that invalid maxima
expressions; for example
integrate(cos(2*x)*cos(x),x);
....
1> (MAXIMA-SUBSTITUTE (%COS SIMP) B
((MTIMES SIMP)
((MPLUS SIMP)
((MTIMES SIMP) ((RAT SIMP) 1 2) ((%SIN SIMP) $X))
((MTIMES SIMP) ((RAT SIMP) 1 6)
((%SIN SIMP) ((MTIMES SIMP) 3 $X))))
A))
Additionally, the substitution functions maxima-substitute, subst1, and subst2 are
mostly the same, but different. Ugh.
--Barton