Function: math-poly-simplify

math-poly-simplify is an autoloaded and byte-compiled function defined in calc-alg.el.gz.

Signature

(math-poly-simplify P)

Documentation

Simplify a polynomial in list form by stripping off high-end zeros.

This always leaves the constant part, i.e., nil->nil and non-nil->non-nil.

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-alg.el.gz
(defun math-poly-simplify (p)
  "Simplify a polynomial in list form by stripping off high-end zeros.
This always leaves the constant part, i.e., nil->nil and non-nil->non-nil."
  (and p
       (if (Math-zerop (nth (1- (length p)) p))
	   (let ((pp (copy-sequence p)))
	     (while (and (cdr pp)
			 (Math-zerop (nth (1- (length pp)) pp)))
	       (setcdr (nthcdr (- (length pp) 2) pp) nil))
	     pp)
	 p)))