You are on page 1of 21

Numerical Integration

13

6
NUMERICAL INTEGRATION*)
Numerical integration methods are classified by taking into
account both the integrand function's type and the values for the
integration's limits of integration.
If the integration function is a function with only one argument
(single integrals) then we deal with quadrature formulae. If the
function to be integrated has two arguments (double integrals), then
we deal with cubature formulae.
I.
The first group of methods refers to the continuous
functions and with finite limits of integration. These
methods are divided in two subgroups according to the
dividing module of the interval of integration:
a) Methods that divide the integration interval into
subintervals of the same length, the number of the
subintervals being imposed by the operator. Among
these methods include: the rectangle method, the
trapezoidal
method,
Simpson's
method
and
Richardson's method;
b) Methods that divide the integration interval so that the
error of calculation to be minimal. Among these
methods remember and study the Gaussian quadrature
formula.
II.

A second group of methods refers to unfit integrals,


namely the integration of functions with discontinuities of
first and second case on finite intervals of integration or
the integration of continuous functions on infinite
integration intervals.

III.

A third group of numerical methods for integrating deals


with the dual integration of functions of two variables.
Remember for this the cubature formulas of the trapeze
and Simpson.

Numerical Methods in Electronics

13
6.1.

INTEGRATION OF SINGLE INTEGRALS.


METHODS USING CONSTANT PARTITION

These methods divide the integration interval in a number of n


subintervals of equal length. Obviously, the number n affects the
precision of the outcome of integration, as follows: the greater the n,
the higher the precision. These two sizes are directly proportional. n
is a number chosen by the designer (programmer itself).
6.1.1. THE RECTANGLE METHOD (the rectangular

rule)

This method of calculation has big errors for functions that are
not constant. We can use this technique in cases in which there are
no precision requirements in evaluating an integral. It is common
sense to say that, if the number of subintervals of the integration
interval increases then the error of calculation decreases.
This increase in the number of subintervals is done taking in
consideration that the time of calculation will be worse. It is
considered:
b

I= f ( x )dx

(6.1)

where f (x) is a continuous function on a, b and a , b are finite


values.
I- represents the area of the dotted line fig. 6.1.
The numerical computation of this integration is carried out by
dividing (partitioning) the interval a, b in n equal parts, using:
ba
xi
xi+1 xi h , i = 0,1,...,n-1.
(6.2)
n
The area of each such small rectangle is approximately given by:
ba
si
f ( xi )
(6.3)
n
and it is gathered
n 1

n 1

i 0

i= 0

si=h f ( xi )

(6.4)

where xi a h i
Formula (6.4) represents
the integration formula
based on rectangular small
areas.

Numerical Integration

13

If the integrand is a constant function (a polynomial of degree 0)


then this method gives no errors, because the area formed from Ox
axis and the verticals from the heads of the interval is equal to the
integral of the function on the given interval.
This method has no practical applications due to their large
computational errors.

6.1.1.1.

Algorithm 6.1. The Rectangular rule.

Variables
(
ls:left limit of the integration interval, real;
ld: right limit of the integration interval, real;
n: number of subintervals, integer;
sum: value of the integral, real;
)
{
sum=0;
compute h=(ld-ls)/nrpas;
for i=0,,n-1 compute sum =sum +h* f(ls+i*h);
print the integration values as sum;
}

6.1.1.2.

Implementation of the Algorithm 6.1.


The rectangular rule.

/* Function that implements the rectangular formula


* for integration.
* This function returns the value of the integral.
*/
double RectangleF
(
double (*f)(double),
double ls,
double ld,
int nrpas
)
{
int i;
double suma=0,h;
h=(ld-ls)/nrpas;
for(i=0;i<=nrpas-1;i++) suma += h*f(ls+i*h);
return suma;
}

Numerical Methods in Electronics

13

6.1.2. THE TRAPEZOIDAL METHOD (the trapezoidal

rule)

f ( x )dx

where f(x) is continuous on

a ,b and a , b

are

