Function: math-build-polynomial-expr
math-build-polynomial-expr is an autoloaded and byte-compiled function
defined in calc-alg.el.gz.
Signature
(math-build-polynomial-expr P VAR)
Documentation
Build an expression from a polynomial list.
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-alg.el.gz
(defun math-build-polynomial-expr (p var)
"Build an expression from a polynomial list."
(if p
(if (Math-numberp var)
(math-with-extra-prec 1
(let* ((rp (reverse p))
(accum (car rp)))
(while (setq rp (cdr rp))
(setq accum (math-add (car rp) (math-mul accum var))))
accum))
(let* ((rp (reverse p))
(n (1- (length rp)))
(accum (math-mul (car rp) (math-pow var n))))
(while (setq rp (cdr rp))
(setq n (1- n))
(or (math-zerop (car rp))
(setq accum (list (if (math-looks-negp (car rp)) '- '+)
accum
(math-mul (if (math-looks-negp (car rp))
(math-neg (car rp))
(car rp))
(math-pow var n))))))
accum))
0))