Lesson 8 of 18
Left Riemann Sum
The Definite Integral
The definite integral is the signed area between and the x-axis from to .
It is defined as the limit of Riemann sums — sums of rectangle areas:
where and is some point in the -th subinterval.
Left Riemann Sum
Use the left endpoint of each subinterval:
a a+h a+2h b
|----|----|----...---|
^ ^ ^
left endpoints used
Accuracy
For an increasing function, the left sum underestimates the integral (the rectangles don't reach the curve). For a decreasing function, it overestimates. Error is — halving halves the error.
Example
with , :
- Exact: — the left sum underestimates
Your Task
Implement double riemann_left(double (*f)(double), double a, double b, int n).
TCC compiler loading...
Loading...
Click "Run" to execute your code.