numeric-tools-0.2.0.1: Collection of numerical tools for integration, differentiation etc.

Portabilityportable
Stabilityexperimental
MaintainerAleksey Khudyakov <alexey.skladnoy@gmail.com>
Safe HaskellNone

Numeric.Tools.Equation

Contents

Description

Numerical solution of ordinary equations.

Synopsis

Data type

data Root a Source

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.

fromRootSource

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.

Equations solversv

solveBisectionSource

Arguments

:: Double

Required absolute precision

-> (Double, Double)

Range

-> (Double -> Double)

Equation

-> Root Double 

Use bisection method to compute root of 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).

solveRiddersSource

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).

solveNewtonSource

Arguments

:: Double

Absolute error tolerance

-> (Double, Double)

Lower and upper bounds for root

-> (Double -> Double)

Function

-> (Double -> Double)

Function's derivative

-> Root Double 

Solve equation using Newton-Raphson method. Root must be bracketed. If Newton's step jumps outside of bracket or do not converge sufficiently fast 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.