trapetsoidisääntö
Trapetsoidisääntö, known in English as the trapezoidal rule, is a method for approximating the definite integral of a function. It is a simple yet effective numerical integration technique. The core idea behind the trapezoidal rule is to approximate the area under the curve of a function by dividing it into a series of trapezoids instead of rectangles, as used in methods like the midpoint rule or Riemann sums.
To apply the trapezoidal rule, the interval of integration is divided into several subintervals of equal width.
The formula for the trapezoidal rule with n subintervals of width h = (b-a)/n, where [a, b] is
∫[a to b] f(x) dx ≈ (h/2) * [f(x₀) + 2f(x₁) + 2f(x₂) + ... + 2f(x<n-1>) + f(x<n>)]
The accuracy of the trapezoidal rule generally increases as the number of subintervals (n) increases, leading