Newsimp is one file in http://www.cs.berkeley.edu/~fateman/temp/newsimp.cl
The function addk could be changed to make it always return an old-style
maxima rat instead of cl. Here is a suggestion..
(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))
(setf xx (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"))))
;; change for old style
(cond((rationalp xx)(if (= 1 (numerator xx)) xx (list '(rat)(numerator
xx)(denominator xx))))
(t xx)))
If you put newsimp in cvs, that's ok, but note that it breaks some
things. It is not that there are bugs in newsimp doing this, but
programs that expect something particular internal to macsyma expressions
may find hashtables instead of lists.
These places have to be identified.
Using old-style rational numbers may remove some of these "bugs".
RJF
Camm Maguire wrote:
>Greetings! I take it newsimp is not in the 5.9.0 source tree. Can
>anyone please provide an explicit hopefully minimal set of steps to
>reproduce this?
>
>Take care,
>
>Richard Fateman <fateman@cs.berkeley.edu> writes:
>
>
>
>>I seem to have tracked this bug down to a line where
>>(gethash r table 0)
>>returns not -4, but (1 . -4)
>>
>>I am using xmaxima 5.9.0. I wonder if you have tried
>>it in a non-GCL lisp?
>>IF so, does it get the same error?
>>
>>I will try a different lisp if I can get one running
>>here.
>>RJF
>>
>>
>>Andrei Zorine wrote:
>>
>>
>>
>>>hello,
>>>I tried to taylor() with new simplifier loaded. Here's what I get
>>>
>>>(C1) load("c:/src/mac/newsimp/newsimp.cl");
>>>
>>>(D1) c:/src/mac/newsimp/newsimp.cl
>>>(C4) taylor(erf(x),x,0,10);
>>>
>>>
>>>Error: addk given non-constants to add
>>>Fast links are on: do (si::use-fast-links nil) for debugging
>>>Error signalled by COND.
>>>Broken at ERROR. Type :H for Help.
>>>MAXIMA>>:q
>>>
>>>(C5) -1/2;
>>>
>>> 1
>>>(D5) - -
>>> 2
>>>(C6) :lisp(print $d5)
>>>
>>>-1/2
>>>-1/2
>>>
>>>....
>>>
>>>MAXIMA>>(simplifya '((rat) -1 2) t)
>>>
>>>((RAT) -1 2)
>>>MAXIMA>>(simplifya '((rat) -1 2) nil)
>>>
>>>((RAT) -1 2)
>>>MAXIMA>>
>>>
>>>So, where it transform from ((rat)..) to lisp's rational is done??? It's addk recieves ((rat)...)
>>>instead of a number from diffexpt... if I want to load new definition for diffexpt, what should I
>>>write to transform from ((rat)...) to a rational?
>>>--
>>>Andrei Zorine
>>>
>>>
>>>_______________________________________________
>>>Maxima mailing list
>>>Maxima@www.math.utexas.edu
>>>http://www.math.utexas.edu/mailman/listinfo/maxima
>>>
>>>
>>_______________________________________________
>>Maxima mailing list
>>Maxima@www.math.utexas.edu
>>http://www.math.utexas.edu/mailman/listinfo/maxima
>>
>>
>>
>>
>>
>
>
>