mirror of
https://hub.njuu.cf/TheAlgorithms/Python.git
synced 2023-10-11 13:06:12 +08:00
Update horizontal_projectile_motion.py
This commit is contained in:
parent
ee49ce7022
commit
07646ac92b
@ -21,7 +21,6 @@ from math import sin
|
|||||||
# Acceleration Constant on hearth (unit m/s^2)
|
# Acceleration Constant on hearth (unit m/s^2)
|
||||||
g = 9.80665
|
g = 9.80665
|
||||||
|
|
||||||
|
|
||||||
def horizontal_distance(init_velocity: float, angle: float) -> float:
|
def horizontal_distance(init_velocity: float, angle: float) -> float:
|
||||||
"""
|
"""
|
||||||
Returns the horizontal distance that the object cover
|
Returns the horizontal distance that the object cover
|
||||||
@ -40,7 +39,7 @@ def horizontal_distance(init_velocity: float, angle: float) -> float:
|
|||||||
414.76
|
414.76
|
||||||
"""
|
"""
|
||||||
radians = angle_to_radians(2 * angle)
|
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:
|
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)
|
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:
|
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)
|
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:
|
def test_motion() -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user