I started to look at the newsimp code again, and some traces.
I did not recall that I rewrote the differentiation code too,
but I did. And it seems that there is a bug in sdiffhash,
the way hashtables are differentiated, I think.
I will have to study this.
I suggest a change in addk, adding 2 lines. Changing it back to
the old addk (much longer, doing rational arithmetic), seems like
a bad idea, at least if we can get away with doing CL rationals.
Also, the benefits of newsimp are much higher if the file is compiled!
Here is addk.
(defun addk (xx yy) ;;xx and yy are assumed to be already reduced
(setf xx(if (and (listp xx)(eq (caar xx) 'rat)) (/ (cadr xx)(caddr
xx)) xx))
(setf yy(if (and (listp yy)(eq (caar yy) 'rat)) (/ (cadr yy)(caddr
yy)) yy))
(cond ((equal xx 0) yy)
((equal yy 0) xx)
((and (numberp xx) (numberp yy)) (+ xx yy))
((or ($bfloatp xx) ($bfloatp yy)) ($bfloat (list '(mplus) xx yy)))
(t (error "addk given non-constants to add"))))