/** * * @author horacio a. aliaga */ /** Integrates the stochastic equation: * dX = a(X) dt + b(X) dW * up to order 4, using the Ito-Taylor scheme and strong convergence. * It needs a(X) and its first and second derivatives with respect of X, * and b(X) and its first, second and third derivatives with respect of X. * The initial value X0 of X is needed as well as dt. */ #ifndef SDEINTEGRATOR_H #define SDEINTEGRATOR_H class SDEIntegrator { public: double X0, X; double dwt, dwt2, dt,dZ; double a, d_a, dd_a; double b, d_b, dd_b, ddd_b; /** Creates a new instance of SDEIntegrator */ public: SDEIntegrator(); SDEIntegrator(double,double,double, double,double,double, double,double,double) ; void set_SDEIntegrator(double,double,double, double,double,double, double,double,double); /** sets the value of a(X) */ void set_a(double); /** sets the value of da(X)/dX */ void set_d_a(double); /** sets the value of d^2a(X)/dX^2 */ void set_dd_a(double); /** sets the value of b(X) */ void set_b(double); /** sets the value of db(X)/dX */ void set_d_b(double); /** sets the value of d^2a(X)/dX^2 */ void set_dd_b(double); /** sets the value of d^3a(X)/dX^3 */ void set_ddd_b(double); /** sets the value of dZ, a gaussian random variable generated using combining the two independent gaussian random variables dwt and dwt2 */ void set_dZ(double,double,double); /** sets the random gaussian variables dwt and dwt2*/ void set_dW(double); /** sets the time step dt */ void set_dt(double); /** sets the initials value of X(0)=X0*/ void set_X0(double); void set_X(double); /** gets the value of a(X)*/ double get_a(); /** gets the value of da(X)/dX*/ double get_d_a(); /** gets the value of d^2a(X)/dX^2*/ double get_dd_a(); /** gets the value of b(X)*/ double get_b(); /** gets the value of db(X)/dX*/ double get_d_b(); /** gets the value of d^2b(X)/dX^2*/ double get_dd_b(); /** gets the value of d^3b(X)/dX^3*/ double get_ddd_b(); /** gets the value dZ(dt)*/ double get_dZ(); /** gets the value of dt*/ double get_dt(); /** gets the value of dwt*/ double get_dwt(); /** gets the value of dwt2*/ double get_dwt2(); /** gets the value of X0*/ double get_X0(); double get_X(); /** Order zero in series of terms comprising the integration*/ double Strong_Integrator_Zero(); /** Order one in series of terms comprising the integration*/ double Strong_Integrator_First(); /** Order second in series of terms comprising the integration*/ double Strong_Integrator_Second(); /** Order three in series of terms comprising the integration*/ double Strong_Integrator_Third(); /** Order four in series of terms comprising the integration, it requires the calculation of the Stratonovich Integrals J011, J101 and J011*/ double Strong_Integrator_Fourth(); /** generates the dZ correlated random variable */ private: double generate_X_Y(double,double,double); /** calculates the multiple stratonovich integrals: * J1, J01, J10, J11, J110, J101 and J011 */ public: double* J_XXX(double,double); /** Polar Marsaglia generator of random gaussian variables dwt and dwt2, with variance dt */ private: double* pol_mas(double); }; #endif SDEINTEGRATOR_H