Hello,
I’m a moderately experienced C++ programmer using Visual Studio 2017, but I’m new to using the boost odeint library.
I’m trying to integrate the Hodgkin-Huxley equations, which are a set of ODEs that describe the generation of nerve impulse. The output should be a time-series waveform which is mainly flat but with occasional spikes in it.
I have a functor HH which works fine with a standard fixed-step Runge-Kutta routine
runge_kutta4< state_type > stepper;
integrate_const(stepper, HH, x, 0.0, 20.0, 0.04,trace_observer());
This code produces exactly the right waveform
However, I would like to use an adaptive step size because the waveform is pretty flat between the spikes. I tried the following:
integrate_adaptive(make_dense_output(1.0e-6, 1.0e-6, runge_kutta_dopri5< state_type >()), hh, x, 0.0, 10.0, 0.04, trace_observer());
This works up to about the peak of the first spike, but then crashes with the error message:
Debug Assertion Failed!
…
Expression: vector iterator not incrementable
It dies in the Visual Studio vector library code
_Vector_const_iterator& operator++()
in a call from boost::norm_inf where iterator first1 reports as
first1 {2.105352686232e-314#DEN} std::_Vector_const_iterator<std::_Vector_val<std::_Simple_types<double> > >
I certainly don’t understand how the boost code works under the hood, but I wondered if anyone could suggest a change in my calling code that might make it work? I have hand-crafted some adaptive step size code which works OK (and does run faster than the fixed step size), but it is a bit of a kludge and I would rather use code developed by people who actually understand the maths.
For reasons of brevity I haven’t put the HH code in this message, but could do if it would help.
Thanks for any help
Dr W J Heitler
School of Biology
University of St Andrews
01334 463490