Changeset 1010 for branches/f4grobner/parse.lisp
- Timestamp:
- 2015-06-10T06:36:01-07:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/f4grobner/parse.lisp
r1009 r1010 284 284 (otherwise 285 285 (let ((r (mapcar 286 #'(lambda (e) (poly-eval-1 e vars order ring))286 #'(lambda (e) (poly-eval-1 ring-and-order e vars)) 287 287 (cdr expr)))) 288 288 (ecase (car expr) 289 (+ (reduce #'(lambda (p q) ($poly+ p q n order ring)) r))289 (+ (reduce #'(lambda (p q) ($poly+ ring-and-order p q n)) r)) 290 290 (- 291 291 (if (endp (cdr r)) 292 ($minus-poly (car r) n ring)293 ($poly- (car r)294 ( reduce #'(lambda (p q) ($poly+ p q n order ring)) (cdr r))295 n296 order ring)))292 ($minus-poly ring (car r) n) 293 ($poly- ring-and-order 294 (car r) 295 (reduce #'(lambda (p q) ($poly+ ring-and-order p q n)) (cdr r)) 296 n))) 297 297 (* 298 (reduce #'(lambda (p q) ($poly* p q n order ring)) r))298 (reduce #'(lambda (p q) ($poly* ring-and-order p q n)) r)) 299 299 ))))))) 300 300 301 301 302 (defun poly-eval (expr vars &optional (order #'lex>) (ring *coefficient-ring*)) 302 (defun poly-eval (expr vars 303 &optional (order #'lex>) (ring *coefficient-ring*) 304 &aux 305 (ring-and-order (make-ring-and-order ring order))) 303 306 "Evaluate an expression EXPR, which should be a polynomial 304 307 expression or a list of polynomial expressions (a list of expressions … … 312 315 ((numberp expr) 313 316 (unless (zerop expr) 314 (list (cons (make-list (length vars) :initial-element 0) expr)))) 317 (make-poly-from-termlist 318 (list (make-term (make-monom :dimension (length vars)) expr))))) 315 319 ((or (symbolp expr) (not (eq (car expr) :[))) 316 (poly-eval-1 expr vars order ring))317 (t (cons '[ (mapcar #'(lambda (p) (poly-eval-1 p vars order ring)) (rest expr))))))320 (poly-eval-1 ring-and-order expr vars)) 321 (t (cons '[ (mapcar #'(lambda (p) (poly-eval-1 ring-and-order p vars)) (rest expr)))))) 318 322 319 323
Note:
See TracChangeset
for help on using the changeset viewer.