physics.horizontal_projectile_motion

Horizontal Projectile Motion problem in physics. This algorithm solves a specific problem in which the motion starts from the ground as can be seen below:

(v = 0)

GROUND GROUND For more info: https://en.wikipedia.org/wiki/Projectile_motion

Attributes

g

init_vel

Functions

check_args(→ None)

Check that the arguments are valid

horizontal_distance(→ float)

Returns the horizontal distance that the object cover

max_height(→ float)

Returns the maximum height that the object reach

test_motion(→ None)

total_time(→ float)

Returns total time of the motion

Module Contents

physics.horizontal_projectile_motion.check_args(init_velocity: float, angle: float) None

Check that the arguments are valid

physics.horizontal_projectile_motion.horizontal_distance(init_velocity: float, angle: float) float

Returns the horizontal distance that the object cover Formula:

g

v_0 - initial velocity alpha - angle >>> horizontal_distance(30, 45) 91.77 >>> horizontal_distance(100, 78) 414.76 >>> horizontal_distance(-1, 20) Traceback (most recent call last):

ValueError: Invalid velocity. Should be a positive number. >>> horizontal_distance(30, -20) Traceback (most recent call last):

ValueError: Invalid angle. Range is 1-90 degrees.

physics.horizontal_projectile_motion.max_height(init_velocity: float, angle: float) float

Returns the maximum height that the object reach Formula:

2g

v_0 - initial velocity alpha - angle >>> max_height(30, 45) 22.94 >>> max_height(100, 78) 487.82 >>> max_height(“a”, 20) Traceback (most recent call last):

TypeError: Invalid velocity. Should be a positive number. >>> horizontal_distance(30, “b”) Traceback (most recent call last):

TypeError: Invalid angle. Range is 1-90 degrees.

physics.horizontal_projectile_motion.test_motion() None
>>> test_motion()
physics.horizontal_projectile_motion.total_time(init_velocity: float, angle: float) float

Returns total time of the motion Formula:

g

v_0 - initial velocity alpha - angle >>> total_time(30, 45) 4.33 >>> total_time(100, 78) 19.95 >>> total_time(-10, 40) Traceback (most recent call last):

ValueError: Invalid velocity. Should be a positive number. >>> total_time(30, “b”) Traceback (most recent call last):

TypeError: Invalid angle. Range is 1-90 degrees.

physics.horizontal_projectile_motion.g = 9.80665
physics.horizontal_projectile_motion.init_vel