Copyright | (c) 2011 Bryan O'Sullivan |
---|---|
License | BSD3 |
Maintainer | bos@serpentine.com |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Numeric.RootFinding
Contents
Description
Haskell functions for finding the roots of real functions of real arguments.
Documentation
The result of searching for a root of a mathematical function.
Constructors
NotBracketed | The function does not have opposite signs when evaluated at the lower and upper bounds of the search. |
SearchFailed | The search failed to converge to within the given error tolerance after the given number of iterations. |
Root a | A root was successfully found. |
Instances
Monad Root Source # | |
Functor Root Source # | |
Applicative Root Source # | |
Alternative Root Source # | |
MonadPlus Root Source # | |
Eq a => Eq (Root a) Source # | |
Data a => Data (Root a) Source # | |
Defined in Numeric.RootFinding Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Root a -> c (Root a) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (Root a) # toConstr :: Root a -> Constr # dataTypeOf :: Root a -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (Root a)) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (Root a)) # gmapT :: (forall b. Data b => b -> b) -> Root a -> Root a # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Root a -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Root a -> r # gmapQ :: (forall d. Data d => d -> u) -> Root a -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Root a -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Root a -> m (Root a) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Root a -> m (Root a) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Root a -> m (Root a) # | |
Read a => Read (Root a) Source # | |
Show a => Show (Root a) Source # | |
Generic (Root a) Source # | |
type Rep (Root a) Source # | |
Defined in Numeric.RootFinding type Rep (Root a) = D1 (MetaData "Root" "Numeric.RootFinding" "math-functions-0.2.1.0-7USAjNdN7LA7o5JqMkeB7M" False) (C1 (MetaCons "NotBracketed" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "SearchFailed" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "Root" PrefixI False) (S1 (MetaSel (Nothing :: Maybe Symbol) NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 a)))) |
Arguments
:: a | Default value. |
-> Root a | Result of search for a root. |
-> a |
Returns either the result of a search for a root, or the default value if the search failed.
Arguments
:: Double | Absolute error tolerance. |
-> (Double, Double) | Lower and upper bounds for the search. |
-> (Double -> Double) | Function to find the roots of. |
-> Root Double |
Use the method of Ridders to compute a root of a function.
The function must have opposite signs when evaluated at the lower and upper bounds of the search (i.e. the root must be bracketed).
Arguments
:: Double | Required precision |
-> (Double, Double, Double) | (lower bound, initial guess, upper bound). Iterations will no go outside of the interval |
-> (Double -> (Double, Double)) | Function to finds roots. It returns pair of function value and its derivative |
-> Root Double |
Solve equation using Newton-Raphson iterations.
This method require both initial guess and bounds for root. If Newton step takes us out of bounds on root function reverts to bisection.
References
- Ridders, C.F.J. (1979) A new algorithm for computing a single root of a real continuous function. IEEE Transactions on Circuits and Systems 26:979–980.