|
|
@@ -89,9 +89,11 @@
|
|
89
|
89
|
(term-addition (car poly) y))
|
|
90
|
90
|
(cdr poly)) (car poly))))))))
|
|
91
|
91
|
|
|
|
92
|
+;; Map a single polynomial onto each term of another polynomial
|
|
92
|
93
|
(defun map-onto-poly (single-poly poly)
|
|
93
|
94
|
(map 'list #'(lambda (x) (multiply-singles single-poly x)) poly))
|
|
94
|
95
|
|
|
|
96
|
+;; Multiply two singular polynomials together
|
|
95
|
97
|
(defun multiply-singles (single-poly1 single-poly2)
|
|
96
|
98
|
(cond
|
|
97
|
99
|
((equal (variable-symbol single-poly1) (variable-symbol single-poly2))
|
|
|
@@ -109,11 +111,10 @@
|
|
109
|
111
|
(exponent single-poly2)))
|
|
110
|
112
|
(* (multiplier single-poly1) (multiplier single-poly2))))))
|
|
111
|
113
|
|
|
|
114
|
+;; Multiply two polynomials together, see the map-poly will be recursed
|
|
|
115
|
+;; and the poly will remain constant
|
|
112
|
116
|
(defun multiply-terms (map-poly poly)
|
|
113
|
117
|
(cond
|
|
114
|
118
|
((equal map-poly nil) nil)
|
|
115
|
119
|
(T (remove nil (append (map-onto-poly (car map-poly) poly)
|
|
116
|
120
|
(multiply-terms (cdr map-poly) poly))))))
|
|
117
|
|
-
|
|
118
|
|
-; (poly+ '(((x 2) 3)) '(((y 2) 4)))
|
|
119
|
|
-; (poly+ '(((x 2) 3) ((y 2) 3)) '(((y 2) 4)))
|