MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / capture_area

Function capture_area

physics/basic_orbital_capture.py:66–90  ·  view source on GitHub ↗

Input Param: ------------ capture_radius: The radius of orbital capture and impact for a central body of mass M and a projectile moving towards it with velocity v SI units: meters | m Returns: -------- >>> capture_area(17209590691) 9.304455331329126e+20 >

(capture_radius: float)

Source from the content-addressed store, hash-verified

64
65
66def capture_area(capture_radius: float) -> float:
67 """
68 Input Param:
69 ------------
70 capture_radius: The radius of orbital capture and impact for a central body of
71 mass M and a projectile moving towards it with velocity v
72 SI units: meters | m
73 Returns:
74 --------
75 >>> capture_area(17209590691)
76 9.304455331329126e+20
77 >>> capture_area(-1)
78 Traceback (most recent call last):
79 ...
80 ValueError: Cannot have a capture radius less than 0
81
82 Returned SI units:
83 ------------------
84 meters*meters | m**2
85 """
86
87 if capture_radius < 0:
88 raise ValueError("Cannot have a capture radius less than 0")
89 sigma = pi * pow(capture_radius, 2)
90 return round(sigma, 0)
91
92
93if __name__ == "__main__":

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected