Controlled Runge Kutta Implementation Doesn't Match Documentation
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 43/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp
- Domain
- documentation
Research direction
Read the controlled Runge-Kutta implementation in include/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp alongside the linked steppers documentation. Confirm which step-size formula is intended, then update the documentation so it matches the confirmed behavior and verify the rendered formula is accurate.
Written by the indexing model from the issue text.
Description
In the case where the time step is increased the function increase_step is used from include/boost/numeric/odeint/stepper/controlled_runge_kutta.hpp which I've copied below:
time_type increase_step(time_type dt, value_type error, const int stepper_order) const
{
// returns the increased time step
BOOST_USING_STD_MIN();
BOOST_USING_STD_MAX();
using std::pow;
// adjust the size if dt is smaller than max_dt (providede max_dt is not zero)
if(error < 0.5)
{
// error should be > 0
error = max BOOST_PREVENT_MACRO_SUBSTITUTION (
static_cast<value_type>( pow( static_cast<value_type>(5.0) , -static_cast<value_type>(stepper_order) ) ) ,
error);
// time_type dt_old = dt; unused variable warning
//error too small - increase dt and keep the evolution and limit scaling factor to 5.0
dt *= static_cast<value_type>(9)/static_cast<value_type>(10) *
pow(error, static_cast<value_type>(-1) / stepper_order);
if(m_max_dt != static_cast<time_type >(0))
// limit to maximal stepsize
dt = detail::min_abs(dt, m_max_dt);
}
return dt;
}
Inside of the control flow, $error = \max(5^{-S}, error)$ and then dt is multiplied by $0.9 * error^{-1/S} = 0.9*\min(5, error^{-1/S})$ which limits the maximum step size change to a factor of 4.5.
The documentation here states that if val < 0.5 : dt_new = dt_current min( 0.9 pow( val , -1 / OS ) , 5 ) which has the factor of 0.9 inside the minimum. In this case the maximum step size change is instead limited to a factor of 5.
I'll offer to attempt a PR for the documentation if someone confirms my understanding is correct.
- Dominant language
- C++
- Stars
- 55
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/odeint
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
ODE45 with event Open
Difficulty 5/5 Over a week Newbie friendliness 25/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-samples#453 ·