File: deriv.hs

package info (click to toggle)
haskell-hmatrix 0.15.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 608 kB
  • ctags: 302
  • sloc: haskell: 4,909; ansic: 2,688; makefile: 3
file content (8 lines) | stat: -rw-r--r-- 178 bytes parent folder | download
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