mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-18 08:17:01 +00:00
Add doctest to maths/numerical_analysis/intersection.py (#12148)
This commit is contained in:
parent
2ca96b7c8e
commit
24923ee635
|
@ -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
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user