## Simpson 3/8th Rule

Back to Programming

### Description

Integration is the process by which the area under a function plotted on a graph is measured. Simpson’s 3/8th rule is the process of calculating the integration. It is an extension of the trapezoidal rule where the integral is approximated by the second-order polynomial. In this method, the parabola is used to approximate each part of the curve.

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, Simpson's 3/8th rule is a four-point formula.

and can deduce Simpson's 3/8th formula.

Hence,

GRAPHICAL REPRESENTATION

### Algorithm

INPUT:

A function f(x) dx

OUTPUT:

The value after calculating the equation.

PROCESS:

``````Step 1: [defining the function f(x)]
return 1/(1 + x^2)

Step 2: [Simpson’s 3/8th method]
Read x0, xn [the lower limit and upper limit]
Red n [number of intervals]
Set h ← absolute value of ((xn - x0) / n)
for i = 1 to n - 1 repeat
Set x ← x0 + i × h
If i Mod 3 = 0 then
Set s ← s + 2 × f(x)
else
Set s ← s + 3 × f(x)
[End of ‘if’]
[End of ‘for’ loop]
Set in ← (3 × h/8) × (f(x0) + f(xn) + s)
Print in [the final value after calculating the integration]
[End of method simpson’s 3/8th rule]``````

### Code

1. The error of this method is lesser than the error of Simpson's 1/3rd rule.

2. The integration of the function is more uniformly sampled in this rule.