Function: math-accum-factors

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

Signature

(math-accum-factors FAC POW FACS)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-poly.el.gz
(defun math-accum-factors (fac pow facs)
  (if math-to-list
      (if (math-vectorp fac)
	  (progn
	    (while (setq fac (cdr fac))
	      (setq facs (math-accum-factors (nth 1 (car fac))
					     (* pow (nth 2 (car fac)))
					     facs)))
	    facs)
	(if (and (eq (car-safe fac) '^) (natnump (nth 2 fac)))
	    (setq pow (* pow (nth 2 fac))
		  fac (nth 1 fac)))
	(if (eq fac 1)
	    facs
	  (or (math-vectorp facs)
	      (setq facs (if (eq facs 1) '(vec)
			   (list 'vec (list 'vec facs 1)))))
	  (let ((found facs))
	    (while (and (setq found (cdr found))
			(not (equal fac (nth 1 (car found))))))
	    (if found
		(progn
		  (setcar (cdr (cdr (car found))) (+ pow (nth 2 (car found))))
		  facs)
	      ;; Put constant term first.
	      (if (and (cdr facs) (Math-ratp (nth 1 (nth 1 facs))))
		  (cons 'vec (cons (nth 1 facs) (cons (list 'vec fac pow)
						      (cdr (cdr facs)))))
		(cons 'vec (cons (list 'vec fac pow) (cdr facs))))))))
    (math-mul (math-pow fac pow) (math-factor-protect facs))))