Macro for symbolic differentiation. with 2 args, takes 1st degree deriv.
with 3, takes arbitrary degrees. contains all deriv rules for basic funcs.
Examples:
(use '(incanter core symbolic))
(deriv (+ x 3) x) ; => 1
(deriv (* x y) x) ; => y
(deriv (* (* x y) (+ x 3)) x) ; => (+ (* (+ x 3) y) (* x y))
(deriv (* (* x y) (+ x 3)) y) ; => (* (+ x 3) x)
(deriv (* x y (+ x 3)) x) ; => (+ (* y (+ x 3)) (* y x))
(deriv (* x y (+ x 3)) y) ; => (* (+ x 3) x)
(deriv (sin x) x) ; => (cos x)
(deriv (cos x) x) ; => (* -1 (sin x))
(deriv (sin (* x y)) y) ; => (* x (cos (* x y)))
(deriv (pow x 3) x) ; => (* 3 (pow x 2))
(deriv (** x 3) x) ; => (* 3 (pow x 2))
(deriv (pow x 3) x 2) ; => (* 3 (* 2 x))
(deriv (* x y (+ x 3)) x 2) ; => (+ y y)
(deriv (* x y (+ x 3)) x 3) ; => 0
(deriv (+ (* 3 x) (* 8 x)) x) ; => 11
;; NOT WORKING YET
(deriv (/ 1 x) x) ; => (* (deriv* (* (x)) x) (* -1 (pow (* (x)) -2)))
^-- need to fix
Comments top
No comments for deriv. Log in to add a comment.