maths.numerical_analysis.bisection

Functions

bisection(→ float)

finds where function becomes 0 in [a,b] using bolzano

f(→ float)

Module Contents

maths.numerical_analysis.bisection.bisection(function: collections.abc.Callable[[float], float], a: float, b: float) float

finds where function becomes 0 in [a,b] using bolzano >>> bisection(lambda x: x ** 3 - 1, -5, 5) 1.0000000149011612 >>> bisection(lambda x: x ** 3 - 1, 2, 1000) Traceback (most recent call last):

ValueError: could not find root in given interval. >>> bisection(lambda x: x ** 2 - 4 * x + 3, 0, 2) 1.0 >>> bisection(lambda x: x ** 2 - 4 * x + 3, 2, 4) 3.0 >>> bisection(lambda x: x ** 2 - 4 * x + 3, 4, 1000) Traceback (most recent call last):

ValueError: could not find root in given interval.

maths.numerical_analysis.bisection.f(x: float) float