Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1D Newton finds roots no matter what for certain cases #1005

Open
ryanelandt opened this issue Jul 26, 2023 · 0 comments
Open

1D Newton finds roots no matter what for certain cases #1005

ryanelandt opened this issue Jul 26, 2023 · 0 comments

Comments

@ryanelandt
Copy link
Contributor

Summary
If all the steps the 1D Newton solver encounters have the same sign, the solver will return a root, no matter what. For example, root finding the function f(x) = x over the interval [1, 3] returns a root near 1.

boost::math::tools::newton_raphson_iterate([](double x) { return std::make_pair(x, 1.0); }, 2.0, 1.0, 3.0, 52);

Why this occurs
If the 1D Newton root finder overshoots a bound, it will bisect with said bound. Repeated overshoots and subsequent bisections decrease the step size. When the step size is sufficiently small, the convergence criteria is satisfied and a root is returned. This functionality results in answers that are obviously wrong as the above example showed. The behavior of finding roots at ends causes problems with real workflows, e.g., #808.

Deeper issues
A related danger is that people may write code whose apparent correct functioning is a result of the 1D Newton solver's ability to find roots in objective functions that do not contain them. An example of this occurring in Boost Math is the temme root finder which #1004 attempts to correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant