Created
August 26, 2019 08:24
-
-
Save unhammer/761e9a098d095f2cf307a12271b86c69 to your computer and use it in GitHub Desktop.
how to get the derivative in Haskell
This file contains 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
-- From https://twitter.com/GabrielG439/status/647601518871359489 | |
:set -package ad | |
:set -package numbers | |
:m Numeric.AD Data.Number.Symbolic | |
diff (\x -> sqrt x) (var "a") | |
-- 1.0/(2.0*sqrt a) | |
diff (\x -> x^2 + sqrt x) (var "a") | |
-- a+a+1.0/(2.0*sqrt a) | |
diff (\x -> x^2 + sqrt x) 1 | |
-- 2.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment