Closed fjames86 closed 11 years ago
correction: (project-powers
fixing project-powers in the way above by adding a degree check (if (and (null target-vars) (zerop (reduce #'+ source-powers))) (list 0) (nreverse (rec source-vars source-powers nil))))) Fixes the above issue and is consistent with the docoeffs hack, i.e. setting the powers list of a null variable poly to '((0))
done
adding a polynomial of degree 0 (nil vars) doesn't work correctly
(fpoly-add (make-fpoly nil 0 '(1)) (make-fpoly 'x 2 '(1 1 1)))
<FPOLY :VARS (X) :DEGREE 2 :COEFFS #(1 1 1)>
I.e. it doesn't add the 0 coeff (for the constant). Comes in from merge-powers which returns NIL on (merge-powers '(X) '(0) NIL) Probably we shouldn't allow polynomials of degree 0 (i.e. constants) and just cast them to numbers but unfortunately doing this creates problems elsewhere.