#include #include #include #include #include "gsl_func_jac.h" int main (void){ double mu = 10; gsl_odeiv2_system sys = {func, jac, 2, &mu}; auto solver = gsl_odeiv2_driver_alloc_y_new ( &sys, gsl_odeiv2_step_rk8pd, 1e-6, 1e-6, 0.0); int i; double t = 0.0, t1 = 100.0; double y[2] = { 1.0, 0.0 }; for (i = 1; i <= 100; i++) { double ti = i * t1 / 100.0; int status = gsl_odeiv2_driver_apply (solver, &t, ti, y); if (status != GSL_SUCCESS) { printf ("error, return value=%d\n", status); break; } printf ("%.5e %.5e %.5e\n", t, y[0], y[1]); } gsl_odeiv2_driver_free (solver); }