Mercurial > emacs
comparison lisp/calc/calc-alg.el @ 99929:2a48557d7247
(calcFunc-collect): Normalize the coefficients of the
polynomial rather than the whole polynomial.
author | Jay Belanger <jay.p.belanger@gmail.com> |
---|---|
date | Wed, 26 Nov 2008 02:38:39 +0000 |
parents | 91df9fb880c4 |
children | a9dc0e7c3f2b |
comparison
equal
deleted
inserted
replaced
99928:ba6d5a708321 | 99929:2a48557d7247 |
---|---|
1596 ;;; Polynomial operations (to support the integrator and solve-for). | 1596 ;;; Polynomial operations (to support the integrator and solve-for). |
1597 | 1597 |
1598 (defun calcFunc-collect (expr base) | 1598 (defun calcFunc-collect (expr base) |
1599 (let ((p (math-is-polynomial expr base 50 t))) | 1599 (let ((p (math-is-polynomial expr base 50 t))) |
1600 (if (cdr p) | 1600 (if (cdr p) |
1601 (math-normalize ; fix selection bug | 1601 (math-build-polynomial-expr (mapcar 'math-normalize p) base) |
1602 (math-build-polynomial-expr p base)) | |
1603 (car p)))) | 1602 (car p)))) |
1604 | 1603 |
1605 ;;; If expr is of the form "a + bx + cx^2 + ...", return the list (a b c ...), | 1604 ;;; If expr is of the form "a + bx + cx^2 + ...", return the list (a b c ...), |
1606 ;;; else return nil if not in polynomial form. If "loose" (math-is-poly-loose), | 1605 ;;; else return nil if not in polynomial form. If "loose" (math-is-poly-loose), |
1607 ;;; coefficients may contain x, e.g., sin(x) + cos(x) x^2 is a loose polynomial in x. | 1606 ;;; coefficients may contain x, e.g., sin(x) + cos(x) x^2 is a loose polynomial in x. |