r""" Returns the maximum height that the object reach Formula: .. 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) 487.82
(init_velocity: float, angle: float)
| 76 | |
| 77 | |
| 78 | def max_height(init_velocity: float, angle: float) -> float: |
| 79 | r""" |
| 80 | Returns the maximum height that the object reach |
| 81 | |
| 82 | Formula: |
| 83 | .. math:: |
| 84 | \frac{v_0^2 \cdot \sin^2 (\alpha)}{2 g} |
| 85 | |
| 86 | v_0 - \text{initial velocity} |
| 87 | |
| 88 | \alpha - \text{angle} |
| 89 | |
| 90 | >>> max_height(30, 45) |
| 91 | 22.94 |
| 92 | >>> max_height(100, 78) |
| 93 | 487.82 |
| 94 | >>> max_height("a", 20) |
| 95 | Traceback (most recent call last): |
| 96 | ... |
| 97 | TypeError: Invalid velocity. Should be an integer or float. |
| 98 | >>> horizontal_distance(30, "b") |
| 99 | Traceback (most recent call last): |
| 100 | ... |
| 101 | TypeError: Invalid angle. Should be an integer or float. |
| 102 | """ |
| 103 | check_args(init_velocity, angle) |
| 104 | radians = deg_to_rad(angle) |
| 105 | return round(init_velocity**2 * sin(radians) ** 2 / (2 * g), 2) |
| 106 | |
| 107 | |
| 108 | def total_time(init_velocity: float, angle: float) -> float: |