Skip to content

proposal: root: add FindBracketMono to find a suitable bracket for use in bracket based root finding algorithms #70

@fumin

Description

@fumin

Background

We will soon have bracket based root finding algorithms in the root package.
In general, users are expected to leverage their knowledge about the function at hand to come up with a bracket interval [a, b] that hugs the root, i.e. f(a)f(b) < 0.
However, in the special case of monotonic functions, we can actually help users identify such a bracket automatically.
This will make using our root finding algorithms much more convenient in statistical analysis, where the Cumulative function is a monotonically increasing function.

Proposal

I propose the follow signature:

// FindBracketMono finds a bracket interval [a, b] where f(a)f(b) < 0.
// f must be a monotonically increasing function.
func FindBracketMono(f func(float64) float64, guess float64) (float64, float64)

The algorithm behind FindBracketMono is that of the Boost C++ library's bracketing routine.
What this algorithm does is leveraging the fact that for monotonic functions, we always know whether the root is towards 0 or Inf, relative to the current guess.

Potential impact of proposal

This function will be placed in the new root package. I will do the work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions