r""" | Calculate the Volume of a Circular Cylinder. | Wikipedia reference: https://en.wikipedia.org/wiki/Cylinder :return: :math:`\pi \cdot radius^2 \cdot height` >>> vol_circular_cylinder(1, 1) 3.141592653589793 >>> vol_circular_cylinder(4, 3) 150.79644737231007 >>
(radius: float, height: float)
| 370 | |
| 371 | |
| 372 | def vol_circular_cylinder(radius: float, height: float) -> float: |
| 373 | r""" |
| 374 | | Calculate the Volume of a Circular Cylinder. |
| 375 | | Wikipedia reference: https://en.wikipedia.org/wiki/Cylinder |
| 376 | |
| 377 | :return: :math:`\pi \cdot radius^2 \cdot height` |
| 378 | |
| 379 | >>> vol_circular_cylinder(1, 1) |
| 380 | 3.141592653589793 |
| 381 | >>> vol_circular_cylinder(4, 3) |
| 382 | 150.79644737231007 |
| 383 | >>> vol_circular_cylinder(1.6, 1.6) |
| 384 | 12.867963509103795 |
| 385 | >>> vol_circular_cylinder(0, 0) |
| 386 | 0.0 |
| 387 | >>> vol_circular_cylinder(-1, 1) |
| 388 | Traceback (most recent call last): |
| 389 | ... |
| 390 | ValueError: vol_circular_cylinder() only accepts non-negative values |
| 391 | >>> vol_circular_cylinder(1, -1) |
| 392 | Traceback (most recent call last): |
| 393 | ... |
| 394 | ValueError: vol_circular_cylinder() only accepts non-negative values |
| 395 | """ |
| 396 | if height < 0 or radius < 0: |
| 397 | raise ValueError("vol_circular_cylinder() only accepts non-negative values") |
| 398 | # Volume is radius squared * height * pi |
| 399 | return pow(radius, 2) * height * pi |
| 400 | |
| 401 | |
| 402 | def vol_hollow_circular_cylinder( |