소스 검색

Added a numeric and polynomial term manipulator

Samuel W. Flint 9 년 전
부모
커밋
1e10db8767
1개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 8 0
      manipulation.org

+ 8 - 0
manipulation.org

@@ -849,6 +849,14 @@ Foo
 
   (define-multiply-manipulator (numeric numeric)
     (* expression-a expression-b))
+
+  (define-multiply-manipulator (numeric polynomial-term)
+    (let ((new-coefficient (* expression-a (coefficient expression-b)))
+          (variable (term-variable expression-b))
+          (power (get-power expression-b)))
+      (if (= 1 power)
+          `(* ,new-coefficient ,variable)
+          `(* ,new-coefficient (expt ,variable ,power)))))
 #+END_SRC
 
 ** WORKING Division