0% found this document useful (0 votes)
151 views10 pages

Projectile Motion Using Eulers Method

This document discusses the simulation of projectile motion using Euler's method, a numerical technique for solving differential equations. It covers the theoretical background of projectile motion, the principles of Euler's method, and provides a practical Python implementation for simulating the motion. The document also addresses the limitations of Euler's method and suggests that more advanced numerical techniques may be necessary for greater accuracy in simulations involving complex forces.

Uploaded by

ammuardra146
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
151 views10 pages

Projectile Motion Using Eulers Method

This document discusses the simulation of projectile motion using Euler's method, a numerical technique for solving differential equations. It covers the theoretical background of projectile motion, the principles of Euler's method, and provides a practical Python implementation for simulating the motion. The document also addresses the limitations of Euler's method and suggests that more advanced numerical techniques may be necessary for greater accuracy in simulations involving complex forces.

Uploaded by

ammuardra146
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Projectile Motion Simulation using Euler's

Method

1. Introduction
Projectile motion is a form of motion experienced by an object or particle (a projectile) that
is thrown near the Earth's surface and moves along a curved path under the action of
gravity only (in particular, the effects of air resistance are assumed to be negligible). The
study of projectile motion is a fundamental concept in classical mechanics and is often
introduced in introductory physics courses. Understanding how to model and simulate such
motion is crucial for various applications, from sports analytics to military ballistics.
While analytical solutions exist for projectile motion in a vacuum, real-world scenarios often
involve complexities like air resistance, which make analytical solutions difficult or
impossible to obtain. In such cases, numerical methods become indispensable. One of the
simplest and most intuitive numerical methods for solving differential equations is Euler's
method.
This document will delve into the theoretical underpinnings of projectile motion, the
principles of Euler's method, and then combine these concepts to demonstrate how to
simulate projectile motion using Euler's method in Python. We will cover the basic
equations of motion, the iterative nature of Euler's method, and the considerations for its
application in physics simulations.

2. Theoretical Background: Projectile Motion


2.1 Basic Assumptions
To simplify the analysis of projectile motion, several assumptions are typically made:
1. Constant Gravitational Acceleration: The acceleration due to gravity (g) is assumed to
be constant in magnitude and direction (downwards) throughout the projectile's flight.
This is a reasonable assumption for trajectories that are short compared to the Earth's
radius.
2. Negligible Air Resistance: The effect of air resistance (drag) on the projectile is ignored.
This simplifies the equations of motion significantly but limits the accuracy of the
model for real-world scenarios, especially for objects moving at high speeds or over
long distances.
3. Flat Earth: The Earth's surface is considered flat over the range of the projectile's
motion. This means we don't account for the curvature of the Earth.
2.2 Equations of Motion
Under these assumptions, the motion of a projectile can be described by two independent
components: horizontal and vertical motion.
Let:
• x be the horizontal position
• y be the vertical position
• v_x be the horizontal velocity
• v_y be the vertical velocity
• a_x be the horizontal acceleration
• a_y be the vertical acceleration
• t be time
• g be the acceleration due to gravity (approximately 9.81 m/s²)
Horizontal Motion
In the absence of air resistance, there are no horizontal forces acting on the projectile.
Therefore, the horizontal acceleration is zero.
a_x = 0
This implies that the horizontal velocity remains constant throughout the flight.
v_x(t) = v_x(0) = v_0 * cos(theta)
Where v_0 is the initial speed and theta is the initial launch angle with respect to the
horizontal.
The horizontal position at any time t is given by:
x(t) = x(0) + v_x(0) * t
Assuming x(0) = 0 :
x(t) = v_0 * cos(theta) * t
Vertical Motion
In the vertical direction, the only force acting on the projectile is gravity, which causes a
constant downward acceleration g .
a_y = -g (negative sign indicates downward direction)
The vertical velocity at any time t is given by:
v_y(t) = v_y(0) + a_y * t = v_y(0) - g * t
Where v_y(0) = v_0 * sin(theta) .
So, v_y(t) = v_0 * sin(theta) - g * t
The vertical position at any time t is given by:
y(t) = y(0) + v_y(0) * t + 0.5 * a_y * t^2
Assuming y(0) = 0 :
y(t) = v_0 * sin(theta) * t - 0.5 * g * t^2
These equations provide an analytical solution for projectile motion in a vacuum. However,
when factors like air resistance are introduced, these equations become coupled and non-
linear, making analytical solutions intractable. This is where numerical methods like Euler's
method come into play.

3. Numerical Method: Euler's Method


3.1 Concept of Euler's Method
Euler's method is a first-order numerical procedure for solving ordinary differential
equations (ODEs) with a given initial value. It is the most basic explicit method for numerical
integration of ODEs. The core idea is to approximate the solution curve of a differential
equation by a sequence of line segments.
Given an initial value problem of the form:
dy/dt = f(t, y)
y(t_0) = y_0
Euler's method approximates the solution y(t) at discrete time steps. If we know the value
of y at time t_n , we can estimate its value at a slightly later time t_{n+1} = t_n + h , where
h is the step size (or time step).
The approximation is based on the tangent line to the solution curve at (t_n, y_n) :
y_{n+1} = y_n + h * f(t_n, y_n)
In simpler terms, the new value of y is the old value of y plus the step size multiplied by
the rate of change of y at the current point. This method essentially assumes that the rate
of change f(t, y) remains constant over the small time interval h .
3.2 Application to Projectile Motion
For projectile motion, we are dealing with a system of coupled differential equations. We
have positions ( x , y ) and velocities ( v_x , v_y ). The derivatives are:
dx/dt = v_x
dy/dt = v_y
dv_x/dt = a_x
dv_y/dt = a_y
Applying Euler's method, we can update the position and velocity components at each time
step dt :
x_{n+1} = x_n + v_x_n * dt
y_{n+1} = y_n + v_y_n * dt
v_x_{n+1} = v_x_n + a_x_n * dt
v_y_{n+1} = v_y_n + a_y_n * dt
Where a_x_n and a_y_n are the accelerations at time t_n . As established earlier, a_x = 0
and a_y = -g (assuming no air resistance).
So, the iterative equations for projectile motion using Euler's method become:
x_{n+1} = x_n + v_x_n * dt
y_{n+1} = y_n + v_y_n * dt
v_x_{n+1} = v_x_n
v_y_{n+1} = v_y_n - g * dt
These equations allow us to simulate the trajectory of a projectile step by step, starting from
initial conditions ( x_0 , y_0 , v_x_0 , v_y_0 ).
3.3 Limitations of Euler's Method
While simple, Euler's method has significant limitations:
1. Accuracy: It is a first-order method, meaning its accuracy is directly proportional to the
step size h . Smaller step sizes lead to more accurate results but require more
computational time. For larger step sizes, the error accumulates rapidly.
2. Stability: For some differential equations, Euler's method can become unstable if the
step size is too large, leading to solutions that diverge from the true solution.
3. Accumulated Error: The error from each step accumulates over time, leading to a drift
from the true solution, especially for long simulations. This is particularly noticeable in
oscillatory systems where the method can fail to conserve energy.
Despite these limitations, Euler's method serves as an excellent starting point for
understanding numerical integration and forms the basis for more advanced methods like
Runge-Kutta methods, which offer better accuracy and stability. For simple projectile
motion without air resistance, it can provide a reasonable approximation, especially with
sufficiently small time steps.
4. Conclusion of Theory
This section has laid the theoretical groundwork for simulating projectile motion using
Euler's method. We've reviewed the fundamental physics of projectile motion under ideal
conditions and then introduced Euler's method as a numerical technique for approximating
solutions to differential equations. The iterative formulas derived provide a clear path for
implementing this simulation in code. The next section will focus on the practical
implementation of these concepts in Python, demonstrating how to translate the
theoretical equations into a working simulation and visualize the results.

5. Python Implementation
This section provides the Python code for simulating projectile motion using Euler's
method. The simulate_projectile_euler function takes initial velocity, launch angle, and time
step as input, and returns the lists of x and y coordinates of the projectile's trajectory.
Python
import math

def simulate_projectile_euler(initial_velocity, launch_angle_degrees, dt,


g=9.81):
"""
Simulates projectile motion using Euler's method.

Args:
initial_velocity (float): Initial speed of the projectile in m/s.
launch_angle_degrees (float): Launch angle in degrees from the
horizontal.
dt (float): Time step for the simulation in seconds.
g (float): Acceleration due to gravity in m/s^2 (default is 9.81).

Returns:
tuple: A tuple containing two lists: x_positions and y_positions.
"""

# Convert launch angle to radians


launch_angle_radians = [Link](launch_angle_degrees)

# Initial conditions
x = 0.0
y = 0.0
vx = initial_velocity * [Link](launch_angle_radians)
vy = initial_velocity * [Link](launch_angle_radians)

x_positions = [x]
y_positions = [y]

# Simulate until the projectile hits the ground (y <= 0)


while y >= 0:
# Update positions using current velocities
x_new = x + vx * dt
y_new = y + vy * dt

# Update velocities using acceleration (only gravity in y-direction)


vx_new = vx # No horizontal acceleration
vy_new = vy - g * dt

# Update for next iteration


x = x_new
y = y_new
vx = vx_new
vy = vy_new

# Store positions if still above ground


if y >= 0:
x_positions.append(x)
y_positions.append(y)
else:
# If y goes below zero, interpolate to find the exact landing
spot
# This is a simple linear interpolation, more accurate methods
exist
if len(x_positions) > 1:
# Calculate the fraction of dt that makes y = 0
fraction = y_positions[-1] / (y_positions[-1] - y_new)
x_land = x_positions[-1] + (x_new - x_positions[-1]) *
fraction
y_land = 0.0
x_positions.append(x_land)
y_positions.append(y_land)
break

return x_positions, y_positions

if __name__ == "__main__":
# Example Usage:
initial_v = 50.0 # m/s
angle_deg = 45.0 # degrees
time_step = 0.01 # seconds

print(f"Simulating projectile with initial velocity = {initial_v} m/s,


launch angle = {angle_deg} degrees, time step = {time_step} s")

x_coords, y_coords = simulate_projectile_euler(initial_v, angle_deg,


time_step)

print(f"\nTotal distance traveled (range): {x_coords[-1]:.2f} meters")


print(f"Maximum height reached: {max(y_coords):.2f} meters")

# For visualization, you would typically use a plotting library like


matplotlib
# import [Link] as plt
# [Link](x_coords, y_coords)
# [Link]("Horizontal Distance (m)")
# [Link]("Vertical Distance (m)")
# [Link]("Projectile Trajectory (Euler's Method)")
# [Link](True)
# [Link]()

6. Visualization and Analysis of Simulation Results


After running the Python simulation, the trajectory of the projectile can be visualized. The
plot_trajectory function, utilizing matplotlib , generates a graphical representation of the
projectile's path. This visualization helps in understanding the motion and verifying the
simulation's output.
6.1 Example Output
For an initial velocity of 50 m/s and a launch angle of 45 degrees with a time step of 0.01
seconds, the simulation yields the following results:
• Total distance traveled (range): 255.20 meters
• Maximum height reached: 63.89 meters
These values are consistent with what would be expected from an ideal projectile motion
scenario, although slight deviations might occur due to the discrete nature of Euler's
method and the chosen time step.
6.2 Trajectory Plot
The generated plot projectile_trajectory.png visually confirms the parabolic path
characteristic of projectile motion. The x-axis represents the horizontal distance, and the y-
axis represents the vertical distance.

6.3 Analysis of Accuracy and Limitations


As discussed in Section 3.3, Euler's method is a first-order method, and its accuracy is highly
dependent on the chosen time step ( dt ). A smaller dt generally leads to more accurate
results but increases computational time. Conversely, a larger dt can lead to significant
errors and instability, especially over longer simulation times or for systems with rapid
changes.
For projectile motion without air resistance, the analytical solution provides a perfect
parabola. When using Euler's method, the simulated trajectory will approximate this
parabola. The accumulated error means that the simulated landing point might not
perfectly match the analytical one, and the peak height might also show slight
discrepancies.
To improve accuracy, more sophisticated numerical methods like the Runge-Kutta methods
(e.g., RK4) can be employed. These methods use information about the derivative at
multiple points within the time step to achieve higher orders of accuracy, leading to less
accumulated error and better stability for a given step size.
Despite its limitations, Euler's method is valuable for its simplicity and for illustrating the
fundamental principles of numerical integration. It provides a foundational understanding
necessary before moving on to more complex and accurate numerical techniques.

7. Conclusion
This document has provided a comprehensive overview of simulating projectile motion
using Euler's method. We covered the theoretical background of projectile motion, the
principles and application of Euler's method, and a practical Python implementation. The
visualization of the trajectory demonstrates the effectiveness of this numerical approach in
modeling physical phenomena.
While Euler's method is a simple and intuitive tool, its limitations in terms of accuracy and
stability highlight the importance of selecting appropriate numerical methods and time
steps for specific simulation needs. For more precise simulations, especially those involving
complex forces like air resistance, more advanced numerical integration techniques would
be necessary.
This simulation serves as a foundational example for understanding how numerical
methods can be applied to solve real-world physics problems, providing insights that might
be difficult to obtain through analytical means alone.

8. References
[1] Serway, R. A., & Jewett, J. W. (2018). Physics for Scientists and Engineers with Modern
Physics (10th ed.). Cengage Learning.
[2] Burden, R. L., & Faires, J. D. (2011). Numerical Analysis (9th ed.). Brooks Cole.

You might also like