Pretty noob question so please bear with me.
I am following the example given here–>
http://www.codeproject.com/Articles/268589/odeint-v2-Solving-ordinary-differential-equations
In particular, I am looking at this function:
void lorenz( state_type &x , state_type &dxdt , double t )
{
dxdt[0] = sigma * ( x[1] - x[0] );
dxdt[1] = R * x[0] - x[1] - x[0] * x[2];
dxdt[2] = x[0]*x[1] - b * x[2];
}
In my case, R takes on a series of values (vector with 100 doubles).
odeint is called as:
integrate_const( runge_kutta4< state_type >() , lorenz , x , 0.0 , 10.0 , dt );
I would like to do this for each value of R. How can I accomplish this? My knowledge of C++/OOP is limited, but I am willing to learn.
Thank you.
You can use the “class” version, but modify it so that it is initialized with the
Rvalue of interest to you.Then, iterate over your vector
Rand pass in the value to thelorenz_classinstance that you pass to theintegrate_consttemplate function.