SMA 3261 - Lecture 6 - Numerical Integration

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 14

Numerical Methods Lec.

NUMERICAL INTEGRATION
Dr. Ndung’u Reuben M.
Introduction
In applications, evaluation of integrals by analytical methods may be very complicated and
impractical when,
i) the antiderivative of is difficult to find, and
ii) the integral is a tabulated function
In such cases we resort to numerical integration which is also called numerical quadrature.
Definition
Numerical quadrature is the process of finding or evaluating the value of a definite
integral from a set of numerical values of the integrand.

Numerical integration can be performed on a continuous function or a set of data.


General Quadrature formula for equidistant ordinates

Consider or for corresponding to


. The is divided into subintervals,
with width.
a) Newton-Cotes Quadrature Formula
Let

Divide into subintervals of equal length by means of points


.
Hence we have

where is approximated by NFDIF.


Since , the above integral becomes,

After evaluation of the integral and simplification, we obtain

DEKUT-MPS Page 1 of 14
Numerical Methods Lec. 6

We obtain various integration formulae from the general formula by taking


{For practical problems, the trapezoidal rule ( and Simpson’s rule ( are simple
and most useful; and better accuracy can be ensured by using composite trapezoidal rule and
composite Simpson’s rule with smaller step size }
i) Trapezoidal Rule
Taking in equation and neglecting all differences higher than the first, we obtain

Similarly for

for

Adding we obtain
General (or Composite) Formula

Therefore,

Where sum of the extreme ordinates and


sum of the remaining ordinates
The Trapezoidal Rule can be applied to any number of subintervals, that is, when is even or
odd.

DEKUT-MPS Page 2 of 14
Numerical Methods Lec. 6

ii) Simpson’s Rule


Taking in equation and neglecting all differences higher than the second, we
obtain

Adding we obtain.
General (or Composite) Formula

where sum of the extreme ordinates;


sum of the odd ordinates;
sum of the even ordinates.

Simpson’s Rule can be applied when the number of subintervals is even ( ).

iii) Simpson’s Rule.

Assume the interpolating polynomial is of degree . Hence, taking in equation


and neglecting all differences higher than the third, it can be shown that,
The General (or Composite) Formula

DEKUT-MPS Page 3 of 14
Numerical Methods Lec. 6

Where Sum of the extreme ordinates;


Sum of the ordinates , with suffixes by ;
Sum of the remaining ordinates.

Simpson’s Rule can be applied when the number of subintervals is a multiple of i.e.
( ).

Worked example
1. A pharmaceutical company tests the body’s assimilation of a new drug by administering a
dose and collecting the following data from blood samples ( is time in hours, and
gives the assimilation of the drug in milligrams per hour).

Find the amount of drug assimilated in hours using


a) Trapezoidal rule,
b) Simpson’s one-third rule
c) Simpson’s three-eighth rule
Solution
The amount of drug, , is given by
a) Trapezoidal Rule

b) Simpson’s one-third Rule,

DEKUT-MPS Page 4 of 14
Numerical Methods Lec. 6

c) Simpson’s three-eighth Rule,

2. Approximate the integral using Simpson’s rule with .


Work with 4 decimal places.
Solution

let

By Simpson’s three-eighth rule,

3. The velocity of a particle at distance from a point on its linear path is given in the
following data:

Estimate the time taken by the particle to traverse the distance of meters, using

DEKUT-MPS Page 5 of 14
Numerical Methods Lec. 6

a) Trapezoidal rule,
b) Simpson’s one-third rule.
Solution

a) Trapezoidal Rule

b) Simpson’s one-third Rule,

Exercises
1) Evaluate by:
(i) Trapezoidal rule, and
(ii) Simpson’s rule.
2) Consider the supply and demand schedule in the table below where is in dollars and is
the number of units.

DEKUT-MPS Page 6 of 14
Numerical Methods Lec. 6

Supply Schedule Demand Schedule

Use Simpson’s Rule to approximate


a) The producer’s surplus at market equilibrium.
b) The consumer’s surplus at market equilibrium.
3) Evaluate with equally spaced quadrature nodes and
separated by using
(i) Trapezoidal rule,
(ii) Simpson’s.
(iii) Simpson’s rule with
4) The velocity in of a car which starts from rest is measured at fixed intervals of
time (hours) as shown below:

