1

Consider that I am solving a second order ODE using RK2/RK4. The ODE represents simple equations of motion: Equations of motion I am trying to solve:

\begin{align} \frac{dx}{dt} &= v \\[.3em] m·\frac{dv}{dt}&= f_{p}(x)+f_{g}(x,v) \end{align}

Now along with $x$ and $v$, I also require to compute the $f_{p}(x)+f_{g}(x,v)$ at each time-step $h$. In such case what should I take velocity and position pair at that particular time-step? I ask this since RK4 generates multiple pairs of $x$ and $v$ at each time-step.

Method Runge Kutta $4^{th}$ order

Basic Formulae \begin{align} x^{'}&=x_{0}+ \frac{1}{6}(k_{0}+2k_{1}+2k_{2}+k_{3}) \\ v^{'}&=v_{0}+ \frac{1}{6}(l_{0}+2l_{1}+2l_{2}+l_{3}) \end{align}

Calculation of coefficients \begin{align} k_0 &= h v_0 \\ l_0 &= \frac {h (F_{p}(x_0) +F_g(x_0,v_0)) }{ m} \\[.5em] k_1 &= h (v_0+ \frac{l_0}{2}) \\ l_1 &= \frac {h (F_{p}(x_0 + \frac {k_0}{2}) +F_g(x_0 + \frac {k_0}{2}, v_0 + \frac {l_0}{2})) }{ m} \\[.5em] k_2 &= h (v_0+ \frac{ l_1}{2}) \\ l_2 &= \frac {h (F_{p}(x_0 + \frac {k_1}{2}) +F_g(x_0 + \frac {k_1}{2}, v_0 + \frac {l_1}{2})) }{ m} \\[.5em] k_3 &= h (v_0+ {l_2}) \\ l_3 &= \frac {h (F_{p}(x_0 + {k_2}) +F_g(x_0 + {k_2},v_0 + {l_2})) }{ m} \end{align}

  • 1
    If you have $x$ and $v$ what is the problem of just evaluating $f_p(x)+f_g(x,v)$? You can also use $ml_0/h$ –  Apr 23 '15 at 14:32
  • 1
    You mean evaluate again at the end of rk4? Will that belong to the next time-step or this one itself? – Abhishek Bhatia Apr 23 '15 at 14:43
  • Repeated question from http://math.stackexchange.com/q/1228554/115115 and http://math.stackexchange.com/q/1247854/115115. Intent formulated in the first link up to now in the clearest but still incomplete version as: »I am simulating a dynamical model of humans. The $F_g$ is updated every $0.5$ seconds while $F_p$ every $0.01$ second. I wish to compute the $F_p$ at each timestep$=0.01$sec«. Question: Evaluated at what points, how were those points obtained? – Lutz Lehmann Apr 23 '15 at 17:06
  • 1
    It is a simulation. The step-size is low to approximate a continuous setting. For $F_g$ it relates to self-propelled agents which can take directions only after a specified interval. Does this make more clear? – Abhishek Bhatia Apr 24 '15 at 08:23
  • Not really. It would be nice if you could produce some kind of minimal example. Something like the most basic specification of an agent. It is doubtful if your system can be described by differential equations. From your description, there are memory effects involved, some kind of dynamic control, and on-off-switches for the forces. Looks more like some kind of discrete dynamical system. – Lutz Lehmann Apr 24 '15 at 12:24

0 Answers0