Skip to content

Commit 3ec7eef

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 26093f7 commit 3ec7eef

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

physics/escape_velocity.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def escape_velocity(mass: float, radius: float) -> float:
2424
2525
Returns:
2626
float: Escape velocity in meters per second, rounded to 3 decimal places.
27-
27+
2828
Examples:
2929
>>> escape_velocity(5.972e24, 6.371e6) # Earth
3030
11185.978
@@ -49,6 +49,7 @@ def escape_velocity(mass: float, radius: float) -> float:
4949
velocity = math.sqrt(2 * gravitational_constant * mass / radius)
5050
return round(velocity, 3)
5151

52+
5253
if __name__ == "__main__":
5354
import doctest
5455

physics/workdone.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import math
22

3-
def orbital_transfer_work(mass_central: float, mass_object: float,
4-
r_initial: float, r_final: float) -> str:
3+
4+
def orbital_transfer_work(
5+
mass_central: float, mass_object: float, r_initial: float, r_final: float
6+
) -> str:
57
"""
68
Calculates the work required to move an object from one orbit to another in a
79
gravitational field based on the change in total mechanical energy.
@@ -39,12 +41,15 @@ def orbital_transfer_work(mass_central: float, mass_object: float,
3941
if r_initial <= 0 or r_final <= 0:
4042
raise ValueError("Orbital radii must be greater than zero.")
4143

42-
work = (gravitational_constant * mass_central * mass_object / 2) * (1 / r_initial - 1 / r_final)
44+
work = (gravitational_constant * mass_central * mass_object / 2) * (
45+
1 / r_initial - 1 / r_final
46+
)
4347
return f"{work:.3e}"
4448

4549

4650
if __name__ == "__main__":
4751
import doctest
52+
4853
doctest.testmod()
4954
print("Orbital transfer work calculator\n")
5055

0 commit comments

Comments
 (0)