161 our game the Runge-Kutta method is used to calculate positions and |
161 our game the Runge-Kutta method is used to calculate positions and |
162 velocities of physics objects when we apply forces to them. |
162 velocities of physics objects when we apply forces to them. |
163 |
163 |
164 The mathematical formulation of the Runge-Kutta method: |
164 The mathematical formulation of the Runge-Kutta method: |
165 If we have an initial value problem of the form |
165 If we have an initial value problem of the form |
166 \begin{equation} |
166 \begin{equation*} |
167 y' = f(t, y), \quad y(t_0) = y_0. |
167 y' = f(t, y), \quad y(t_0) = y_0. |
168 \end{equation} |
168 \end{equation*} |
169 The we can describe the RK4 method for this problem by equations |
169 The we can describe the RK4 method for this problem by equations |
170 \begin{align} |
170 \begin{align*} |
171 y_{n+1} &= y_n + \tfrac{1}{6}h\left(k_1 + 2k_2 + 2k_3 + k_4 \right) \\ |
171 y_{n+1} &= y_n + \tfrac{1}{6}h\left(k_1 + 2k_2 + 2k_3 + k_4 \right) \\ |
172 t_{n+1} &= t_n + h \\ |
172 t_{n+1} &= t_n + h \\ |
173 \end{align} |
173 \end{align*} |
174 where $y_{n+1}$ is the RK4 approximation of $y(t_{n+1})$, and |
174 where $y_{n+1}$ is the RK4 approximation of $y(t_{n+1})$, and |
175 \begin{align} |
175 \begin{align*} |
176 k_1 &= f(t_n, y_n) \\ |
176 k_1 &= f(t_n, y_n) \\ |
177 k_2 &= f(t_n + \tfrac{1}{2}h, y_n + \tfrac{1}{2}h k_1) \\ |
177 k_2 &= f(t_n + \tfrac{1}{2}h, y_n + \tfrac{1}{2}h k_1) \\ |
178 k_3 &= f(t_n + \tfrac{1}{2}h, y_n + \tfrac{1}{2}h k_2) \\ |
178 k_3 &= f(t_n + \tfrac{1}{2}h, y_n + \tfrac{1}{2}h k_2) \\ |
179 k_4 &= f(t_n + h, y_n + h k_3) \\ |
179 k_4 &= f(t_n + h, y_n + h k_3) \\ |
180 \end{align} |
180 \end{align*} |
181 The next value $(y_n+1)$ is determined by the present value $(y_n)$, |
181 The next value $(y_n+1)$ is determined by the present value $(y_n)$, |
182 the product of the interval $(h)$ and an estimated slope that is |
182 the product of the interval $(h)$ and an estimated slope that is |
183 defined as $\frac{1}{6}h\left(k_1+2k_2+2k_3+k_4\right)$. |
183 defined as $\frac{1}{6}h\left(k_1+2k_2+2k_3+k_4\right)$. |
184 |
184 |
185 something network related? |
185 % TODO: something network related? |
186 |
186 |
187 \section{Known bugs} |
187 \section{Known bugs} |
188 A lots of them (or maybe not). |
188 A lots of them (or maybe not). |
189 |
189 |
190 \section{Tasks sharing and schedule} |
190 \section{Tasks sharing and schedule} |