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¶
Functions¶
|
Check that the arguments are valid |
|
Returns the horizontal distance that the object cover |
|
Returns the maximum height that the object reach |
|
Test motion |
|
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:
- \[ \begin{align}\begin{aligned}\frac{v_0^2 \cdot \sin(2 \alpha)}{g}\\v_0 - \text{initial velocity}\\\alpha - \text{angle}\end{aligned}\end{align} \]
>>> 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:
- \[ \begin{align}\begin{aligned}\frac{v_0^2 \cdot \sin^2 (\alpha)}{2 g}\\v_0 - \text{initial velocity}\\\alpha - \text{angle}\end{aligned}\end{align} \]
>>> 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
>>> test_motion()
- physics.horizontal_projectile_motion.total_time(init_velocity: float, angle: float) float ¶
Returns total time of the motion
- Formula:
- \[ \begin{align}\begin{aligned}\frac{2 v_0 \cdot \sin (\alpha)}{g}\\v_0 - \text{initial velocity}\\\alpha - \text{angle}\end{aligned}\end{align} \]
>>> 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¶