You will write a program that finds the point of the Mean Value Theorem, and of Rolle's theorem as the special case with a flat chord. It uses a numerical derivative and halves the interval.
The idea. The point is where the tangent has the same slope as the chord. Let , where is the chord slope. If changes sign on , halving the interval finds its zero.
Your tasks.
chord_slope(f, a, b). Return the slope of the chord.derivative(f, x). Return the slope taken on both sides, with H = 0.00001.find_c(f, a, b). Halve the interval 50 times for the zero of derivative(f, x) - chord_slope(f, a, b), and return the midpoint.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…