Trapezoidal Rule Algorithm

From GM-RKB
Jump to navigation Jump to search

A Trapezoidal Rule Algorithm is an integral approximation algorithm that ...



References

2017

  • (Wikipedia, 2017) ⇒ https://en.wikipedia.org/wiki/trapezoidal_rule Retrieved:2017-9-16.
    • In mathematics, and more specifically in numerical analysis, the trapezoidal rule (also known as the trapezoid rule or trapezium rule) is a technique for approximating the definite integral : [math]\displaystyle{ \int_a^b f(x) \, dx }[/math] .

      The trapezoidal rule works by approximating the region under the graph of the function [math]\displaystyle{ f(x) }[/math] as a trapezoid and calculating its area. It follows that : [math]\displaystyle{ \int_a^b f(x) \, dx \approx (b-a) \left[\frac{f(a) + f(b)}{2} \right] }[/math] .

      The trapezoidal rule may be viewed as the result obtained by averaging the

       left and right Riemann sums, and is sometimes defined this way.

      The integral can be even better approximated by partitioning the integration interval, applying the trapezoidal rule to each subinterval, and summing the results. In practice, this "chained" (or "composite") trapezoidal rule is usually what is meant by "integrating with the trapezoidal rule". Let [math]\displaystyle{ \{x_k\} }[/math] be a partition of [math]\displaystyle{ [a,b] }[/math] such that [math]\displaystyle{ a=x_0 \lt x_1 \lt \cdots \lt x_{N-1} \lt x_N = b }[/math] and [math]\displaystyle{ \Delta x_k }[/math] be the length of the [math]\displaystyle{ k }[/math] -th subinterval (that is, [math]\displaystyle{ \Delta x_k = x_k - x_{k-1} }[/math] ), then : [math]\displaystyle{ \int_a^b f(x) \, dx \approx \sum_{k=1}^N \frac{f(x_{k-1}) + f(x_k)}{2} \Delta x_k }[/math] .

      The approximation becomes more accurate as the resolution of the partition increases (that is, for larger [math]\displaystyle{ N }[/math]).

      When the partition has a regular spacing, as is often the case, the formula can be simplified for calculation efficiency.

      As discussed below, it is also possible for place error bounds on the accuracy of the value of a definite interval estimated using a trapezoidal rule.