learn-physics-0.6.0.0: Haskell code for learning physics

Physics.Learn.RootFinding

Description

Functions for approximately solving equations like f(x) = 0. These functions proceed by assuming that f is continuous, and that a root is bracketed. A bracket around a root consists of numbers a, b such that f(a) f(b) <= 0. Since the product changes sign, there must be an x with a < x < b such that f(x) = 0.

Synopsis

# Documentation

Arguments

 :: (Double -> Double) function -> (Double, Double) range over which to search -> [Double] list of roots

Find a list of roots for a function over a given range. There are no guarantees that all roots will be found. Uses `findRootsN` with 1000 intervals.

Arguments

 :: Int initial number of intervals to use -> (Double -> Double) function -> (Double, Double) range over which to search -> [Double] list of roots

Find a list of roots for a function over a given range. First parameter is the initial number of intervals to use to find the roots. If roots are closely spaced, this number of intervals may need to be large.

Arguments

 :: (Double -> Double) function -> (Double, Double) initial bracket -> Double approximate root

Find a single root in a bracketed region. The algorithm continues until it exhausts the precision of a `Double`. This could cause the function to hang.

Arguments

 :: (Ord a, Fractional a) => a desired accuracy -> (a -> a) function -> (a, a) initial bracket -> (a, a) final bracket

Given an initial bracketing of a root (an interval (a,b) for which f(a) f(b) <= 0), produce a bracket of arbitrary smallness.

Arguments

 :: (Ord a, Fractional a) => (a -> a) function -> ((a, a), (a, a)) original bracket -> ((a, a), (a, a)) new bracket

Given a bracketed root, return a half-width bracket.