Numerical methods for solving a nonlinear equation: The bisection method
Implementation of the bisection method (programming assignment)
Implement the bisection method in Python, i.e. define the following Python function:
def bisection_solve(f, a, b, tol=0.001, maxiter=100):
"""
Find the zero of the function f between a and b using the
Bisection Method with tolerance tol (default: 0.001) and
maximum number of iterations equal to maxiter (default: 100)
"""
Apply the bisection_solve
function to the polynomial \(x^3+2x-1\) on the interval \([0,1]\) once with the default value of the tolerance and with a tolerance of \(10^{-5}\).
By the way, the exact and approximate zero within the interval is \[\frac{1}{6}\,\sqrt[3]{108+12\sqrt {177}}-4{\frac {1}{\sqrt[3]{108+12\sqrt {177}}}}\approx 0.4533976515\]
Unlock full access