Function: math-poly-div-rec

math-poly-div-rec is a byte-compiled function defined in calc-poly.el.gz.

Signature

(math-poly-div-rec U V)

Source Code

;; Defined in /usr/src/emacs/lisp/calc/calc-poly.el.gz
(defun math-poly-div-rec (u v)
  (cond ((math-constp u)
	 (math-div u v))
	((math-constp v)
	 (if (eq v 1)
	     u
	   (if (memq (car-safe u) '(+ -))
	       (math-add-or-sub (math-poly-div-rec (nth 1 u) v)
				(math-poly-div-rec (nth 2 u) v)
				nil (eq (car u) '-))
	     (math-div u v))))
	((Math-equal u v) math-poly-modulus)
	((and (math-atomic-factorp u) (math-atomic-factorp v))
	 (math-simplify (math-div u v)))
	(math-poly-div-base
	 (math-div u v))
	(t
	 (let ((base (math-poly-div-base u v))
	       vp up res)
	   (if (or (null base)
		   (null (setq vp (math-is-polynomial v base nil 'gen))))
	       (math-div u v)
	     (setq up (math-is-polynomial u base nil 'gen)
		   res (math-poly-div-coefs up vp))
	     (math-add (math-build-polynomial-expr (car res) base)
		       (math-div (math-build-polynomial-expr (cdr res) base)
				 v)))))))