;; -*- Mode:Common-Lisp;Package:mma; Base:10 -*- (eval-when (compile eval) (load "mma") (load "poly") (in-package :mma)) ;; change definition of make-real in parser.lisp ;; could be to 'single-float if you wish (defun make-real (int frac)(coerce (+ int frac) 'double-float)) ;; in poly.lisp, ;;change one line in definition in p/ (defun p/ (p s) (cond ((coefzerop s) (throw 'p/ (values nil "Division by zero"))) ((coefonep s) p) ((coefzerop p) p) ((coefp p) (cond ((coefp s) (cond ((eql 0 (mod p s))(/ p s)) ;;; add one line to do floats, instead of bombing out ((or (floatp p)(floatp s)) (/ p s)) (t (throw 'p/ (values nil "Inexact integer division"))))) (t (throw 'p/ (values nil "Division by a polynomial of higher degree"))))) ((or (coefp s) (var> (mainvar p) (mainvar s))) (p/vc p s)) ((var> (mainvar s) (mainvar p)) (throw 'p/ (values nil "Division by a polynomial of higher (mainvar v) (mainvar u)) (pcontentxsr v u)) ((var> (mainvar u) (mainvar v)) (pcontentxsr u v)) (t (pgcd2sr u v)))) (defun fcoefonep(x)(and (numberp x) (= x 1))) (defun fintol (f) (let ((c (caar f))); constant term (do ((j (cdr f)(cdr j)) (lis nil)) ((null j) (cond ((null lis) c) ((and (fcoefonep c)(null(cdr lis))) (car lis)) (t (cond ((fcoefonep c) (ucons 'Times (uniq(nreverse lis)))) (t (ucons 'Times(ucons c (uniq (nreverse lis))))))))) ;; the loop body: (setq lis (cons (fintol2 (caar j)(cdar j)) lis)))))