#ifndef INCLUDE_ONCE_VECTOR_FIELD_FORCED_DAMPED_DUFFING_2D #define INCLUDE_ONCE_VECTOR_FIELD_FORCED_DAMPED_DUFFING_2D #include #include typedef std::pair Vec2d; class forceddampedduffing2d { public: forceddampedduffing2d(double Alpha = -0.25, double Beta = 0.4) : alpha(Alpha), beta(Beta) {} // Samples the phase space vector field of the forced damped duffing oscillator Vec2d sample(double x, double y, double t) { return Vec2d( y, alpha * y - x * x*x + x + beta * std::cos(t)); } // Samples the phase space x-partial of the vector field of the forced damped duffing oscillator Vec2d sample_dx(double x, double y, double t) { return Vec2d( 0, 1 - 3 * x*x); } // Samples the phase space y-partial of the vector field of the forced damped duffing oscillator Vec2d sample_dy(double x, double y, double t) { return Vec2d( 1, alpha); } // Samples the phase space t-partial of the vector field of the forced damped duffing oscillator Vec2d sample_dt(double x, double y, double t) { return Vec2d( 0, -beta * std::sin(t)); } private: double alpha; double beta; }; #endif