Function: math-poly-pseudo-div
math-poly-pseudo-div is a byte-compiled function defined in
calc-poly.el.gz.
Signature
(math-poly-pseudo-div U V)
Documentation
Perform a pseudo-division of polynomials. (See Knuth section 4.6.1.) This returns only the remainder from the pseudo-division.
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-poly.el.gz
(defun math-poly-pseudo-div (u v)
"Perform a pseudo-division of polynomials. (See Knuth section 4.6.1.)
This returns only the remainder from the pseudo-division."
(cond ((null v) nil)
((< (length u) (length v)) u)
((or (cdr u) (cdr v))
(let ((urev (reverse u))
(vrev (reverse v))
up)
(while
(let ((vp vrev))
(setq up urev)
(while (setq up (cdr up) vp (cdr vp))
(setcar up (math-sub (math-mul-thru (car vrev) (car up))
(math-mul-thru (car urev) (car vp)))))
(setq urev (cdr urev))
up)
(while up
(setcar up (math-mul-thru (car vrev) (car up)))
(setq up (cdr up))))
(while (and urev (Math-zerop (car urev)))
(setq urev (cdr urev)))
(nreverse (mapcar 'math-simplify urev))))
(t nil)))