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

Function circle_bottom_arc_integral

project_euler/problem_587/sol1.py:32–48  ·  view source on GitHub ↗

Returns integral of circle bottom arc y = 1 / 2 - sqrt(1 / 4 - (x - 1 / 2) ^ 2) >>> circle_bottom_arc_integral(0) 0.39269908169872414 >>> circle_bottom_arc_integral(1 / 2) 0.44634954084936207 >>> circle_bottom_arc_integral(1) 0.5

(point: float)

Source from the content-addressed store, hash-verified

30
31
32def circle_bottom_arc_integral(point: float) -> float:
33 """
34 Returns integral of circle bottom arc y = 1 / 2 - sqrt(1 / 4 - (x - 1 / 2) ^ 2)
35
36 >>> circle_bottom_arc_integral(0)
37 0.39269908169872414
38
39 >>> circle_bottom_arc_integral(1 / 2)
40 0.44634954084936207
41
42 >>> circle_bottom_arc_integral(1)
43 0.5
44 """
45
46 return (
47 (1 - 2 * point) * sqrt(point - point**2) + 2 * point + asin(sqrt(1 - point))
48 ) / 4
49
50
51def concave_triangle_area(circles_number: int) -> float:

Callers 1

concave_triangle_areaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected