Numerical solutions of differential equations of motion in three dimensions
The motion of a particle can be determined from the force acting on the particle. The relation between the force $\vec{F}$ and the position of the particle as a function of time $\vec{r}(t)$ is given by Newton's law,
$\large \vec{F}(\vec{r},\vec{v},t) = m\frac{d^2\vec{r}}{dt^2}$.
Generally, the force $\vec{F}$ can depend on the position $\vec{r}$, the velocity $\vec{v}$ and the time $t$. Here $m$ is the mass of the particle. Newton's law can be rewritten as 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$.
$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]
Questions
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$.
When the total force on a particle is zero, it moves with a constant velocity in a straight line.
$\vec{F}=0$
When the total force on a particle is constant, it moves along a parabolic trajectory. If the only force on a particle is gravity, then the force is constant and the motion is parabolic.
$\vec{F}= -mg \hat{z}$
Here $g = 9.807$ m/s² is the acceleration of gravity at the earth's surface.
When the total force on a particle experiences a constant gravitational force and a linear drag force, the total force on the particle is,
$\vec{F}= -mg \,\hat{z} - b\vec{v}$.
Here $g$ is the acceleration of gravity at the earth's surface and $b$ is the drag constant. Eventually the drag force balances the gravitational force and the particle moves with a terminal velocity $v_T= mg/b$.
When the total force is linearly proportional to the displacement from the equilibrium position, the motion will be harmonic.
$\vec{F}= -kx \,\hat{x}$.
Here $k$ is the effective spring constant.
Circular motion is a combination of harmonic motion in the $x-$direction and harmonic motion in the $y-$direction. The amplitudes of the motion in the $x-$ and $y-$ directions must be the same and the initial conditions have to be set so that maximum displacement in the $x-$direction coincides with zero displacement in the $y-direction.
$\vec{F}= -kx \,\hat{x}-ky \,\hat{y}$.
Here $k$ is the effective spring constant.
Satellite orbits
A satellite orbits the earth. The graviational force on the satellite is,
$\large \vec{F} = -\frac{Gm_e m_s}{r^2} \hat{r},$
where $G= 6.6726 \times 10^{-11}$ N m²/kg² is the graviational constant, $m_e = 5.97219 \times 10^{24}$ kg is the mass of the earth, $m_s$ is the mass of the satellite, and $\vec{r}$ is the position of the satellite measured from the center of the earth.
As long as the earth is much heavier than the satellite, the mass of the satellite does not matter. The satellite mass does not appear in the expression for the acceleration. Only the intitial position and velocity of the satellite determines its orbit. If the initial velocity is above the escape velocity, the satellite will escape from the earth's gravitational field and travel away across the galaxy.
The initial conditions at $t=0$ are:
$x=$ m $y=$ m $z=$ m
$v_x=$ m/s $v_y=$ m/s $v_z=$ m/s $m_s=$ kg
If the orbit falls below about 6400000 m, the satellite will crash into the earth. There are various kinds of orbits such as geosynchronous orbits, geostationary orbits, low earth orbits, elliptical orbits, and graveyard orbits. The difference just depends on the initial conditions of the satellite. A long time step should be used to calculate satelite orbits.
Inclined plane
A block of mass $m$ is put on an inclined plane that makes an angle of $\theta$ degrees from horizontal.
The gravitational force, $-mg\hat{y}$ can be decomposed into a force normal to the inclined plane and a force parallel to the inclined plane.
The force parallel to the plane, $|F_{\parallel}|=mg\sin\theta$, causes the block to slide along the plane. In terms of its $x$- and $y$-components, the force along the plane is,
$\vec{F}_{\parallel} = -mg\sin\theta\cos\theta \hat{x} - mg\sin\theta\sin\theta \hat{y}.$
This is a constant force; it is independent of the position, the velocity, and the time. We expect the mass to exhibit parabolic motion and formulas for the position vector and the velocity vector can be found on the page Constant Force = Parabolic Motion . It is of course also possible to put this force and the initial conditions in a numerical differential equation solver. The force and the mass is loaded into the differential solver below every time the sliders are adjusted. A drag force can be added to the differential equation solver by adding a term to the force that is in the opposite direction of the velocity. If this drag force is linear $\vec{F}_{drag} = -a\vec{v}$, then it is possible to find formulas to describe the resulting motion . However, if the drag force is nonlinear such as, $\vec{F}_{drag} = -a|\vec{v}|\vec{v}$, no simple formulas can be found and a numerical differential equation solver is the best option.
No drag force: $\vec{F} = -mg\sin\theta\cos\theta \,\hat{x} - mg\sin\theta\sin\theta \,\hat{y}$
Linear drag force: $\vec{F} = -mg\sin\theta\cos\theta\, \hat{x} - mg\sin\theta\sin\theta \,\hat{y}-a\vec{v}$
Nonlinear drag force: $\vec{F} = -mg\sin\theta\cos\theta \,\hat{x} - mg\sin\theta\sin\theta \,\hat{y}-a|\vec{v}|\vec{v}$
Air friction
A stone of mass 100 g is thrown with an intitial velocity $|\vec{v}|$ at an angle $\theta$ from horizontal. The stone is released from position $\vec{r}=0$. If air friction is ignored, the equation that describes the motion of the ball is,
$\vec{r} = vt\cos\theta \,\hat{x}+ \left( vt\sin\theta -\frac{gt^2}{2}\right)\,\hat{y}\,\text{m},$
where $g = 9.81$ m/s² is the acceleration of gravity at the earth's surface and $t$ is measured in seconds. The stone follows a parabola and returns to the height from which it was thrown, $y=0$, at a distance $x$ from where it was thrown. For a given initial velocity, the angle that maximizes the distance $x$ is $\theta = \frac{\pi}{4}\,\text{rad} = $ 45°.
If a linear friction force is included in the problem $\vec{F}_{drag} = -b\vec{v}$, then the optimal angle changes. The form below calculates the trajectory of the stone for different angles, friction contants, and intitial velocities.
$\vec{F} = m\frac{d^2\vec{r}}{dt^2} = -b\vec{v}-mg \,\hat{z}$
$b=$ N s/m
The initial conditions at time $t=0$ are $\vec{r}=0$
$|\vec{v}| =$ m/s $\theta=$ deg
A ball is thrown in the wind
A ball of mass $m$ is thrown and experiences a frictional drag force as it moves through a gas or a fluid. The forces acting on this ball are gravity $-mg\hat{z}$ and the drag force. If a wind is blowing, the drag force can be described by,
$\vec{F}_{fric} = -a(\vec{v}-\vec{v}_{\text{wind}}) - b(\vec{v}-\vec{v}_{\text{wind}})|(\vec{v}-\vec{v}_{\text{wind}})|,$
where $a$ and $b$ are constants and $\vec{v}_{\text{wind}}$ is the velocity of the wind which can depend on position and time. For low Reynolds number , the linear term $-a(\vec{v}-\vec{v}_{\text{wind}})$ usually dominates whereas for high Reynolds number, the quadratic term $- b(\vec{v}-\vec{v}_{\text{wind}})|(\vec{v}-\vec{v}_{\text{wind}})|$ dominates.
$\vec{F}= m\frac{d^2\vec{r}}{dt^2} = -a(\vec{v}-\vec{v}_{\text{wind}}) - b(\vec{v}-\vec{v}_{\text{wind}})|(\vec{v}-\vec{v}_{\text{wind}})|-mg\,\hat{z}$
$m=$ kg $a=$ N s/m $b=$ N s²/m²
The three components of the wind vectors can be functions of space and time.
$v_{\text{wind},x}=$ m/s $v_{\text{wind},y}=$ m/s $v_{\text{wind},z}=$ m/s
The initial conditions at time $t=0$ are,
$x=$ m $y=$ m $z=$ m
$v_x=$ m/s $v_y=$ m/s $v_z=$ m/s
Rocket launch
A model rocket with a mass $m$ is launched with a motor that provides a upward force of $F_{\text{thrust}}$ for 3 seconds. This force can be expressed mathematically as $\vec{F}=F_{\text{thrust}}H(3-t)\hat{z}$ where $H(x)$ is the Heaviside step function . As the rocket uses fuel, its mass decreases. In the example below, the rocket looses half of its mass in the three seconds that it accelerates and then the mass remains constant, $m=0.1(2-H(3-t)t/3-H(t-3))$. Other forces that act on the rocket are gravity $-mg\hat{z}$ and a drag force that can be described by,
$\large \vec{F}_{fric} = -a(\vec{v}-\vec{v}_{\text{wind}}) - b(\vec{v}-\vec{v}_{\text{wind}})|(\vec{v}-\vec{v}_{\text{wind}})|,$
where $a$ and $b$ are constants and $\vec{v}_{\text{wind}}$ is the velocity of the wind which can depend on position and time.
$\vec{F}=0.1(2-H(3-t)t/3-H(t-3))\frac{d^2\vec{r}}{dt^2} = F_{\text{thrust}}H(3-t)\hat{z}-a(\vec{v}-\vec{v}_{\text{wind}}) - b(\vec{v}-\vec{v}_{\text{wind}})|(\vec{v}-\vec{v}_{\text{wind}})|-mg\,\hat{z}$
$m=$ kg $F_{\text{thrust}}=$ N $a=$ N s/m $b=$ N s²/m²
The three components of the wind vectors can be functions of space and time.
$v_{\text{wind},x}=$ m/s $v_{\text{wind},y}=$ m/s $v_{\text{wind},z}=$ m/s
The initial conditions at time $t=0$ are,
$x=$ m $y=$ m $z=$ m
$v_x=$ m/s $v_y=$ m/s $v_z=$ m/s
A bouncing ball
A ball of mass $m$ is thrown and bounces on the floor. The forces acting on this ball are gravity $-mg\hat{z}$, a drag force proportional to the velocity$-a\vec{v}$, and the force exerted by the floor when it bounces. The floor can be described as an elastic material that pushes up with a force $-kzH(-z)\hat{z}$. Here $k$ is the elastic contant and the Heaviside function $H(-z)$ ensures that this force only if the ball falls below $z=0$.
The larger the elastic constant $k$ is, the less the ball will go below $z=0$ and the simulation will approach bounces off a hard floor. However, some care must be taken in choosing the time step $\Delta t$. It should be much smaller than $2\pi\sqrt{m/k}$ so that the solver can describe the bounces off the floor properly. Some differential equation solvers adjust the time step automatically to account for problems like this.
$\vec{F} = m\frac{d^2\vec{r}}{dt^2} = -a\vec{v}-mg\hat{z} -kzH(-z)\hat{z}$
$m=$ kg $a=$ N s/m $k=$ N/m
The initial conditions at time $t=0$ are,
$x=$ m $y=$ m $z=$ m
$v_x=$ m/s $v_y=$ m/s $v_z=$ m/s
Curveball: Magnus effect
A spinning ball thrown through the air will follow a curved path due to the Magnus effect . The Magnus force on a smooth ball is,
$\vec{F}_{\text{Magnus}} = \frac{4}{3} \pi\rho r^3(\vec{\omega}\times\vec{v}),$
where $r$ is the radius of the ball, $\rho$ is the density of the air, $\vec{\omega}$ is the angular frequency of the rotation, and $\vec{v}$ is the velocity of the ball. The drag force in air is approximated as,
$\vec{F}_{\text{drag}} = -\frac{\pi}{2} r^2 \rho C_d|\vec{v}|\vec{v},$
where $C_d$ is the drag coefficient .
$\vec{F}= m\frac{d^2\vec{r}}{dt^2} = -\frac{\pi}{2} r^2 \rho C_d|\vec{v}|\vec{v}+ \frac{4}{3} \pi\rho r^3(\vec{\omega}\times\vec{v})-mg\,\hat{z}$
$m=$ kg $r=$ m
$\rho=$ kg/m³ $C_d=$
The three components of the vector that describes the rotation:
$\vec{\omega}=$ $\hat{x}$ + $\hat{y}$ + $\hat{z}$ rad/s
Generally, the drag coefficient is a function of the velocity and can be expressed in terms of vx, vy, and vz. The rotational velocity will decay with time due to friction. It can be expressed as a function of time.
The initial conditions at time $t=0$ are,
$x=$ m $y=$ m $z=$ m
$v_x=$ m/s $v_y=$ m/s $v_z=$ m/s
Constant electric field
The force on a particle with charge $q$ in a constant electric field $\vec{E}$ is,
$\vec{F} = q\vec{E}$.
A charged particle will follow a parabolic trajectory in a constant electric field.
$m=$ kg $q=$ C
$\vec{E}=$ $\hat{x}$ + $\hat{y}$ + $\hat{z}$ V/m
Electrons are so light that it is necessary to choose a short time step $\Delta t$.
Coulomb potential
A charged particle moving in a Coulomb potential will follow an orbit that is similar to a satellite orbit. The force is,
$\vec{F} = \frac{qQ}{4\pi \epsilon_0}\frac{\vec{r}-\vec{r}_0}{|\vec{r}-\vec{r}_0|^3} \hspace{1cm}\text{[N]}$.
Where $\vec{r}_0$ is the position of the fixed charge $Q$ that generates the Coulomb potential while $q$ is the charge of the mobile particle. For convenience, we take $\vec{r}_0=0$.
$m=$ kg $q=$ C kg $Q=$ C
Potential caused by line of charge
Consider a charged particle moving in the potential caused by a line of charge in the $z-$direction. The electric field is,
$\vec{E}(\vec{r}) = \frac{\lambda}{2\pi\epsilon_0 (x^2+y^2)}\left(x\,\hat{x}+y\,\hat{y}\right)\quad\text{V/m},$
where $\lambda$ is the linear charge density. The force on a particle with charge $q$ and mass $m$ is,
$\vec{F} = q\vec{E}\quad\text{N}.$
$m=$ kg $q=$ C kg $\lambda=$ [C/m]
Electric deflection of electrons
Electrons are accelerated through a voltage $V_x$ towards a positively charged plate. Some of the electrons pass through a small hole in the plate and form and electron beam that travels to a region where an electric field is established by applying a voltage $V_y$ between two metal plates spaced a distance $d$ apart.
The electrons are accelerated from rest with a voltage of $V_x=5000$ V to the positively charged plate in a distance of 5 cm. The electrons get deflected as they pass through the electric field between the plates where $V_y = 60$ V. The force in this case is,
$\vec{F}=m\frac{d^2\vec{r}}{dt^2} = qE_xH(0.05-x)\,\hat{x} +qE_yH(0.1-|x-0.25|)\,\hat{y}$.
A similation of electric deflection is found at Electric deflection of an electron beam .
A charged particle in a constant magnetic field
The force on a particle with charge $q$ in an magnetic field $\vec{B}$ is,
$\vec{F} =q\vec{v}\times\vec{B}.$
If the velocity $\vec{v}$ is parallel to the magnetic field, the force is zero and the particle continues in a straight line. If the initial velocity is only in the plane perpendicular to the magnetic field, the particle will travel in a circle. If the initial velocity has a component in the plane perpendicular to the magnetic field and a component parallel to the field, the particle will follow a helix and spiral around the direction of the magnetic field.
$m=$ kg $q=$ C
$\vec{B}=$ $\hat{x} + $ $\hat{y} + $ $\hat{z}$ [T]
Magnetic deflection of an electron beam
A magnetic field placed perpendicular to the velocity of electrons in an electron beam will bend the electrons in a direction that is perpendicular to both the velocity and the magnetic field. In the diagram below, electrons are accelerated through a voltage $V_x= 5000$ V towards a positively charged plate. Some of the electrons pass through a small hole in the plate and form and electron beam that travels to a circular region where a magnetic field $\vec{B} = 0.0025\,\hat{z}$ T is generated by a solenoid. The Lorentz force deflects the electrons and they follow a circular path in the magnetic field. The beam then travels further and strikes a screen that is 15 cm to the right of the center of the solenoid.
A simulation of magnetic deflection can be found at Magnetic deflection of an electron beam .
J. J. Thomson's experiment to determine the charge-to-mass ratio of electrons
J. J. Thomson performed experiments to show that atoms consisted of sub atomic particles that had positive and negative charges. He determined that the negatively charged particles (electrons) were much lighter than the positively charged particles. The electron charge-to-mass ratio was measured by accelerating the electrons through a voltage $V_x$ towards a positively charged plate. Some of the electrons pass through a small hole in the plate and form and electron beam that travels to a region where an electric field and a magnetic field was present. The electrons were accelerated in the $x$-direction, the electric field was in the $y$-direction and the magnetic field was in the $z$-direction.
The force on an electron due to the electric field is $\vec{F}_{\text{elec}}=-|e|E_y\hat{y}$ and the force on an electron due to the magnetic field is $\vec{F}_{\text{magn}}=|e|v_xB\hat{y}$. The velocity of the electrons can be determined because as the electrons are accelerated in the $x$-direction, the potential energy $|e|V_x$ is converted into kinetic energy, $\frac{1}{2}mv_x^2=|e|V_x$. Therefore $v_x=\sqrt{2|e|V_x/m}$. If the experiment is adjusted so that the electric and magnetic forces cancel each other out $|e|v_xB\hat{y}-|e|E_y\hat{y}=0$, then the charge-to-mass ratio is given by,
$\large \frac{e}{m}=\frac{V_y^2}{2V_x\mu_0^2n^2I^2d^2}.$
The calculation below is for $V_x = 5000$ V, $V_y = 60$ V, $\vec{B}= 0.00025\,\hat{z}$ T. Initially, the electrons have zero velocity. The metal plates are 10 cm long with a spacing $d=$ 2 cm. More details can be found at J. J. Thomson's experiment to determine the charge-to-mass ratio of electrons .
An electron moves in the magnetic field caused by a current carrying wire.
A magnetic field is generated by a current flowing through a long straight wire in the +$z$ direction,
$\vec{B}(\vec{r})=\frac{\mu_0I}{2\pi(x^2+y^2)}\,\hat{z}\times (x\hat{x} + y\hat{y})\,\,\text{[T]}$
where $I$ is the current. For details see: The magnetic field around an infinitely-long straight wire .
The force on a particle with charge $q$ in this magnetic field is,
$\vec{F} =q\vec{v}\times\vec{B}.$
The values for an are initally loaded into the form. The electron moves along a complicated trajectory around the wire. Notice that the work performed (the last column in the table below) remains zero (within numrical error) because the force is always perpendicular to the velocity.
$m=$ kg $q=$ C $I=$ A
A charged particle in electric and magnetic fields
When a charged particle with a charge $q$ and a mass $m$ moves in a electric field $\vec{E}$ and a magnetic field $\vec{B}$, the force on the particle is,
$ \vec{F} = q(\vec{E} + \vec{v}\times \vec{B}).$
Written out in terms of its three components, the Lorentz force is,
$F_x = q(E_x+v_yB_z-v_zB_y)$, $F_y = q(E_y+v_zB_x-v_xB_z)$, $F_z = q(E_z+v_xB_y-v_yB_x).$
The components of the electric and magnetic fields can be specified in the text boxes below these can then be loaded into the general 3-D motion differential equation solver to calculate the trajectory of the charged particle.
$m=$ kg $q=$ C
$E_x(x,y,z,t)=$ V/m $E_y(x,y,z,t)=$ V/m $E_z(x,y,z,t)=$ V/m
$B_x(x,y,z,t)=$ T $B_y(x,y,z,t)=$ T $B_z(x,y,z,t)=$ T
When a constant uniform electric field is perpendicular to a constant uniform magnetic field, the average velocity of the charged particle will be in the direction perpendicular to both the electric field and the magnetic field. Note that electrons move very fast so a short time step $\Delta t$ must be selected.
Mass-nonlinear spring system
For a linear spring, the force is proportional to the extension of the spring, $F=-kx$. For a hard spring, the force grows faster than linearly as the spring is extended. An example of a hard spring force is $F=-kx|x|$. For a soft spring, the force grows slower than linearly as the spring is extended. An example of a soft spring force is $F=-k\sin(x)$. If friction is neglected, the mass oscillates around the equilibrium position of the spring. For nonlinear springs, the oscillation frequency depends on the amplitude of the oscillations. For hard springs, the frequency increases with amplitude and for soft springs, the frequency decreases with amplitude.
Hard spring $F=-kx|x|$
Linear spring $F=-kx$
Soft spring $F=-k\sin(x)$
$m=$ kg $k=$ N/m
Resonance: Damped driven mass-spring system
A mass $m$ is attached to a linear spring with a spring constant $k$. A drag force acts on the mass that is in the opposite direction as the velocity $F_{\text{drag}}=-bv_x$ where $b$ is the drag force constant. The system is driven by a periodic drive force $F_0\cos(\Omega t)$. The differential equation that describes the motion is,
$\large m\frac{d^2x}{dt^2}+b\frac{dx}{dt}+kx=F_0\cos(\Omega t).$
The resonance frequency is $\omega=\sqrt{k/m-b^2/4m^2}=$ 0.943 rad/s. The maximum response will be when the drive frequency equals the resonance frequency. The amplitude of the steady-state oscillations are $F_0/\sqrt{(k-m\Omega^2)^2+\Omega^2b^2}=$ 0.447 m.
For more details see: Resonance of a damped driven harmonic oscillator .
Chaotic solutions to the driven pendulum
The differential equation that describes the motion of a driven pendulum is, [Fitzpatrick 2006] ,
$\large \frac{d^2\theta}{dt^2}+\frac{1}{q}\frac{d\theta}{dt}+\sin(\theta)=A\cos(\Omega t),$
where $q$ describes the damping, $A$ measures the torque that is used to drive the pendulum at frequency $\Omega$ and $\theta$ is the angle measured from vertical. At $\theta=0$ the pendulum hangs down and at $\theta=\pi$ the pendulum stands up. This equation is known to exhibit chaotic solutions.
More details can be found at Chaotic solutions to the driven pendulum .
Swinging spring
The swinging spring or the elastic pendulum is a mass connected to one end of an elastic rod that stretch but cannot bend. The other end of the rod is attached at one fixed point so that the mass can swing freely. This system can execute complex motion and for some initial conditions it executes chaotic motion. The equations are:
$\large m\frac{d^2x}{dt^2}=-m\omega^2\left(\frac{|\vec{r}| -l}{|\vec{r}|}\right)x$
$\large m\frac{d^2y}{dt^2}=-m\omega^2\left(\frac{|\vec{r}| -l}{|\vec{r}|}\right)y$
$\large m\frac{d^2z}{dt^2}=-m\omega^2\left(\frac{|\vec{r}| -l}{|\vec{r}|}\right)z-mg$
where $m$ is the mass of the rod, $l$ is the unstretched length of the rod, $g = 9.807$ is the acceleration of gravity at the earth's surface, $\omega^2=k/m$, and $|\vec{r}| =\sqrt{x^2+y^2+z^2}$.