Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sphinx/build_docs warnings for physics/horizontal_projectile_motion #12467

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 41 additions & 27 deletions physics/horizontal_projectile_motion.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
"""
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
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
"""

Expand Down Expand Up @@ -43,14 +46,17 @@ def check_args(init_velocity: float, angle: float) -> None:


def horizontal_distance(init_velocity: float, angle: float) -> float:
"""
r"""
Returns the horizontal distance that the object cover

Formula:
v_0^2 * sin(2 * alpha)
---------------------
g
v_0 - initial velocity
alpha - angle
.. math::
\frac{v_0^2 \cdot \sin(2 \alpha)}{g}

v_0 - \text{initial velocity}

\alpha - \text{angle}

>>> horizontal_distance(30, 45)
91.77
>>> horizontal_distance(100, 78)
Expand All @@ -70,14 +76,17 @@ def horizontal_distance(init_velocity: float, angle: float) -> float:


def max_height(init_velocity: float, angle: float) -> float:
"""
r"""
Returns the maximum height that the object reach

Formula:
v_0^2 * sin^2(alpha)
--------------------
2g
v_0 - initial velocity
alpha - angle
.. math::
\frac{v_0^2 \cdot \sin^2 (\alpha)}{2 g}

v_0 - \text{initial velocity}

\alpha - \text{angle}

>>> max_height(30, 45)
22.94
>>> max_height(100, 78)
Expand All @@ -97,14 +106,17 @@ def max_height(init_velocity: float, angle: float) -> float:


def total_time(init_velocity: float, angle: float) -> float:
"""
r"""
Returns total time of the motion

Formula:
2 * v_0 * sin(alpha)
--------------------
g
v_0 - initial velocity
alpha - angle
.. math::
\frac{2 v_0 \cdot \sin (\alpha)}{g}

v_0 - \text{initial velocity}

\alpha - \text{angle}

>>> total_time(30, 45)
4.33
>>> total_time(100, 78)
Expand All @@ -125,6 +137,8 @@ def total_time(init_velocity: float, angle: float) -> float:

def test_motion() -> None:
"""
Test motion

>>> test_motion()
"""
v0, angle = 25, 20
Expand Down
Loading