-
Notifications
You must be signed in to change notification settings - Fork 226
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
newton_raphson_iterate bisection fallback does not work #808
Comments
Unfortunately, I don't think this is solvable in all cases. In this situation, the initial NR step goes out of bounds to the left, we therefore assume (erroneously in this case) that there is a root in the interval Now, we could have bisected the whole interval With P1 as the initial guess. This time we go out of bounds to the right, and bisection of Basically, if we are given an initial guess we the right to assume that it is "downhill" from that guess to the root. For example, one could easily construct curves that look a lot like yours, but which have one or more roots between I realise this sounds like a cop-out, and I really am committed to making this routine as robust as possible, not least because NR routines have a reputation for exploding in all sorts of situations. But I just don't think it's possible to make them completely fool-proof in all situations. Suggestions welcome! |
@wthrowe : Does the Halley iterate succeed? In general I find the Halley iterate has a more sane basin of convergence and moreover it can degrade gracefully to a newton iterate. |
It doesn't go out-of-bounds with the first step, but since we're starting the wrong side of the maxima, it just goes downhill away from the root until it hits the search endpoint. Which is what I would expect to be honest. I guess the question is to what lengths we're prepared to go to protect against bad initial guesses? |
Yeah, I think the worry is that if you add too many branches for these cases, you either create bugs, or create performance issues. Though maybe "if it goes out the right bound, start the guess at the left" might not be insane? |
There are simple robust algorithms for this (see, for example, |
The Boost version's bisection fallback does not work properly. boostorg/math#808
The Boost version's bisection fallback does not work properly. boostorg/math#808
The documentation for
newton_raphson_iterate
states that "Out-of-bounds steps revert to bisection of the current bounds", which should be robust, but the implementation fails to bisect correctly in some cases. The following program requests the root of a quartic with the sole root 1 in the bounding interval, but with an initial guess on the wrong side of an extremum that causes a step out of bounds. The returned result is approximately the endpoint of the interval farthest from the actual root, which should have been eliminated by a single bisection.Output:
The text was updated successfully, but these errors were encountered: