newton_raphson_iterate bisection fallback does not work
- 主要言語
- C++
- スター
- 374
- フォーク
- 264
- 平均マージ
- 1日 23時間
- マージ済み PR(30日)
- 17
説明
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.
```c++
#include
#include
#include
int main() {
const auto quartic = [](const double x) {
return std::make_pair((x * x - 1.0) * (x * x + 0.1),
2.0 * x * ((x * x - 1.0) + (x * x + 0.1)));
};
const double result =
boost::math::tools::newton_raphson_iterate(quartic, 0.5, 0.1, 1.1, 5);
std::cout << result << "\t" << quartic(result).first << "\n";
return result;
}
```
Output:
```
0.10625 -0.110033
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。