r""" | Calculate the Volume of a Right Circular Cone. | Wikipedia reference: https://en.wikipedia.org/wiki/Cone :return: :math:`\frac{1}{3} \cdot \pi \cdot radius^2 \cdot height` >>> vol_right_circ_cone(2, 3) 12.566370614359172 >>> vol_right_circ_cone(0, 0) 0.0 >>>
(radius: float, height: float)
| 232 | |
| 233 | |
| 234 | def vol_right_circ_cone(radius: float, height: float) -> float: |
| 235 | r""" |
| 236 | | Calculate the Volume of a Right Circular Cone. |
| 237 | | Wikipedia reference: https://en.wikipedia.org/wiki/Cone |
| 238 | |
| 239 | :return: :math:`\frac{1}{3} \cdot \pi \cdot radius^2 \cdot height` |
| 240 | |
| 241 | >>> vol_right_circ_cone(2, 3) |
| 242 | 12.566370614359172 |
| 243 | >>> vol_right_circ_cone(0, 0) |
| 244 | 0.0 |
| 245 | >>> vol_right_circ_cone(1.6, 1.6) |
| 246 | 4.289321169701265 |
| 247 | >>> vol_right_circ_cone(-1, 1) |
| 248 | Traceback (most recent call last): |
| 249 | ... |
| 250 | ValueError: vol_right_circ_cone() only accepts non-negative values |
| 251 | >>> vol_right_circ_cone(1, -1) |
| 252 | Traceback (most recent call last): |
| 253 | ... |
| 254 | ValueError: vol_right_circ_cone() only accepts non-negative values |
| 255 | """ |
| 256 | if height < 0 or radius < 0: |
| 257 | raise ValueError("vol_right_circ_cone() only accepts non-negative values") |
| 258 | return pi * pow(radius, 2) * height / 3.0 |
| 259 | |
| 260 | |
| 261 | def vol_prism(area_of_base: float, height: float) -> float: |