1.2.3-SNAPSHOT permalink Arrow_down_16x16

deriv-fn*

incanter.symbolic

  • (deriv-fn* [& args] expr v)
  • (deriv-fn* [& args] expr v degree)


Examples:
(use '(incanter core symbolic))

(deriv-fn* '[x y] '(+ (* x y) x) 'x)

((deriv-fn* '[x y] '(+ (* x y) x) 'x) 5 9)

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/symbolic.clj:236 top

(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))))))))
Vars in incanter.symbolic/deriv-fn*: apply assoc defn eval fn gensym interleave let list map vector
Used in 0 other vars

Comments top

No comments for deriv-fn*. Log in to add a comment.