Estimate the distance covered in hours

5) Suppose the cost function for units of a product is given by


dollars. Find the average cost over the first units.
6) Evaluate taking seven grid points by

(i) Simpsons rule and


(ii) Simpson’s rule

DEKUT-MPS Page 7 of 14
Numerical Methods Lec. 6

b) Romberg Formula

Let be the Trapezoidal rule with subdivisions of the interval . Let be a given
positive integer. For then we inductively define

For and
The first column of numbers is just the numbers computed using the trapezoidal rule with
subdivisions for .
Romberg Table
No. of
Trapezoidal 2nd order
Trapezoid approximation
1st order 3rd order 4th order 5th order
Simpson
s

Steps
I. First compute the trapezoid approximations starting with and doubling each time.

II. Next use the formula

The easiest way to keep track of computations is to build a table of the form shown above.
Stopping criterion
There are two conditions which may cause the iteration process to halt:
If the step between successive iterates is sufficiently small, that is, ,
If we have iterated some maximum number of times, say , and condition have not been met,
we halt and indicate that a solution was not found.

DEKUT-MPS Page 8 of 14
Numerical Methods Lec. 6

DEKUT-MPS Page 9 of 14
Numerical Methods Lec. 6

Worked example

1. Evaluate by trapezoidal rule with and then use Romberg


procedure to obtain a better estimate of .
Solution

By the Trapezoidal rule,

Using the Romberg formula below, the Romberg table becomes,

2. Using Romberg Integration with to compute . Work with


decimal places and give your answer correct to decimal places.
Solution
By Trapezoidal rule,
If ,

If ,

If ,

DEKUT-MPS Page 10 of 14
Numerical Methods Lec. 6

Exercises
1) Use Romberg integration of order to evaluate .

2) Use order of Romberg integration to evaluate to an accuracy of


.
3) The data in the table below was generated from the normal distribution. Use (i) Simpson’s
rule and (ii) Romberg’s method to integrate the data from to .

4) The velocity profile of a fluid in a circular pipe can be represented as


where velocity, radial distance measured out from the pipes centreline, the
pipe’s radius and a parameter. Determine the flow in the pipe if and
using Romberg integration.

c) Numerical Double Integration


Consider an integral of the form

Integral can be evaluated numerically by two successive integration in and directions


respectively, taking into account one variable at a time.

DEKUT-MPS Page 11 of 14
Numerical Methods Lec. 6

Formulae for the evaluation of a double integral can be obtained by repeatedly applying the
Trapezoidal and Simpson’s rules.
Consider, for example, the double integral defined by:

where and .

i) TRAPEZOIDAL RULE
By repeated ‘application of trapezoidal rule’ to equation , we can derive the formula,

where: sum of values at the corners


sum of values at the remaining nodes of the region of
integration
sum of values at the internal nodes of the region of integration
The weights of the Trapezoidal rule are as illustrated below
For For

ii) SIMPSON’S RULE


Applying Simpson’s rule,

Using the same rule again gives,

For ,

DEKUT-MPS Page 12 of 14
Numerical Methods Lec. 6

where sum of values at the corners


sum of values at the remaining nodes of the region of integration
sum of values at the internal nodes

The weights of the Trapezoidal rule are as illustrated below

For For For

Worked example

1. Evaluate using Trapezoidal rule and taking . Work


with decimal places.
Solution
&

By the Trapezoidal rule for double integration,

DEKUT-MPS Page 13 of 14
Numerical Methods Lec. 6

2. Use Simpson’s rule to approximate the double integral with


. Work with decimal places.
Solution

Using the ‘Trapezoidal rule’ with ,

EXAMPLE/EXERCISES

1) Evaluate using the trapezoidal and Simpson’s rules with .

2) Taking , evaluate by trapezoidal rule.

3) Evaluate taking and , using (i) Trapezoidal rule, (ii) Simpson’s


rule.

4) Evaluate taking using (i) Trapezoidal rule, (ii) Simpson’s


rule.

5) Evaluate the double integral using:

a) The Trapezoidal rule with .


b) The Simpson’s rule with .

DEKUT-MPS Page 14 of 14

You might also like