Trapezoidal Method Algorithm and Flowchart

3 Min Read

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:

  • 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

                         x[i]=x0+i*h

                        y[i]=f(x[i])

                         print y[i]

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

                           If i %2 = 0

                           So=s0+y[i]

                         Otherwise

                          Se=se+y[i]

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

Trapezoidal Method Flowchart:

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.

Share This Article
5 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

English
Exit mobile version