// solve y'(t) = -t*y , condition y(0) = -2 // Adaptive integration using Boost::numeric::odeint // compile : // g++ --std=c++11 boost_ode_simple.cpp #include #include #include #include using state_type= std::vector; using stepper_type= boost::numeric::odeint::runge_kutta_cash_karp54; namespace my{ using std::cout; void system(const state_type& y, state_type& dydt, const double t) { dydt[0] = -t*y[0]; } void output(double t, double y, double exact){ cout<(e_abs, e_rel) ; state_type y ={-2.0} ; //condition y(0)=-2 gives y(t) = -2.0*exp(-0.5*t*t) const int n=50; // solve 50 points const double t1 = 0.0, t2=10.0; const double dt = (t2-t1)/(n-1); for(int i = 0; i