Numerical solutions of differential equations of motion in three dimensions

An object moving in three dimensions is described by six variables: $x$, $y$, $z$, $v_x$, $v_y$, and $v_z$. If the force on the object is known, then the motion can be described by six first order differential equations,

$\large \frac{dx}{dt}=v_x$   $\large \frac{dv_x}{dt}=F_x(x,y,z,v_x,v_y,v_z,t)/m$

$\large \frac{dy}{dt}=v_y$   $\large \frac{dv_y}{dt}=F_y(x,y,z,v_x,v_y,v_z,t)/m$

$\large \frac{dz}{dt}=v_z$   $\large \frac{dv_z}{dt}=F_z(x,y,z,v_x,v_y,v_z,t)/m$

These equations can be solved numerically step-by-step. If the initial conditions for $\vec{x}(t_0)$ and $\vec{v}(t_0)$ are known, a good estimate for $\vec{x}$ and $\vec{v}$ a short time $\Delta t$ later is,

$\large \vec{x}(t_0+\Delta t) \approx \frac{d\vec{v}}{dt}|_{t_0}\Delta t$ and $\large \vec{v}(t_0+\Delta t) \approx \vec{F}(x(t_0),v_x(t_0),t_0)\Delta t/m.$

Once an estimate for the position and the velocity of the object at time $t_0 + \Delta t$ is calculated, they can be used to estimate the position and the velocity at time $t_0 + 2\Delta t$. By repeating this over and over, a table of times $(t)$, positions $(x,y,z)$, velocities $(v_x,v_y,v_z)$, and forces $(F_x,F_y,F_z)$ can be made. Other quantities such as the kinetic energy, the work performed, and the instantaneous power can be calculated. The kinetic energy is $E_{\text{kin}}=\frac{v_x^2+v_y^2+v_z^2}{2m}$ [J]. When a force moves a particle a distance $d\vec{r}$ it performs an increment of work $dW=\int\vec{F}\cdot d\vec{r}$ [J]. This work is performed in a time $dt$. The power needed for this is $P=dW/dt=\vec{F}\cdot\vec{v}$ [W].

In the form below, $F_x$, $F_y$, and $F_z$ are the three components of the force, $m$ is the mass, and $t$ is the time. Starting from intitial conditions, the equations are integrated for a total number of $N_{steps}$ steps using a step size of $\Delta t$. The force can be specified as a function of the positions $x$, $y$, $z$, the velocities $v_x$, $v_y$, $v_z$ and the time $t$.

 3-D motion differential equation solver 

$ F_x=$

 [N]

$ F_y=$

 [N]

$ F_z=$

 [N]

$ m=$

 [kg]
Initial conditions:

$t_0=$

 [s]

$\Delta t=$

 [s]

$x(t_0)=$

 [m]

$N_{steps}$

$v_x(t_0)=$

 [m/s]

Plot:

vs.

$y(t_0)=$

 [m]

$v_y(t_0)=$

 [m/s]

$z(t_0)=$

 [m]

$v_z(t_0)=$

 [m/s]

 

= , =

3-D plot: 

 $t$ [s] $x$ [m] $y$ [m] $z$ [m] $v_x$ [m/s] $v_y$ [m/s] $v_z$ [m/s] $F_x$ [N] $F_y$ [N] $F_z$ [N] $P$ [W] $E_{\text{kin}}$ [J] $W$ [J]

Examples