Copyright | (c) Lars Brünjes, 2016 |
---|---|
License | MIT |
Maintainer | [email protected] |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Extensions | GeneralizedNewtypeDeriving |
Data.Utils.Analytic
Description
This module defines the numeric type Analytic
, which has "built in differentiation".
Documentation
fromDouble :: Double -> Analytic Source
fromAnalytic :: Analytic -> Maybe Double Source
Arguments
:: Traversable t | |
=> (Double -> Double -> a) | how to combine argument and gradient |
-> (t Analytic -> Analytic) | analytic function |
-> t Double | function argument |
-> (Double, t a) | function value and combination of argument and gradient |
Computes the gradient of an analytic function and combines it with the argument.
>>>
gradient (\_ d -> d) (\[x, y] -> x * x + 3 * y + 7) [2, 1]
(14.0,[4.0,3.0])