Update horizontal_projectile_motion.py

This commit is contained in:
Aviv Faraj 2021-09-07 14:41:47 -04:00 committed by GitHub
parent ee49ce7022
commit 07646ac92b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,6 @@ from math import sin
# Acceleration Constant on hearth (unit m/s^2)
g = 9.80665
def horizontal_distance(init_velocity: float, angle: float) -> float:
"""
Returns the horizontal distance that the object cover
@ -40,7 +39,7 @@ def horizontal_distance(init_velocity: float, angle: float) -> float:
414.76
"""
radians = angle_to_radians(2 * angle)
return round((init_velocity ** 2) * sin(radians) / g, 2)
return round(init_velocity ** 2 * sin(radians) / g, 2)
def max_height(init_velocity: float, angle: float) -> float:
@ -62,7 +61,7 @@ def max_height(init_velocity: float, angle: float) -> float:
"""
radians = angle_to_radians(angle)
return round(((init_velocity ** 2) * (sin(radians)) ** 2) / (2 * g), 2)
return round((init_velocity ** 2 * sin(radians) ** 2) / (2 * g), 2)
def total_time(init_velocity: float, angle: float) -> float:
@ -84,7 +83,7 @@ def total_time(init_velocity: float, angle: float) -> float:
"""
radians = angle_to_radians(angle)
return round((2 * init_velocity) * (sin(radians)) / g, 2)
return round(2 * init_velocity * sin(radians) / g, 2)
def test_motion() -> None: