summaryrefslogtreecommitdiff
path: root/examples/deriv.hs
blob: c9456d1f01e4ee9b96dfc2abbfc6d9348fe39b73 (plain)
1
2
3
4
5
6
7
8
-- Numerical differentiation

import Numeric.GSL

d :: (Double -> Double) -> (Double -> Double)
d f x = fst $ derivCentral 0.01 f x

main = print $ d (\x-> x * d (\y-> x+y) 1) 1