Leapfrog integration is the process of updating displacements and velocities at staggered points in time so that they “leapfrog” over one another.
Leapfrog integration is a method for numerically integrating differential equations of the type:
In order to solve the above equation the following numerical scheme is used:
The leap frog algorithm is show in the figure below where displacements and velocities are calculated at alternate hopping intervals.
Python Implementation
Importing necessary modules matplotlib
for plotting and numpy
for math operations.
Declaring constants such as gravity, drag coefficient, time steps and initial velocity.
Setting up equations of motion and initial conditions for projectile motion
Solving for Each time step using Leap Frog integration
Plotting results from arrays