Lesson 13 of 18
Average Value of a Function
Average Value of a Function
The average value of on is:
This generalizes the discrete average to a continuous function.
Mean Value Theorem for Integrals
If is continuous on , there exists such that:
In other words, actually achieves its average value somewhere in the interval.
Geometric Interpretation
The average value is the height of a rectangle with base that has the same area as the region under :
Examples
- on : (the midpoint — makes sense for a linear function)
- on :
- on any interval: (average of a constant is itself)
Applications
- Average temperature over a day
- Average power consumed over a cycle
- Average speed over a journey (area under speed-time curve divided by time)
Your Task
Implement double average_value(double (*f)(double), double a, double b, int n) using the midpoint rule internally.
TCC compiler loading...
Loading...
Click "Run" to execute your code.