Commit 18e50b48 authored by Jay Belanger's avatar Jay Belanger
Browse files

(calcFunc-apart): Improve test for rational functions.

parent eec86b01
2009-01-24 Jay Belanger <jay.p.belanger@gmail.com>
* calc/calc-poly.el (calcFunc-apart): Improve test for
rational functions.
2009-01-23 Chong Yidong <cyd@stupidchicken.com>
* mail/rmailsum.el (rmail-summary-by-labels): Correctly handle
......
......@@ -961,22 +961,24 @@
((eq (car expr) '-)
(math-sub (calcFunc-apart (nth 1 expr) var)
(calcFunc-apart (nth 2 expr) var)))
((not (math-ratpoly-p expr var))
(math-reject-arg expr "Expected a rational function"))
((and var (not (math-ratpoly-p expr var)))
(math-reject-arg expr "Expected a rational function"))
(t
(let* ((calc-prefer-frac t)
(rat (math-to-ratpoly expr))
(num (car rat))
(den (cdr rat))
(qr (math-poly-div num den))
(q (car qr))
(r (cdr qr)))
(or var
(setq var (math-polynomial-base den)))
(math-add q (or (and var
(math-expr-contains den var)
(math-partial-fractions r den var))
(math-div r den)))))))
(let* ((calc-prefer-frac t)
(rat (math-to-ratpoly expr))
(num (car rat))
(den (cdr rat)))
(or var
(setq var (math-polynomial-base den)))
(if (not (math-ratpoly-p expr var))
(math-reject-arg expr "Expected a rational function")
(let* ((qr (math-poly-div num den))
(q (car qr))
(r (cdr qr)))
(math-add q (or (and var
(math-expr-contains den var)
(math-partial-fractions r den var))
(math-div r den)))))))))
(defun math-padded-polynomial (expr var deg)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment