I'm having trouble getting the Adams-Bashforth-Moulton method from the BOOST odeint library to work. I succeeded with the Buliers Stour, but for some reason Adams-Bashfort-Moulton just returns to NATO when I try to use order> 2. If I use order 1 or 2, I get a double answer. I shortened my code to:
#include <iostream> #include <boost/array.hpp> #include <boost/numeric/odeint.hpp> #include <boost/version.hpp> typedef boost::array<long double, 2> state_type; using namespace boost::numeric::odeint; class Boost_odeint_rhs{ public: Boost_odeint_rhs(){ } void operator() (const state_type &x, state_type &dxdt, const double t) { dxdt[0] = 1; dxdt[1] = 2; } }; int main() { std::cout << "using boost " << BOOST_VERSION / 100000 << "." << BOOST_VERSION / 100 % 1000 << "." << BOOST_VERSION % 100 << std::endl; std::cout << "integrating vector [1,2] over (0,1)" << std::endl; Boost_odeint_rhs rhs; state_type Bint; Bint[0] = 0.0; Bint[1] = 0.0; adams_bashforth_moulton< 2 , state_type > stepper; //bulirsch_stoer< state_type > stepper( 1e-5 , 0.0 , 0.0 , 1.0 ); integrate_adaptive( stepper , rhs , Bint , 0.0 , 1.0 , 1e-3 ); std::cout << "returned integral = " << Bint[0] << " "<< Bint[1] << std::endl; }
I am using BOOST 1.54.0 and GCC 4.8.2 on Ubuntu 14.04
Thanks in advance.
source share