mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-02-25 02:18:39 +00:00
Update physics/basic_orbital_capture.py
This commit is contained in:
parent
a6d113a2da
commit
c5ed1ae94f
@ -52,14 +52,12 @@ def capture_radii(
|
||||
|
||||
if target_body_mass < 0:
|
||||
raise ValueError("Mass cannot be less than 0")
|
||||
elif target_body_radius < 0:
|
||||
if target_body_radius < 0:
|
||||
raise ValueError("Radius cannot be less than 0")
|
||||
elif projectile_velocity > c:
|
||||
if projectile_velocity > c:
|
||||
raise ValueError("Cannot go beyond speed of light")
|
||||
|
||||
else:
|
||||
escape_velocity_squared = (2 * G * target_body_mass) / target_body_radius
|
||||
|
||||
capture_radius = target_body_radius * sqrt(
|
||||
1 + escape_velocity_squared / pow(projectile_velocity, 2)
|
||||
)
|
||||
@ -89,7 +87,6 @@ def capture_area(capture_radius: float) -> float:
|
||||
|
||||
if capture_radius < 0:
|
||||
raise ValueError("Cannot have a capture radius less than 0")
|
||||
else:
|
||||
sigma = pi * pow(capture_radius, 2)
|
||||
return round(sigma, 0)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user