Riemann Sum Calculator
Enter f(x), interval, and number of rectangles.

From Area to Sum

One of the most intuitive ways to introduce integration is by slicing the area under a curve into thin rectangles. Summing the areas of these rectangles yields a Riemann sum, which approximates the integral abfxdx. As the number of rectangles increases, the approximation improves, eventually converging to the exact integral when the width shrinks to zero.

Left, Right, and Midpoint

This calculator lets you choose where within each subinterval to sample the function value. The left Riemann sum evaluates f at the left endpoints, the right sum uses the right endpoints, and the midpoint sum takes the value halfway in between. The midpoint rule often yields a more accurate estimate for smooth functions because it balances the error on each interval.

Algorithm

Suppose we divide a,b into n equal pieces. Each rectangle has width Δx=b-an. The sum is then

Σi=0n-1fa+iΔxΔx

for the left rule, or similar expressions for the right and midpoint choices. In this tool we parse your function with math.js, evaluate it at the chosen sample points, and sum the resulting areas. The more subintervals you use, the closer the sum comes to the true integral.

Example

Consider fx=x2 on 0,1. Using ten midpoints yields approximately 0.3351, already close to the exact value 13.

Try It Yourself

Type any reasonable function into the form above—polynomials, trigonometric expressions, or exponentials—then specify the interval and how many rectangles to use. Choose your sampling method and press "Compute Sum". The calculator returns the Riemann sum rounded to six decimal places.

Related Calculators

Minimal Polynomial Calculator - 2×2 Matrices

Determine the minimal polynomial of a 2x2 matrix using eigenvalues and algebraic tests.

minimal polynomial calculator linear algebra

Euler's Totient Calculator - Count Coprime Integers

Determine the number of positive integers less than n that are relatively prime to n.

Euler totient calculator phi function

Spherical Coordinate Converter - Cartesian and Spherical Forms

Convert between Cartesian and spherical coordinates for points in three dimensions.

spherical coordinate converter cartesian to spherical