Numerical Integration Trapezoidal Method Algorithm

In numerical analysis, Trapezoidal method is a technique for evaluating definite integral. This method is also known as Trapezoidal rule or Trapezium rule.

This method is based on Newton's Cote Quadrature Formula and Trapezoidal rule is obtained when we put value of n = 1 in this formula.

In this article, we are going to develop an algorithm for Trapezoidal method.

Trapezoidal Method Algorithm

1. Start

2. Define function f(x)

3. Read lower limit of integration, upper limit of 
   integration and number of sub interval

4. Calcultae: step size = (upper limit - lower limit)/number of sub interval

5. Set: integration value = f(lower limit) + f(upper limit)

6. Set: i = 1

7. If i > number of sub interval then goto 

8. Calculate: k = lower limit + i * h

9. Calculate: Integration value = Integration Value + 2* f(k)

10. Increment i by 1 i.e. i = i+1 and go to step 7

11. Calculate: Integration value = Integration value * step size/2 

12. Display Integration value as required answer

13. Stop 

Recommended Readings

  1. Numerical Integration Trapezoidal Method Algorithm
  2. Numerical Integration Using Trapezoidal Method Pseudocode
  3. Numerical Integration Using Trapezoidal Method C Program
  4. Trapezoidal Rule Using C++ with Output
  5. Numerical Integration Using Simpson 1/3 Method Algorithm
  6. Numerical Integration Using Simpson 1/3 Method Pseudocode
  7. Numerical Integration Using Simpson 1/3 Method C Program
  8. Simpson 1/3 Rule Using C++ with Output
  9. Numerical Integration Using Simpson 3/8 Method Algorithm
  10. Numerical Integration Using Simpson 3/8 Method Pseudocode
  11. Numerical Integration Using Simpson 3/8 Method C Program
  12. Simpson 3/8 Rule Using C++ with Output