zero_finder.py

Read §3 in the Algorithms Chapter. This is the second programming exercise.

Write a function zero(a,b, tol, f) that finds an approximation for a root of the function f in the interval [a, b]. The precondition for calling this function is that f change sign on [a, b].

Use this function to find \(\sqrt[3]{100}\pm 10^{-6}\).


def zero(a, b, tol, f):
    pass
def main()
    print{f"The cube root of 100 is {zero(0, 0, 0, 0} within 1e-6.")
main()