Changeset 989
- Timestamp:
- 2015-06-09T20:51:31-07:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/polynomial.lisp
r988 r989 240 240 0)) 241 241 242 (defun poly-eval (ring expr vars &optional (list-marker '[)) 243 (labels ((p-eval (arg) (poly-eval ring arg vars)) 242 (defun poly-eval (ring-and-order expr vars &optional (list-marker '[) 243 &aux (ring (ro-ring ring-and-order))) 244 (labels ((p-eval (arg) (poly-eval ring-and-order arg vars)) 244 245 (p-eval-list (args) (mapcar #'p-eval args)) 245 (p-add (x y) (poly-add ring x y)))246 (p-add (x y) (poly-add ring-and-order x y))) 246 247 (cond 247 248 ((eql expr 0) (make-poly-zero)) … … 259 260 (1 (make-poly-zero)) 260 261 (2 (poly-uminus ring (p-eval (cadr expr)))) 261 (3 (poly-sub ring (p-eval (cadr expr)) (p-eval (caddr expr))))262 (otherwise (poly-sub ring (p-eval (cadr expr))262 (3 (poly-sub ring-and-order (p-eval (cadr expr)) (p-eval (caddr expr)))) 263 (otherwise (poly-sub ring-and-order (p-eval (cadr expr)) 263 264 (reduce #'p-add (p-eval-list (cddr expr))))))) 264 265 (* 265 266 (if (endp (cddr expr)) ;unary 266 267 (p-eval (cdr expr)) 267 (reduce #'(lambda (p q) (poly-mul ring p q)) (p-eval-list (cdr expr)))))268 (reduce #'(lambda (p q) (poly-mul ring-and-order p q)) (p-eval-list (cdr expr))))) 268 269 (expt 269 270 (cond … … 276 277 ;; Non-integer power means non-polynomial coefficient 277 278 (coerce-coeff ring expr vars)) 278 (t (poly-expt ring (p-eval (cadr expr)) (caddr expr)))))279 (t (poly-expt ring-and-order (p-eval (cadr expr)) (caddr expr))))) 279 280 (otherwise 280 281 (coerce-coeff ring expr vars)))))))
Note:
See TracChangeset
for help on using the changeset viewer.