The trapezoidal rule approximates the definite integral of a function f(x) over an interval [a, b] by partitioning the interval into a number of subintervals, approximating f(x) on each subinterval by a linear function, and then computing the integral corresponding to the linear functions.
In the script below, enter f(x), a, and b. When entering f(x), you can use +, -, *, /, ^, ( ), abs(), sin(), cos(), tan(), exp(), log(), log10(), asin(), acos(), atan(), pi, e. Take care to remember the * in all multiplications and to avoid discontinuities. Also, note that here, log() stands for the natural logarithm, while log10() stands for the common logarithm. When entering a and b, you can use integers or decimals. Press the "Plot" button to draw the graph of f(x). Then enter n, the number of subintervals, and press the "Approximate" button to show the approximating line segments and the corresponding value for the integral.
Back to the Protas home page