boostorg / boostorg/odeint

infinite loop in integrate_adaptive/odeint

Open
#41 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
55
Forks
59
PR merge metrics
No merged PRs in 30d

Description

I am running into an infinite loops applying integrate_adaptive in the dense output version (odeint/integrate/detail/integrate_adaptive.hpp l. 122).

That's an easy test case replicating the issue:

```
auto f = []( const double& /*y*/, double& dy_dx, double /*x*/ ) {
dy_dx = haas::math::numeric::constant::two_pi() / -35.0;
};
typedef boost::numeric::odeint::runge_kutta_dopri5 error_stepper_type;
auto stepper = boost::numeric::odeint::make_dense_output( 1.0e-6, 1.0e-5);
// Initial conditions
state_type state1 = 0.0;
// Solve ODE
boost::numeric::odeint::integrate_adaptive( stepper, f, state1, 0.0, -23.8, -23.8 / 100 );
```

The problem seems to rise from a mismatch between the new initialization of stepper st ( l. 144) and the while loop condition (l. 135).

I would suggest to change l. 135-137 from
```
while( less_eq_with_sign( static_cast

Comments very welcome!

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.