gonum / gonum/exp

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

Open
#70 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
19
Forks
7
PR merge metrics
No merged PRs in 30d

Description

### Background
We will soon have [bracket based root finding algorithms](https://github.com/gonum/exp/pull/65) 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](https://live.boost.org/doc/libs/1_87_0/libs/math/doc/html/math_toolkit/roots_noderiv/bracket_solve.html).
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.