Add doctest to maths/numerical_analysis/intersection.py (#12148)

This commit is contained in:
Shikhar Maheshwari 2024-12-30 16:21:10 +05:30 committed by GitHub
parent 2ca96b7c8e
commit 24923ee635
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -42,6 +42,11 @@ def intersection(function: Callable[[float], float], x0: float, x1: float) -> fl
def f(x: float) -> float:
"""
function is f(x) = x^3 - 2x - 5
>>> f(2)
-1.0
"""
return math.pow(x, 3) - (2 * x) - 5