Trapezoidal Method Algorithm and Flowchart


Definite integral is replica of area under a curve within the certain limit. In order to calculate such area, there have been developed a number of analytical methods but they are time-consuming, laborious and chance of occurrence of error is also high. That is why, techniques of numerical methods are very much popular in calculation numerical integration which can easily be programmed and trapezoidal method is one of them.

In this tutorial, we’re going to discuss a simple algorithm and flowchart for trapezoidal method along with a brief introduction to the method.

Trapezoidal method is based on the principle that the area under the curve which is to be calculated is divided into number of small segments. The bounding curve in the segment is considered to be a straight line as a result the small enclosed area becomes a trapezium.

The area of each small trapezium is calculated and summed up i.e. integrated. This idea is the working mechanism in trapezoidal method algorithm and flowchart, even it source code.

Let us consider a function f(x) representing a curve as shown in above figure. You are to find out the area under the curve from point ‘a’ to ‘b’. In order to do so, divide the distance between ab into a number vertical strips of width ‘h’ so that each strip can be considered as trapezium.

Trapezoidal Method Algorithm and Flow Chart

The following formula is used to calculate the area under the curve:

Trapezoidal Method Algorithm and Flowchart
Trapezoidal Method Algorithm:

  • Start
  • Define and Declare function
  • Input initial boundary value, final boundary value and length of interval
  • Calculate number of strips, n = (final boundary value –final boundary value)/length of interval
  • Perform following operation in loop



                         print y[i]

  • Initialize se=0, s0=0
  • Do the following using loop

                           If i %2 = 0




  • ans= h/3*(y[0]+y[n]+4*so+2*se)
  • print the ans
  • stop

Trapezoidal Method Flowchart:

Flowchart for Trapezoidal Method

Also see,
Trapezoidal Method C Program
Simpson 1/3 Rule C Program
Numerical Methods Tutorial Compilation

Among a number of methods for numerical integration, trapezoidal method is the simplest and very popular method which works on the principle of straight line approximation. I hope the algorithm and flowchart presented here will guide you to write source code for the method in any high level language.



Please enter your comment!
Please enter your name here