Lesson 12 of 15
Mean Value Theorem
Mean Value Theorem (MVT)
The MVT connects the derivative of a function to its average rate of change.
Statement
If (f) is continuous on ([a, b]) and differentiable on ((a, b)), then there exists (c \in (a, b)) such that:
Interpretation
There is at least one point where the instantaneous rate of change equals the average rate of change over the interval.
Applications
- If (f'(x) = 0) for all (x) in an interval, then (f) is constant
- If (f'(x) > 0) for all (x), then (f) is strictly increasing
- Rolle's Theorem (special case): if (f(a) = f(b)), then (f'(c) = 0) for some (c \in (a, b))
Finding the MVT Point Numerically
We can search for the point (c) where the derivative equals the average slope:
def find_mvt_point(f, a, b, n=10000, h=1e-7):
avg_slope = (f(b) - f(a)) / (b - a)
best_c = a
best_diff = float('inf')
for i in range(1, n):
c = a + (b - a) * i / n
deriv = (f(c + h) - f(c - h)) / (2 * h)
diff = abs(deriv - avg_slope)
if diff < best_diff:
best_diff = diff
best_c = c
return best_c
Your Task
Implement:
average_slope(f, a, b)-- returns ((f(b) - f(a)) / (b - a))find_mvt_point(f, a, b, n)-- searches (n) evenly spaced interior points for the one where the numerical derivative is closest to the average slope. Uses central difference with (h = 10^{-7}).
Pyodide loading...
Loading...
Click "Run" to execute your code.