Mercyhurst UniversityDept of Math and ITDr Williams Home

Riemann Sums

Function Type:

Number of Subintervals:

Interval: ( , )

Actual Integral: 0

Left Endpoint Rule Approximation: 0
Absolute Error: 0

Right Endpoint Rule Approximation: 0
Absolute Error: 0

Midpoint Rule Approximation: 0
Absolute Error: 0

Trapezoid Rule Approximation: 0
Absolute Error: 0

About Riemann Sums

There are a number of methods for approximating the integral of a function \(f\) over a closed interval \([a,b]\), when the actual integral cannot be calculated. Riemann sums are one method of integral approximation. The general idea is to partition the interval into \(n\) smaller pieces. For each subinterval \([x_i, x_{i+1}]\), a representative point \(x^*\) is chosen. Adding the area of the rectangles with width \(x_{i+1} - x_i\) and height \(f(x^*)\) yields an approximation of the integral: \[ \int_a^b f(x)dx \approx \sum_{i=0}^{n-1} f(x^*)(x_{i+1} - x_i) \] While the width of the subintervals is not required to be equal, many common formulations of the Riemann sum use a constant width. The representative point chosen from each subinterval can, in general, be any point in that subinterval. However, the Riemann sums considered in this app are defined by the points chosen: The trapezoidal rule is differs from the above methods in that instead of adding rectangular areas on each subinterval \([x_i, x_{i+1}]\), we sum the area of a trapezoid with vertices \([x_i, 0], [x_{i+1}, 0], [x_i, f(x_i)], [x_{i+1}, f(x_{i+1})]\).The value of the approximation given by the trapezoidal rule is the average of the approximations given by the left and right endpoint rules.

The accuracy of each approximation is improved as the number of subintervals is increased.

Using the Applet

Sample functions are available in degree 1, 2, or 3 from the "Function Type" menu, along with the sine function. Use the sliders to adjust the interval you would \([a,b]\), as well as the number of subintervals \(n\). The applet will calculate the actual value of the integral, along with the value of each approximation and the absolute error. Check the box next to each approximation type to view the rectangles (or trapezoids) used in the approximation. More than one method may be checked simultaneously, so the methods can be visually compared.

About this Applet

This applet was created using JavaScript and the Raphael library. If you are unable to see the applet, make sure you have JavaScript enabled in your browser. This applet may not be supported by older browsers.