finite.
The function is represented through the area of the dotted line in
fig. 6.2, and the integral I represents the area of that dotted area.
The a ,b interval is divided into n equal parts, having a spacing
of:
hi = (xn-x0)/n, for i=0,1,...,n-1, x0=a and xn=b
Every small area Ii is approximated with the area of some
trapezoid having for its vertex the following coordinates:
( xi , xi 1, f ( xi ), f ( xi 1 ))
That is why every such small area is:
(6.5)
Therefore, the entire area - that is our integral I - will be:
(6.6)
This expression shows the formula of numeric integration
through the trapezoidal method and has zero cropping error for
functions approximated by
polynomials with degree
up to one.
The trapezoidal method
is superior in terms of
cropping errors compared
to the rectangular formula,
without
major
gain
regarding the calculation
time for the same number
of steps of integration.
Its simplicity makes it
usable in many cases, its
accuracy depends on the
chosen
number
of
subintervals. The higher
this
number
is
the
accuracy is better, but the calculation time increases. This integral
represents the fundamental for the Richardsons method.
6.1.2.1. Truncation error for trapezoidal formula

Numerical Integration

13

We will calculate the truncation error for Ii (6.5). For this we will
expand the function f ( x ) around the points xi and xi 1 :

( x xi )
( x-xi ) 2
f ( xi )+
f ( xi ) ...
1!
2!
( x xi 1 )
( x xi 1 ) 2

f(x) f ( xi 1 )
f ( xi 1 )
f ( xi 1 ) ...
1!
2!

f ( x )=( xi )

(6.7)
(6.8)

With these two expansions (6.7) and (6.8) we will build a new
function, the average of these functions that best approximates f(x)
in the range ( xi , xi 1 ) . Considering xi 1 xi h we can write the new
function like this:

f ( xi+1 ) f ( xi )
f ( xi ) f ( xi 1 )
( x xi )
h f ( xi 1 )
2
2
f ( xi ) f ( xi 1 )
f ( xi 1 ) h 2
( x xi ) 2
h ( x xi )
f ( xi 1 ) ...
4
2
4
f ( x )=

(6.9)

For the integration of the function in (6.9) from xi to xi 1 the


following outcome is obtained:
xi 1

xi

f ( x )dx

f ( xi 1 ) f ( xi )
f ( xi 1 ) f ( xi ) 2 f ( xi 1 ) 2
h
h
h
2
4
2

f ( xi+1 ) f ( xi ) 3 f ( xi 1 ) 3 f ( xi 1 ) 3
h
h
h ...
12
4
4
f ( xi 1 ) f ( xi )
f ( xi 1 ) f ( xi ) 2 f ( xi 1 ) f ( xi ) 3

h
h
h ...
2
4
12
(6.10)

We see that the truncation error is:

eTi

f ( xi 1 ) f ( xi ) 2 f ( xi 1 ) f ( xi ) 3
h
h ...
4
12

(6.11)

We consider the truncation error like:

eTi k h 2 f ( xi 1 ) f ( xi )

(6.12)

where k can be determined in such a way that the formulas (6.11)


and (6.12) being equal. We consider a function for which we have
the truncation error through trapezoidal formula. This is f ( x ) x 2 .
Considering xi 1 xi h
we have:
xi 1

x3
x dx 3
xi
2

xi 1
xi

xi33 xi3
h3
2
2

xi h h xi
3
3

(6.13)

By applying the trapezoidal formula of iteration to the same


function we have:

Numerical Methods in Electronics

14
xi 1

xi

( xi+2 1 xi2 )
h2
2
2
x dx
h eTi xi h xi h eTi
2
2
2

(6.14)

3
From (6.13) and (6.14) we have: eTi h / 6

(6.15)
By applying (6.12) for f ( x ) x 2 we have:

eTi k h 2 ( 2 xi 1 2 xi ) 2 k h 3

(6.16)

1
12
The truncation error for the small trapezoidal area limited by
( xi , xi 1 , f ( xi ), f ( xi 1 )) is:
1
eTi h 2 f ( xi 1 ) f ( xi )
(6.17)
12
Consequently, for the whole integral on the interval a ,b we
have the following approximate truncation error:
(6.18)
eT ( 1 / 2 ) h 2 f ' ( b ) f ' ( a )
This error represents the approximate sum of the areas between
the curve and the spring through the points ( xi , f ( xi )),( xi 1 , f ( xi 1 )) ,
i = 0,1,...,n-1.
From relations (6.16) and (6.15) we have: k=-

6.1.2.2. Rounding error for the trapezoidal formula


The formula for calculating the numeric integral through the
trapezoidal method is given in the expression (6.6). We build a
procedural graph for that mathematical relation, considering that,
for every node in which we do the operations ri, i =1,2,...,n+3, f ( xi )
has the relative errors i, for i = 0,1,...,n respectively:

E I ((( ...((( 1

f ( x1 )
f ( x2 )
f ( x1 ) f ( x 2 )
2
r1 )

f ( x1 ) f ( x 2 )
f ( x1 ) f ( x2 )
f ( x1 ) f ( x 2 ) f ( x3 )

+ 3

f ( x3 )
f ( x1 ) f ( x 2 ) ... f ( x n 2 )
r2 )... rn3 )

f ( x1 ) f ( x 2 ) f ( x3 )
f ( x1 ) f(x 2 ) ... f(x n 2 ) f ( x n1 )

n 1

f ( x n 1 )
2 f ( x1 ) 2 f ( x 2 ) ... 2( x n 1 )
rn 2 rn 1 )

f ( x1 ) f ( x 2 ) ... f ( x n 1 )
f ( x0 ) 2 f ( x1 ) ... 2 f ( x n 1 ) f ( x n )

(0

f ( x0 )
f ( xn )
f ( x0 ) f ( x n )
n
rn )

f ( x 0 ) f ( x1 )
f ( x0 ) f ( xn )
f ( x 0 ) 2 f ( x1 ) ... 2 f ( x n 1 ) f ( x n )

Numerical Integration

14

rn 1 h rn 2 rn 1 h rn 2 rn
0

f ( x0

f ( x0
) 2 f ( x1 )

f ( x0 )
f ( xn )
n

f ( x 0 ) 2 f ( x1 ) ... 2 f ( x n 1 ) f ( x n )
f ( x 0 ) 2 f ( x1 ) ... 2 f ( x n 1 ) f ( x n )

( rn 2 rn 1 )

2 f ( x1 )+2 f ( x 2 ) ... 2 f ( x n 1 )
2 f ( x n 1 )
n 1

f ( x 0 ) 2 f ( x1 ) ... 2 f ( x n 1 ) f ( x n )
f ( x 0 ) 2 f ( x1 ) ... 2 f ( x n 1 ) f ( x n )

+rn-3

2 f ( x1 )+f ( x 2 ) ... f ( x n 2 )
2 f ( x n2 )
n -2

f ( x 0 ) 2 f ( x1 ) ... 2 f ( x n 1 ) f ( x n )
f ( x 0 ) 2 f ( x1 ) ... 2 f ( x n 1 ) f ( x n )

+ rn- 4

2 f ( x1 )+f ( x2 ) ... f ( xn 3 )
2 f ( x2 )
... 2

f ( x0 ) 2 f ( x1 ) ... 2 f ( xn 1 ) f ( xn )
f ( x0 ) 2 f ( x1 ) ... 2 f ( xn 1 ) f ( xn )
(6.19)

e
Considering that some relative error is I I , where eI is the
I
absolute error, then we can calculate the absolute error:

eI ( rn 1 h n 2 ) I rn

h f ( x0 ) f ( xn )
h f ( x0 )
0

2
2

n -1 h f ( xn1 ) ( rn1 rn2 ) h f ( x1 ) f ( x2 ) .... f ( xn1 )


n2 h f ( xn2 ) rn3 h f ( x1 ) f ( x2 ) .... f ( xn2 )
n 3 h f ( xn3 ) rn4 h f ( x1 ) f ( x2 ) .... f ( xn3 ) ....
2 h f ( x2 ) 1 h f ( x1 ) r1 h [ f ( x1 ) f ( x2 )]
(6.20)

Numerical Methods in Electronics

14

Fig. 6.3. - The procedural graph for trapezoidal method of


integration.

If we consider that all the relative errors that occur in this


computation are obtained by rounding-off as well and are lower then
5x10-t where t is the mantissa of the calculator and f ( xi ) , for i
= 0, 1, 2,...., n, then we have the following upper limit of the
absolute error:
e I 5 10 t [ 3 I h (

2 ( n 1 ) ( n
2
( n 3 ) ( n 4 ) ... 2 )]

5 10 t [ 3nh 5 h / 2 h ( n 2 3 n 8 ) / 2 ]
5 10 t h. ( n 2 9 n 3 ) / 2

eI 5 10 t h ( n 2 9 n 3 ) / 2

(6.21)

It can be seen that the rounding error depends proportionally on


the value of n (number of divisions on [a, b]). Therefore, when n
increases, the rounding error is increased due to increased number
of computations (in fact an increased number of operations).

6.1.3. RICHARDSONs METHOD

Numerical Integration

14

This method gives a more accurate computation of the numeric


integral than the trapezoidal method and was obtained by modifying
the trapezoidal method. It uses a double partitioning schema for the
integration interval. The length of every such small division is also
the same among all the divisions. So, it is classified as a method
using equally spaced partitioning.
It departs from the truncation error of the trapezoidal method
(6.18):
eT = Ch2
for the division:
h = (b-a)/n
For another division k = (b-a)/m the following truncation error is
obtained
eT=Ck2
(6.22)
As a result
I=Ih+Ch2
I=Ik+Ck2
(6.23)
By subtracting (6.23) from (6.22) the following is calculated:

C=

I h -I k
k 2 h2

Replacing C either in (6.22) or (6.23) the formula of the integral I


will be:
I I
I Ih h 2 k
(6.24)
k
1
h
expression that bears the name of RICHARDSON's formula. It has a
greater accuracy than the trapezoidal formula.

6.1.3. SIMPSONs METHOD


SIMPSON's method uses the whole process of dividing the
integration interval in equal subintervals, but the approximation is
done here with the area under a parabola, for two adjacent
intervals. Parabola passes through three consecutive points of the
division.
The computation formula for SIMPSONs method may be inferred
more easily by using the formula of RICHARDSON . This formula is used
for two divisions which have the following relations:

Numerical Methods in Electronics

14

ba
ba
, h
(6.25)
m
n
We write the formula for trapezoidal method, for each division:
h
I h f ( x0 ) 2 f ( x1 ) 2 f ( x 2 )+2 f ( x3 )+... 2 f ( x n1 ) f ( x n )
2
(6.26)

k 2h , k

I k h f ( x0 ) 2 f ( x2 ) 2 f ( x4 )+2 f ( x6 )+... 2 f ( xn 2 ) f ( xn )

(6.27)
Then we apply RICHARDSONs formula (6.23):

f ( xn )
f ( x0 )
f ( x1 ) f ( x2 )+f ( x3 )+f ( x 4 )+... f ( xn 1 )

2
2

I h

f ( xn )
1
1
1
1
f ( x0 ) 1
f ( x1 ) f ( x2 )+ f ( x3 )+ f ( x4 )+... f ( xn1 )

3
3
3
3
3
6
6

2
2
2
1
1
h - f ( x0 )- f ( x 2 )- f ( x 4 )-... f ( x n 2 ) f ( x n
3
3
3
3
3

(6.28)
The expression above represents the numeric calculation formula
of the integral according to SIMPSONs method.

6.2. INTEGRATION
OF
SINGLE-VARIABLE
FUNCTIONS
USING
VARIABLEPARTITIONING SCHEMA

Numerical Integration

14

Among these methods we will talk about the GAUSS quadrature


formula. This method determines the points of dividing of the
interval of integration so that the calculation error of the integral
gives minimal errors.
6.2.1.GAUSS QUADRATURE FORMULA
This method reduces any range of integration [a,b] at the range
[-1.1] with the substitution formula:
2x ( b a )
y
(6.29)
ba
This substitution is necessary because of the fact that this
method uses the LEGENDRE's special polynomials.
Among these polynomials' characteristics we are interested in
the following:
they are defined on [-1,1]
on [-1,1] they have n unique real roots, that we are going to
consider the points of division for the Ox-axis.
For x = a we have y = -1 and for x= b
Substitution is given by the formula:
1
1
x ( b a )y ( b a )
2
2
1
dx ( b a )dy
and
2

we have y=1.
(6.30)
(6.31)

In the end, integral I

f ( x )dx

will become a new integral, in

variable y, as follows:
+1

+1

1
1
1
( b a ) y ( b a ) ( b a )dy ( y )dy
2
2
2
1

(6.32)

Numerical Methods in Electronics

14

z a 0 a1 y

z ( y)

Fig.6.4. - Graphical draw for both z ( y ) and division


to give zero error by a polynomialpoints.
cubic inclusive. Choosing points of

dividing the range [-1.1] is done in such a way that between areas
S1, S2, S3 to have the relationship:
S1 = S2 + S3
(6.33)
The formula for calculating the integral is proven for the case of
two points in the integration interval, points that are determined in
such a way for the integral I

( y )dy

to give zero error by a

polynomial cubic inclusive. Choosing points of dividing the range [1.1] is done in such a way that between areas S1, S2, S3 to have the
relationship
S1=S2+S3
(6.33)
until a function ( y) of third degree.
The integral through the quadrature method is computed using
the following formula:
I=k 0(y0)+k1(y1)
where y 0 i y1 are points for dividing the interval, and k0 , k1 are
some weights, all unknown which we will determine.
1

We calculate the exact value of the integral I

( y )dy

taking

into account formula (6.33)


+1

+1

-1

-1

I= ( y )dy= ( a 0 a1 y )dy

(6.34)

Numerical Integration

14

where z a0 a1 y represents the equation of a straight-line which


passes through the points ( y 0 , ( y 0 )) and ( y1 , ( y1 )) .
We consider the function ( y ) of degree three, for which the
integral is calculated with zero error:
( y )=b0+b1 y+b2 y 2+b3 y 3
(6.35)
This function can be written as follows:
( y ) = a 0+a1 y+( y-y 0 )( y-y1 )( 0 1 y )
(6.36)
underlining the passing of the curve ( u ) through the points
( y 0 , ( y 0 )) i ( y1 , ( y1 )) of the straight-line: z a 0 a1 y .
The equality (6.34) is written as follows:
1

+1

( a0 a1 y )dy

a1 y ( y y 0 )( y-y1 )( 0 1 y )dy

and, for this equality to be satisfied for any


following must happen

(6.37)

0 and 1 , the

+1

( y y

)( y y1 )dy 0

(6.38)

+1

y( y y

and

)( y y1 )dy 0

(6.39)

From these two equations we have the system:

1
+1

or

+1

( y0 y1 ) y y0 y1 dy 0
(6.40)

( y0 y1 ) y y0 y1 y dy 0
2

1
0

3
y0 y1 0
y 0 y1

with the solutions y 0

1
3

(6.41)
and y1

1
3

(6.42)
To calculate k0, k1 we use the equality:
+1

+1

-1

-1

I = ( y )dy = ( a0 a1 y )dy k 0 (

1
1
) k1 (
)
3
3
(6.43)

Numerical Methods in Electronics

14
+1

( a

a1 y )dy ( a0 y

a1 2
y )
2

+1
1

2a0

(6.44)

Replacing in (6.43) we have:


1
1
k 0 ( a0
a1 ) k1 ( a0
a1 ) 2a0
3
3
Through identification we have the system:

(6.45)

k 0 k1 2

k 0 k1 0

(6.46)

with the solutions: k 0 1, k 1 0


(6.47)
The formula to calculate the integral through the Gaussian
quadrature method when using two points of division is:
b

I f ( x )dx ( y )dy (

( y )

where:

1
1
) (
)
3
3

(6.48)

1
(b a )f ( y )
2

(6.49)
6.2.1.1. The truncation error of the GAUSS' quadrature
formula using two points
The integral from polynomials with degree at most three gives no
truncation errors, since we used LEGENDRE's polynomials of degree 3.
For such a case, assuming the given functions are polynomials with
a degree higher than three, we have some truncation error, as
follows:
(6.50)
eT k (IV ) ( ) , -1 1
To determine k we consider ( y ) y 4
1

( y )dy

( y )dy y

4
y dy

dy (

y5
5

1
3

1
1

) (

2
5
1
3

(6.51)

) eT

From the equalities (6.51) and (6.52) we have:


8
eT
45

2
eT
9

(6.52)

Numerical Integration

14

By applying the formula (6.55) for ( y ) y 4 where ( IV ) ( y ) 24


we have:
8
k 24
45

that means

1
135

The truncation error for the formula of the Gaussian quadrature


method when using two points of division is:
1 ( IV )
eT

( ) , -11
(6.53)
135
6.2.2.GAUSS' quadrature formula using more than two
points of division
In this case
b

n 1

i 0

f ( x )dx ( u )du k i ( yi )

(6.54)

by using n points of division and n weights.


The values of the points of division in the interval [-1,1] are the
roots of the LEGENDRE's polynomials which are defined through the
relationship of recurrence:
P0 ( y ) 1 , P1 ( y ) y
1
Pn ( y ) ( 2n 1 ) yPn1 ( y ) ( n 1 )Pn 2 ( y )
(6.55)
n
and the weights are given by the formula:
ki

( 1 y ) Pn ( yi )

2
i

(656)

For LEGENDRE's polynomials with a degree up to 16, the roots and


weights are tabulated along with the implementation of this method.
In the case of n division points of the integration interval [-1,1]
the truncation error is zero for all polynomials with grade lower than
2n-1, including 2n-1.

6.2.2.1. The truncation error of the Gauss' quadrature


using more than two points

Numerical Methods in Electronics

15

We consider a polynomial with degree of 2n for which the


Gaussian integral has the truncation error:
1
(6.57)
e T k ( 2 n) ( ) , -1
We calculate the integral for ( y) y 2 n
1

2n
( y )dy y dy

( y )dy

y 2 n1
( 2n 1 )
n 1

y 2 n dy k i y i

2n

i 0

1
1

2
2n 1

eT

(6.58)

(6.59)

From the equalities (6.58) and (6.59) we have:

eT

n 1
2
k i yi2 n
2n 1 i 0

(6.60)

By applying the formula (6.57) , where (2n)()=(2n)! and equal to


(6.60) we have:

n 1
1 2

ki ui2 n

( 2n )! 2n 1 i 0

(6.61)

and the truncation error


n 1
(2n) ( ) 2

eT
ki ui2 n

( 2n )! 2n 1 i 0

(6.62)

6.3.
COMPARISON OF THE INTEGRATION
METHODS
FOR SINGLE VARIABLE FUNCTIONS

Numerical Integration

15

Of all the methods for numerical integration, Gaussian


quadrature method is the most accurate, having the same precision
as the method of Simpson with a double number of points of
division, or the same as the trapezoidal method with a number four
times higher of points of division.
For the same precision for computing the integral, either the
efficiency increases or the time of calculation of the computer
decreases depending on the method we choose. Thus, the order of
increasing the precision, we have the trapezoidal method, the
RICHARDSON's method, then the SIMPSON's method and finally the
GAUSS quadrature method.

6.4.

NUMERIC COMPUTATION OF IMPROPER


INTEGRALS

Definition 6.1: It's called improper integral, the integral for


which at least one of the limits of integration is infinite and function
is continuous on the integration interval or the function has points of
discontinuity of first or second kind and the limits of integration are
finite.
Improper integrals that have the following form:

f ( x ) dx

f ( x )dx

f ( x ) dx

(6.63)

can be brought to form:

f ( x ) dx

(6.64)

As such, it will be studied the improper integral of this form.


If the function to be integrated defined on the interval a , can
be integrated on the whole interval and we have the limit:
A

lim f ( x )dx k

(6.65)

then

f ( x )dx k
a

(6.66)

Numerical Methods in Electronics

15

In this case it is improper integral convergent. When the limit


does not exist or is infinite, the improper integral is divergent. The
value of A may be high, because

f ( x ) dx

(6.67)

where is a positive constant small enough for calculation.


In this case the improper integral:

f ( x ) dx

f ( x ) dx

(6.68)

integral that can be calculated with one of the methods in the


paragraph 6.1.
Functions that on the integration interval a , b have a point of
discontinuity of first case c a,b have the property that:

f (c 0) lim f (x)

f (c 0) lim f (x)

and

x c
x c

x c
x c

and f (c) f (c 0) or f (c) f (c 0)


f ( c ) f ( c 0) .
In the case of these functions:
b

and

f ( x ) dx f 1 ( x ) dx f 2 ( x ) d x

(6.69)

f ( c ) f ( c 0)

or

(6.70)

where

f (x) pentru a x c
f1 ( x )
f (c 0) pentru x c
f (x) pentru c x b
f 2 (x)
f (x c) pentru x c

If the integral (6.70) exists, we can say that the improper integral
is convergent and that its value can be calculated with a method
studied in paragraph 5.1.
Function f ( x) has a point of discontinuity of second case c a,b
if at least one of the limits (6.69) has infinite value. In that case:

Numerical Integration

15

c e

f ( x ) dx

f ( x )dx

f ( x ) dx

(6.71)

ce

where can be taken so small enough for the following condition to


be fulfilled:
c

f (x )dx

1 , 1 0

very low value, which represents also a calculation error of the


integral. Integral (6.71) can be solved with one of the methods
studied in paragraph 6.1. (rectangular method, the trapezoidal
method, RICHARDSON'S method, the method of SIMPSON or the GAUSS's
quadrature formula).

6.5.
NUMERIC
CALCULATION
DOUBLE
INTEGRALS

OF

THE

For simplicity we consider the domain of integration of the


function of two variables a rectangle (Fig. 6.5)
b d

f ( x,y)dx f ( x,y)dxdy
D

a c

(6.72)

represents the double integral


for functions of two variables
f ( x , y) . To calculate the value
of such integrals we will use
the trapezoidal cubature
and Simpsons cubature
formulae, presented in the
following.
6.5.1.

Trapezoidal

cubature method
The interval a , b i c, d split into subintervals of equal lengths:
ba
dc
h
k
,
(6.73)
n
m

Numerical Methods in Electronics

15

x i , yi ,

And we have the rectangle with the vertices (peaks)

x i1 , y i , x i1 , y i1 , x i , y i1 , where

x i a i h , (yj+1= ?)

For the rectangle that contains the vertices x i , y i the integral Iij
is calculated by applying the trapezoidal formula:
y j 1

xi 1

I ij

xi

dx

xi 1

f ( x,y )dxdy

yj

k

2

xi

f ( x,y j ) f ( x,y j 1 ) dx

xi 1

xi 1

xi

xi

f ( x , y j )dx f ( x , y j 1 )dx

kh
f ( x i ,y j ) f ( x i ,y j1 ) f ( x i 1,y j ) f ( x i 1,y j1 ) (6.74)
4
Integral on the entire domain a , b, c, d is:

n 1 m 1

I I ij
i 0 j 0

kh n 1 m 1
f ( x i ,y j ) f ( x i ,y j1 ) f (x i 1,y j ) f ( x i 1,y j1 )
4 i 0 j 0

(6.75)
expression that is known as the formula of the trapezoidal
cubature.

6.5.2.SIMPSON'S CUBATURE FORMULA


For the same rectangle a , b, c, d depicted in fig. 6.5 we will
apply the Simpsons cubature. We will consider the rectangle of
integration with the vertices (peaks) x i , y i , x i 1 , y i , x i 1 , y i 1 ,

x i , y i1

and a central point, x i , y i :


kh
f ( x i1,y j1 ) f ( x i1,y j1 ) f ( x i1,y j1 ) f ( x i1,y j1 )

4 f ( x i ,y j1 ) f ( x i ,y j1 ) f ( x i1,y j ) f ( x i 1,y j ) 16f ( x i ,y i )


( 6.76)
Integral on the entire rectangle a , b, c, d is given by the formula
called the cubature of Simpson:
n 1 m 1

I I ij
i 0 j 0

kh n 1 m 1
f ( x i 1,y j1 ) f ( x i1,y j1 ) f ( x i 1,y j1 ) f (x i 1,y j1 )
9 i 0 j 0

4 f ( x i ,y j1 ) f ( x i ,y j1 ) f ( x i 1,y j ) f ( x i 1,y j ) 16f ( x i ,y j )

(6.77)

Numerical Integration

15

6.6. APPLICATIONS
2
x3
.e x .(1 sin x 2 )
1 cos(1 x )
for which we want the integral from 0 to 3.
R: The value of the integral is given in the table 6.1.

1. We have the function f ( x )

Table 6.1
Method

Number of subintervals

Rectangle
Trapeze
Richardson
Simpson
Gauss'
Cuadrature

10000
10000
5000 and 10000
10000
Legendre pol degree
n=15

Value of the
integral
1394.642843
1395.704297
1395.703984
1395.703984
1395.7031

2. We have the following function of two variables:


f ( x,y )

x2 y2
. exp(1 x ).sin( x y 2)
1 2.x.y

The value of the integral is required from the given


function on the domain x [0,2]; y [0,2].
Value of the integral is given in the table 6.2.
Table 6.2
Method
Trapezoidal
Cubature
Simpson's
cubature

Number of
points
on Ox
100

Number of
points
on Oy
100

-24.730047

100

100

-24.733155

Value of the
integral

You might also like