5.5.1. Exercise: Trigonometry 1#
A ball is thrown horizontally with a constant horizontal velocity of 10 m/s, and with no initial vertical velocity at release time. Once released, its horizontal velocity stays constant while its vertical velocity increases negatively at a rate of 9.81 m/s². Plot a curve of its total speed during one second from release time. The total speed is the norm of the vector created by the horizontal velocity and the vertical velocity, as shown in Fig. 5.6.
Tip
You already calculated the vertical velocity in Exercise: Arithmetics. Now use the Pythagorean theorem using arithmetic operations on arrays to calculate the total speed v_total
based on v_x
and v_y
.
Show code cell content
import numpy as np
import matplotlib.pyplot as plt
# First, let's define a time array
t = np.linspace(0, 1, 100, endpoint=False)
# Calculate the vertical velocity as -9.81 * t
v_y = -9.81 * t
# Constant horizontal speed of 10 m/s2
v_x = 10
# Calculate the total speed
v_total = np.sqrt(v_x**2 + v_y**2)
# Plot it
plt.plot(t, v_total)
plt.xlabel("Time (s)")
plt.ylabel("Total speed (m/s)")
plt.grid()
plt.show()