Rational Numbers, was Re: [Maxima-commits] CVS: maxima/src gamma.lisp, 1.44, 1.45.



Am Mittwoch, den 18.11.2009, 08:46 -0800 schrieb Richard Fateman:

> It probably has to be done in one gulp.  Also look for occurrences of 
> (numerator ..)  (denominator ...)
> or similar accessors. And let's hope that no one uses  (cadr <ratnum>) 
> to get the numerator etc.

I think the last point is the main problem. Here are some example of
code:

in bessel.lisp:

(defun max-numeric-ratio-p (e den)
  (if (and (listp e)
	   (eq 'rat (caar e))
	   (= den (third e))
	   (integerp (second e)))
      (/ (second e) (third e))
      nil))

in nforma.lisp:
((eq 'rat (caar form))
 (cond ((minusp (cadr form))
        (list '(mminus) (list '(rat) (- (cadr form)) (caddr form))))
       (t (cons '(rat) (cdr form)))))

in nisimp.lisp:
((eq 'rat (caar listpower))
 (setq p (cadr listpower) q (caddr listpower)))

in rpart.lisp:
((and (listp (cadr exp))
      (eq 'rat (caaadr exp))) ;5/2*%pi
 (mul (list* '(rat simp)
 ...

in trigi.lisp:
((eq 'rat (caar form)) (cons 0 form))

I have counted about 75 checks for 'RAT and manipulation of the CADR and
the CADDR of an rational expression. I might have overseen some code.

Dieter Kaiser