All problems
Mean Value Theorem Point
Problem
Find the smallest point c in [a, b] guaranteed by the Mean Value Theorem for the polynomial f(x) = sum(coeffs[i] * x^i), so that f'(c) equals the average slope (f(b) - f(a)) / (b - a).
Solve the quadratic f'(c) - slope = 0 exactly and return the smallest valid root, or None if no root lies in the interval.
Hint
Set f'(c) equal to the secant slope and solve the resulting polynomial equation.
Test cases
case 1
in: [[0,-3,0,1],0,2]
expected: 1.1547005383792517
case 2
in: [[0,0,0,1],0,3]
expected: 1.7320508075688772
case 3
in: [[0,1,0,1],0,1]
expected: 0.5773502691896258
case 4
in: [[0,-3,0,1],-2,2]
expected: -1.1547005383792517
case 5
in: [[0,0,1],0,2]
expected: 1
Starter codePython
def mvt_point(coeffs, a, b):
# Return the smallest valid c, or None
# Your code here
pass5 test cases · run your code against them in the editor