mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-30 06:03:42 +00:00
Fix sphinx/build_docs warnings for physics/horizontal_projectile_motion (#12467)
This commit is contained in:
parent
04fbfd6eae
commit
e9721aad59
|
@ -1,15 +1,18 @@
|
||||||
"""
|
"""
|
||||||
Horizontal Projectile Motion problem in physics.
|
Horizontal Projectile Motion problem in physics.
|
||||||
|
|
||||||
This algorithm solves a specific problem in which
|
This algorithm solves a specific problem in which
|
||||||
the motion starts from the ground as can be seen below:
|
the motion starts from the ground as can be seen below::
|
||||||
(v = 0)
|
|
||||||
* *
|
(v = 0)
|
||||||
* *
|
* *
|
||||||
* *
|
* *
|
||||||
* *
|
* *
|
||||||
* *
|
* *
|
||||||
* *
|
* *
|
||||||
GROUND GROUND
|
* *
|
||||||
|
GROUND GROUND
|
||||||
|
|
||||||
For more info: https://en.wikipedia.org/wiki/Projectile_motion
|
For more info: https://en.wikipedia.org/wiki/Projectile_motion
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -43,14 +46,17 @@ def check_args(init_velocity: float, angle: float) -> None:
|
||||||
|
|
||||||
|
|
||||||
def horizontal_distance(init_velocity: float, angle: float) -> float:
|
def horizontal_distance(init_velocity: float, angle: float) -> float:
|
||||||
"""
|
r"""
|
||||||
Returns the horizontal distance that the object cover
|
Returns the horizontal distance that the object cover
|
||||||
|
|
||||||
Formula:
|
Formula:
|
||||||
v_0^2 * sin(2 * alpha)
|
.. math::
|
||||||
---------------------
|
\frac{v_0^2 \cdot \sin(2 \alpha)}{g}
|
||||||
g
|
|
||||||
v_0 - initial velocity
|
v_0 - \text{initial velocity}
|
||||||
alpha - angle
|
|
||||||
|
\alpha - \text{angle}
|
||||||
|
|
||||||
>>> horizontal_distance(30, 45)
|
>>> horizontal_distance(30, 45)
|
||||||
91.77
|
91.77
|
||||||
>>> horizontal_distance(100, 78)
|
>>> horizontal_distance(100, 78)
|
||||||
|
@ -70,14 +76,17 @@ def horizontal_distance(init_velocity: float, angle: float) -> float:
|
||||||
|
|
||||||
|
|
||||||
def max_height(init_velocity: float, angle: float) -> float:
|
def max_height(init_velocity: float, angle: float) -> float:
|
||||||
"""
|
r"""
|
||||||
Returns the maximum height that the object reach
|
Returns the maximum height that the object reach
|
||||||
|
|
||||||
Formula:
|
Formula:
|
||||||
v_0^2 * sin^2(alpha)
|
.. math::
|
||||||
--------------------
|
\frac{v_0^2 \cdot \sin^2 (\alpha)}{2 g}
|
||||||
2g
|
|
||||||
v_0 - initial velocity
|
v_0 - \text{initial velocity}
|
||||||
alpha - angle
|
|
||||||
|
\alpha - \text{angle}
|
||||||
|
|
||||||
>>> max_height(30, 45)
|
>>> max_height(30, 45)
|
||||||
22.94
|
22.94
|
||||||
>>> max_height(100, 78)
|
>>> max_height(100, 78)
|
||||||
|
@ -97,14 +106,17 @@ def max_height(init_velocity: float, angle: float) -> float:
|
||||||
|
|
||||||
|
|
||||||
def total_time(init_velocity: float, angle: float) -> float:
|
def total_time(init_velocity: float, angle: float) -> float:
|
||||||
"""
|
r"""
|
||||||
Returns total time of the motion
|
Returns total time of the motion
|
||||||
|
|
||||||
Formula:
|
Formula:
|
||||||
2 * v_0 * sin(alpha)
|
.. math::
|
||||||
--------------------
|
\frac{2 v_0 \cdot \sin (\alpha)}{g}
|
||||||
g
|
|
||||||
v_0 - initial velocity
|
v_0 - \text{initial velocity}
|
||||||
alpha - angle
|
|
||||||
|
\alpha - \text{angle}
|
||||||
|
|
||||||
>>> total_time(30, 45)
|
>>> total_time(30, 45)
|
||||||
4.33
|
4.33
|
||||||
>>> total_time(100, 78)
|
>>> total_time(100, 78)
|
||||||
|
@ -125,6 +137,8 @@ def total_time(init_velocity: float, angle: float) -> float:
|
||||||
|
|
||||||
def test_motion() -> None:
|
def test_motion() -> None:
|
||||||
"""
|
"""
|
||||||
|
Test motion
|
||||||
|
|
||||||
>>> test_motion()
|
>>> test_motion()
|
||||||
"""
|
"""
|
||||||
v0, angle = 25, 20
|
v0, angle = 25, 20
|
||||||
|
|
Loading…
Reference in New Issue
Block a user