Created
May 30, 2009 02:07
-
-
Save liebke/120330 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; plot a user defined function and its derivative | |
(use '(incanter core charts optimize)) | |
;; define the function, x^3 + 2x^2 + 2x + 3 | |
(defn cubic [x] (+ (* x x x) (* 2 x x) (* 2 x) 3)) | |
;; use the derivative function to get a function | |
;; that approximates the derivative of cubic | |
(def deriv-cubic (derivative cubic)) | |
;; plot the cubic function and its derivative | |
(doto (function-plot cubic -10 10) | |
(add-function deriv-cubic -10 10) | |
view) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment