Problem Description
Simulate the trajectory of a projectile launched at an initial speed $( v_0 )$ and angle $( \theta )$ from the horizontal.
Assume:
- The motion occurs in a vacuum (no air resistance).
- The acceleration due to gravity is $( g = 9.8 , \text{m/s}^2 )$.
The equations of motion are:
$$
x(t) = v_0 \cos(\theta) t
$$
$$
y(t) = v_0 \sin(\theta) t - \frac{1}{2} g t^2
$$
- $ x(t) $: Horizontal position.
- $ y(t) $: Vertical position.
- $ t $: Time.
Python Implementation
1 | import numpy as np |
Code Explanation
- Constants:
Define gravity $( g )$, initial speed $( v_0 )$, and launch angle $( \theta )$. - Time of Flight:
Calculate the total time the projectile remains in the air using $( t_{\text{flight}} = \frac{2 v_0 \sin(\theta)}{g} )$. - Equations of Motion:
Compute horizontal $( x )$ and vertical $( y )$ positions for a range of time values $( t )$. - Plotting:
Plot the $( x )$ - $( y )$ trajectory to visualize the motion.
Results and Visualization
The graph shows the parabolic trajectory of the projectile:
- The projectile starts at the origin $( x = 0, y = 0 )$.
- It reaches a maximum height midway through its flight.
- The projectile lands back at ground level $( y = 0 )$ after covering a horizontal distance determined by the initial velocity and angle.
This visualization helps understand the fundamental aspects of projectile motion, including its symmetric nature and dependency on the launch angle and speed.