Function: math-poly-gcd-base
math-poly-gcd-base is a byte-compiled function defined in
calc-poly.el.gz.
Signature
(math-poly-gcd-base A B)
Documentation
Same as math-poly-div-base(var)/math-poly-div-base(fun) but for gcd algorithm.
Here there is no requirement that degree(a) > degree(b).
Take the base that has the highest degree considering both a and b.
("a^20+b^21+x^3+a+b", "a+b^2+x^5+a^22+b^10") --> (a 22)
Source Code
;; Defined in /usr/src/emacs/lisp/calc/calc-poly.el.gz
(defun math-poly-gcd-base (a b)
"Same as `math-poly-div-base' but for gcd algorithm.
Here there is no requirement that degree(a) > degree(b).
Take the base that has the highest degree considering both a and b.
(\"a^20+b^21+x^3+a+b\", \"a+b^2+x^5+a^22+b^10\") --> (a 22)"
(let (a-base b-base)
(and (setq a-base (math-total-polynomial-base a))
(setq b-base (math-total-polynomial-base b))
(catch 'return
(while (and a-base b-base)
(if (> (nth 1 (car a-base)) (nth 1 (car b-base)))
(if (assoc (car (car a-base)) b-base)
(throw 'return (car (car a-base)))
(setq a-base (cdr a-base)))
(if (assoc (car (car b-base)) a-base)
(throw 'return (car (car b-base)))
(setq b-base (cdr b-base)))))))))