Trapezoidal Rule Calculator

Approximate definite integrals using the composite trapezoidal rule.

Function

Integration Bounds

Number of Intervals (n)

Step size h = 0.250000

Trapezoid Areas

xf(x)Area
0.00000.0000000.007813
0.25000.0625000.039063
0.50000.2500000.101563
0.75000.5625000.195313

Integral of x^2 from 0 to 1

0.34375000

Composite Trapezoidal Rule with n=4

Single Trapezoid
0.50000000
Step Size (h)
0.250000

Error Analysis

Exact Value0.33333333
Absolute Error1.0417e-2
Relative Error3.125000%

Trapezoidal Rule Formula

Integral = h * [f(x0)/2 + f(x1) + f(x2) + ... + f(xn)/2]

Error: O(h^2) - Improves as n increases

About Trapezoidal Rule

  • Approximates f(x) with straight line segments
  • Simple to implement and understand
  • Error decreases with more intervals
  • Exact for linear functions
  • Works for any number of intervals