| Time integration methods:This example shows the motion of a particle with an initial velocity. Moreover, a constant gravitational acceleration is acting on the particle. In this special case an analytic solution can be computed as:
				$$\begin{align*}
					\mathbf x(t + \Delta t) &= \mathbf x(t) + \Delta t \mathbf v(t) + \frac12 \Delta t^2 \mathbf a^\text{grav} \\
					\mathbf v(t + \Delta t) &= \mathbf v(t) + \Delta t \mathbf a^\text{grav} .
				\end{align*}$$
				The motion determined using this analytic solution is plotted in green and can be compared with different numerical solutions that are introduced in the following.Explicit EulerThe explicit Euler method is a first-order accurate method for solving ordinary differential equations (ODEs):
				$$\begin{align*}
					\mathbf x(t + \Delta t) &= \mathbf x(t) + \Delta t \mathbf v(t) \\
					\mathbf v(t + \Delta t) &= \mathbf v(t) + \Delta t \mathbf a(t).
				\end{align*}$$Symplectic EulerThe symplectic Euler method is also known as semi-implicit Euler since first the new velocity is determined and then the new position is computed using the new velocity value:
				$$\begin{align*}
					\mathbf v(t + \Delta t) &= \mathbf v(t) + \Delta t \mathbf a(t) \\
					\mathbf x(t + \Delta t) &= \mathbf x(t) + \Delta t \mathbf v(t + \Delta t).
				\end{align*}$$
				The method is also first-order accurate but yields better results than the explicit Euler since it is a symplectic method.Runge-Kutta 2Typically numerical integration methods are defined for a differential equation determined by a function $\mathbf f(t, \mathbf s(t))$, where $\mathbf s$ defines the state of the system at time $t$. In our example the state is defined by the current position and velocity of the particle and the function is defined as:
				$$\begin{equation*}
					\mathbf f(t, \mathbf s(t)) = \begin{pmatrix} \dot{\mathbf x} \\ \dot{\mathbf v} \end{pmatrix}, \quad\quad \mathbf s(t) = \begin{pmatrix} \mathbf x(t) \\ \mathbf v(t) \end{pmatrix}
				\end{equation*}$$
				
				Using this function the second-order Runge-Kutta integration is defined as
				$$\begin{align*}
					\mathbf k_1 &= \Delta t \mathbf f(t, \mathbf s(t)) \\
					\mathbf k_2 &= \Delta t \mathbf f(t + \frac12 \Delta t, \mathbf s(t) + \frac12 \mathbf k_1) \\
					\mathbf s(t + \Delta t) &= \mathbf s(t) + \mathbf k_2.
				\end{align*}$$
				Note that the Runge-Kutta method has multiple stages (in our case 2) to achieve a higher-order accuracy. However, this approach is more expensive than the Euler methods since the function has to be evaluated once per stage. |