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

Function function_to_integrate

maths/monte_carlo.py:108–114  ·  view source on GitHub ↗

Represents semi-circle with radius 2 >>> [function_to_integrate(x) for x in [-2.0, 0.0, 2.0]] [0.0, 2.0, 0.0]

(x: float)

Source from the content-addressed store, hash-verified

106 """
107
108 def function_to_integrate(x: float) -> float:
109 """
110 Represents semi-circle with radius 2
111 >>> [function_to_integrate(x) for x in [-2.0, 0.0, 2.0]]
112 [0.0, 2.0, 0.0]
113 """
114 return sqrt(4.0 - x * x)
115
116 estimated_value = area_under_curve_estimator(
117 iterations, function_to_integrate, 0.0, 2.0

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected