FOR FREE MATERIALS

Trapezoidal Rule

Back to Programming

Description

In numerical analysis, this rule is a technique for approximating the definite integral. In this rule, the approximation is done on the region under the graph of f(x) as a trapezoid and then the area of that trapezoid is calculated. The result of the trapezoidal rule tends to be more accurate than the other methods.

 

DERIVATION

A mechanical quadrature formula will be called closed or open according to the limits of integration are used as interpolating points or not.

Sometimes it is easy to calculate the integration by breaking the whole interval into some subintervals. After computing each subinterval we have to add it to get the actual result. 

 

By using newton cote’s formula we get,

Then, 

Hence,

Now, if we apply newton cote’s formula with n = 1, the trapezoidal formula can be deduced.

Hence,

 

GRAPHICAL REPRESENTATION

Algorithm

INPUT: 

A function f(x)

 

OUTPUT: 

The value after performing the integration

 

PROCESS:

Step 1: [defining a function as a macro F(x)]
	F(x) 4x-3x^2

Step 2: [Trapezoidal Method]
	Set a ← 0.0 and b ← 1.0 [the lower limit and upper limit of the integration]
	Read n [the number of intervals]
	Set h ← (b - a)/n
	Set m ← F(a)
	Set t ← F(b)
	Print m
       Print t
        for i = 0 to n - 2 repeat
	Set z ← z + h
	Set y ← F(z) 
	Set sum ← sum + y 
	Print z, y
      [End of ‘for’ loop]
      Set sum ← 2 × sum
      Set s ← (h/2) × (sum + m + t)
      Print s 
[End of ‘trapezoidal’ method]

Code

ADVANTAGES

1. The trapezoidal rule is more accurate.

2. This rule is simple and ideal for many integration tasks.

 

DISADVANTAGES

1. It uses linear approximations instead of quadratic approximations so it is less accurate than Simpson's 1/3rd method.

2. If the function is concave up, then the integral is overestimated, and if it is concave down, then the integral is underestimated.

 

APPLICATIONS

1. In numerical, this method is used to find the approximation of definite integral.

2. It is used to estimate the volume of different geological structures.