(defn deriv-fn*
"
Examples:
(use '(incanter core symbolic))
(deriv-fn* '[x y] '(+ (* x y) x) 'x)
((deriv-fn* '[x y] '(+ (* x y) x) 'x) 5 9)
"
([[& args] expr v]
(deriv-fn* args expr v 1))
([[& args] expr v degree]
(let [ops {'+ clojure.core/+
'- clojure.core/-
'* clojure.core/*
'/ clojure.core//
'sin incanter.core/sin
'cos incanter.core/cos
'tan incanter.core/tan
'pow incanter.core/pow
'** incanter.core/pow
'exp incanter.core/exp}]
(eval (tree-subst (list 'fn (apply vector args) (deriv* expr v degree))
(apply assoc ops (interleave args (map gensym args))))))))
Used in 0 other vars
Comments top
No comments for deriv-fn*. Log in to add a comment.