You are on page 1of 52

COMPARING DIFFERENT METHODS OF DOUBLE

INTEGRAL OF ITERATIONS AND DETERMINING THEIR


ACCURACY TO APPLY FOR MONTE CARLO METHOD

M.Sc. THESIS
By
CHAKEBO JEMAL BULCHA

SEPTEMBER,2016
ARBA MINCH,ETHIOPIA
COMPARING DIFFERENT METHODS OF DOUBLE
INTEGRAL OF ITERATIONS AND DETERMINING THEIR
ACCURACY TO APPLY FOR MONTE CARLO METHOD

M.Sc. THESIS
BY:
CHAKEBO JEMAL BULCHA

SUBMITTED TO:
THE DEPARTMENT OF MATHEMATICS
COLLEGE OF NATUTAL SCIENCE
SCHOOL OF GRADUATE STUDIES
ARBA MINCH UNIVERISTY

IN PARTIAL FULFILLMENT OF THE REQUREMENT FOR


THE DEGREE OF MASTERS OF SCIENCE IN
MATHEMATICS

SEPTEMBER, 2016
ARBA MINCH,ETHIOPIA
Declaration

I hereby declare that the thesis entitled ”Comparing different methods of double integral
of iterations and determining their accuracy to apply for Monte Carlo method” is submit-
ted to the Department of Mathematics in the partial fulfillment of requirements for the
award of degree of Master of Science in Mathematics. This is my own work and carried
out under the supervision of Dr. Mergia Balcha and Yibekal Walle(M.Sc.), Department of
Mathematics, Arba Minch University. The matter in this thesis has not been submitted
and presented by others for the award of any degree in other University.

Name

Signature

Date of Submission
ADVISORS’ THESIS SUBMISSION APPROVAL
SHEET

This is to certify that the thesis titled ”Comparing different methods of double in-
tegral of iterations and determining their accuracy to apply for Monte Carlo
method” submitted in partial fulfilment of the requirements for the award of degree
of Master of science in Mathematics with specialization in Numerical analy-
sis, and is record of original research curried out by Chakebo Jemal Bulcha ID.No
SMsc/087/05 under my supervision and no part of the thesis has been submitted for
any other degree or diploma. The assistance and the help received during the course of
this investigation have been duly acknowledged. Therefore I recommended that it may
be accepted as fulfilling the thesis requirement.

Name of Advisor Signature Date

Name of Co- advisor Signature Date


EXAMINERS’ THESIS APPROVAL SHEET(FOR
MINOR CORRECTIONS)

As members of Board of Examiners of the final M.Sc. Graduate thesis open defense
Examination, we certify that we have read and evaluated this Graduate thesis prepared
by Chakebo Jemal entitled ”Comparing different methods of double integral of iterations
and determining their accuracy to apply for Monte Carlo method” and recommended that
it be accepted as fulfilling the thesis requirement for the Degree of Master of Science in
Mathematics with specialization in Numerical Analysis.
Approved by:

Name of Advisor Signature Date

Name of Co-advisor Signature Date

Name of External Examiner Signature Date

Name of Internal Examiner Signature Date

Name of Chairperson Signature Date

SGS Approval Signature Date

iv
Acknowledgments

A journey is easier when you travel together. Depending on each other is certainly more
valuable than independence. This thesis is the result of a one year of work whereby I have
been accompanied and supported by many people.It is a pleasant aspect that I have now
the opportunity to express my gratitude to all of them.
First of all, I thanks to the almighty God for his blessings, guidance and protection
through out my studies and being successful in both direction.
I would like to sincerely thank my advisor, Dr.Mergia Balcha, for sharing his knowledge
and vision as well as his continuous guidance and encouragement throughout the prepa-
ration of this thesis.
I would also like to thank my co-advisor, Yibekal Walle(M.Sc.), for his comments,suggestion
and support on this thesis.
My gratitude also goes to my friends Hailu Ayalew, Fikaden Alemayoh,Gezahegn Lom-
bamo,Abera W/seliase, Tigabu Elias,Shukure Gemachu,Menberu Abeje,Sisay Bekel,Taye
Dobamo, Tefera Elias,Brihanu Tamirat,Abebe Ansheso and Admasu Abebe for their
faith,love,concern and moral support.
Finally, I would like to express my hearty gratitude to my brother,Abebe Jemal,and my
sister,Aregash Jemal,for their unconditional love,moral and material support that sus-
tained me through this critical stage of my life.
Contents

Declaration ii

Acknowledgments v

List of Tables viii

List of Figures ix

Abstract x

1 Introduction 1

1.1 Background of the study . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1

1.2 Statement of the Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.3 Objectives of the Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.3.1 General objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

1.3.2 Specific Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

1.4 Significance of the Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2 Review of Related Literature 6

3 Methodology 8

3.1 Method and Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

3.2 Method of Data Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8

4 Result and Discussion 9

vi
4.1 Approximation and Evaluation of Double Integrals Numerically . . . . . . 9

4.1.1 Analogy formula of rectangular (Direct iteration) . . . . . . . . . . 9

4.1.2 Analogy Formula of Chard Method . . . . . . . . . . . . . . . . . . 13

4.1.3 Analogy Formula of Trapezoid . . . . . . . . . . . . . . . . . . . . . 14

4.1.4 Analogy Formula of Simpson . . . . . . . . . . . . . . . . . . . . . . 15

4.1.5 Evaluation of Integral by Monte Carlo method . . . . . . . . . . . 19

4.1.6 Evaluation of Double Integral by Monte Carlo method . . . . . . . 22

5 Conclusion and Recommendation 34

5.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

5.2 Recommendation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34

vii
List of Tables

1 Shows the distribution of formula (43) . . . . . . . . . . . . . . . . . . . . 20

2 Shows the distribution of formula (47) . . . . . . . . . . . . . . . . . . . . 22

3 Shows the distribution of formula (53) . . . . . . . . . . . . . . . . . . . . 24

4 Shows the distribution of formula (54) . . . . . . . . . . . . . . . . . . . . 25

5 Shows the distribution of data from(1-30) . . . . . . . . . . . . . . . . . . . 27

6 Shows the distribution of the given region R when N=10 . . . . . . . . . . 28

7 Shows the distribution of the given data . . . . . . . . . . . . . . . . . . . 30

viii
List of Figures

1 2D region R defined by a ≤ x ≤ b and ϕ(x) ≤ y ≤ ψ(x) . . . . . . . . . . . 9

2 2D region R defined by a ≤ x ≤ b and ϕ(x) ≤ y ≤ ψ(x) and their


corresponding feval points . . . . . . . . . . . . . . . . . . . . . . . . . . . 10

3 Rectangular Region of Simpson when −h ≤ x ≤ h; −l ≤ y ≤ l . . . . . . . 15

4 Rectangular region of Simpson when −h < x < h; −l < y < l . . . . . . . . 15

5 The circular region of Simpson . . . . . . . . . . . . . . . . . . . . . . . . . 18

6 The polar region of Simpson . . . . . . . . . . . . . . . . . . . . . . . . . . 18

7 The region of Monte Carlo integral . . . . . . . . . . . . . . . . . . . . . . 20

8 The Region of Monte Carlo double integral . . . . . . . . . . . . . . . . . 23

9 The graph of Monte Carlo results when (n=100) . . . . . . . . . . . . . . . 31

10 The graph of Monte Carlo results when (n=1000) . . . . . . . . . . . . . . 32

11 The graph of Monte Carlo results when (n=10,000) . . . . . . . . . . . . . 33



12 The graph of z = f (x, y) = 4 − x2 − y 2 on [ −5 , 5 ] . . . . . . . . . . . . . 33
4 4

ix
Abstract

The accuracy and efficiency of computing multiple integrals is a very important problem
that arises in many scientific,financial and engineering applications.The research con-
ducted in this thesis is designed to compare Trapezoidal,rectangular(direct iteration) and
Simpson rule’s with Monte Carlo simulation of double integral.The fundamental aim is
to assess techniques for numerically evaluating double integrals with high accuracy. From
the comparison, we obtained that Simpson’s rule for variable limit is better approximation
than Monte Carlo method.An application is the Monte Carlo method, which samples the
integrand at n randomly selected points and attempts to compute the mean value of the
integrand on the entire domain,and usually converge faster for quintuple multiple integrals
and higher, and yield greater accuracy for the same number of function evaluations than
repeated integrals using one dimensional method.

x
1 Introduction

1.1 Background of the study

Numerical integration(Quadrature) methods can prove useful if the integrand is known


only at certain points or the anti derivative is very difficult or even impossible to find.
Moreover, in particular situations, the integrand is often specified in tabular form and
the whole concept of an anti-derivative is meaningless. Then, the problem of numerical
integration of a function consists in computing the value of a definite integral on the
basis of a series of values of the integrand[3].As many problems in scientific computing
involves two-dimensional domains, it is essential to be able to compute integrals over such
domains. Such integrals can be evaluated using the following strategies:
If a two-dimensional domain R can be decomposed into rectangles, then the integral
of a function f (x, y) over R can be computed by evaluating integrals of the form I =
RbRd
a c f (x, y)dxdy. Then, to evaluate I, one can use a certain product rule, whose nodes
and weights are obtained by combining one-dimensional quadrature rules that are applied
to each dimension.For example, if functions of x are integrated along the line between
x = a and x = b using nodes xi and weights wi , for i = 1, ..., n, and if functions of y
are integrated along the line between y = c and y = d using nodes yi and weights zi , for
Pn Pm
i = 1, ..., m, then the resulting Cartesian product rule Qn,m = i=1 j=1 f (xi , yi )wi zj has
nodes xi , yi and corresponding weights wi zj for i = 1, ..., n and j = 1, ..., m.
If the domain R can be described as the region between two curves y1 (x) and y2 (x) for
RR R b R y2 (x)
xε[a, b],then we can write I = R f (x, y)dA as an iterated integral I = a y1 (x) f (x, y)dxdy
which can be evaluated by applying a one-dimensional quadrature rule to compute the
Rb
outer integral I = a g(x)dx, where g(x) is evaluated by using a one-dimensional quadra-
R y2 (x)
ture rule to compute the inner integral g(x) = y1 (x) f (x, y)dy.
For various simple regions such as triangles, there exist cubature rules that are not com-
binations of one-dimensional quadrature rules. Cubature rules are more direct general-
izations of quadrature rules, in that they evaluate the integrand at selected nodes and use
weights determined by the geometry of the domain and the placement of the nodes. In

1
more than two dimensions, generalizations of quadrature rules are not practical, since the
number of function evaluations needed to attain sufficient accuracy grows very rapidly as
the number of dimensions increases. An application is the Monte Carlo method, which
samples the integrand at n randomly selected points and attempts to compute the mean
value of the integrand on the entire domain [6, 14]. The most common application of
Monte Carlo method is Monte Carlo integration. Sometimes we have given integrals which
cannot be done analytically, especially in higher dimensions where the standard methods
of discretization can become computationally expensive.At that time Monte Carlo inte-
gration will usually converge faster for quintuple multiple integrals and higher, and yield
greater accuracy for the same number of function evaluations than repeated integrations
using one dimensional method [7].
Monte Carlo methods can be thought of as statistical simulation methods that utilize
sequences of random numbers to perform the simulation. The name ”Monte Carlo” was
coined by Nicholas Constantine Metropolis (1915-1999) and inspired by Stanislaw Ulam
(1909-1986), because of the similarity of statistical simulation to games of chance and a
center for gambling. The core idea of Monte Carlo is to learn about a system by simulating
it with random sampling. That approach is powerful, flexible and very direct. It is often
the simplest way to solve a problem, and sometimes the only feasible way. The Monte
Carlo method is used in almost every quantitative subject of study: physical sciences,
engineering, statistics, finance, and graphics. Monte Carlo is even applied in some areas,
like music theory, that are not always thought of as quantitative [11, 12].
The Monte Carlo method uses random numbers to determine the answer to problems.
This seems like a peculiar way to do mathematics; although many mathematical problems
have efficient and accurate algorithms for their solution, there times when the problem is
too big, too hard, and too irregular for such an approach. A probability distribution is a
table or an equation that links each possible value that a random variable is represented.
All probability density function satisfies the following conditions:the random variable Y is
a function of X, that is y = f (x), the value of Y greater than or equal to zero for all values
of X, and the total area under the curve of the function is equal to one. Random variable
has either associated probability distribution (discrete random variable) or probability
density function (continuous random variable). Monte Carlo simulations usually employ

2
the application of random numbers which are uniformly distributed over the interval [0,
1]. These uniformly distributed random numbers are used for the generation of stochastic
variables from various probability distributions [2, 9].

3
1.2 Statement of the Problem

The numerical evaluation of double integral is more complicated than that of single in-
tegral, since the integrand depends on two variables and we will deal with the regions
or surfaces in the case [15].The accuracy and efficiency of computing multiple integral is
a very important problem that arises in many scientific, financial and engineering appli-
cations. This study is to compare different numerical methods for double integrals and
the simulation of Monte Carlo method. So, the researcher will be expected to answer the
following basic research questions:

• What are the technique’s to find a formula of double integral of iteration to compare
accuracy?

• By how much is the error enhances the numerical solution of integrals?

• How can we apply the Monte Carlo method for double integral?

1.3 Objectives of the Study

1.3.1 General objectives

The general objective of this study will be:


To compare different numerical methods and the simulation of Monte Carlo method in
order to determine a more accurate numerical solution of double integrals.

4
1.3.2 Specific Objectives

The Specific Objectives of this study are:

• To compare different methods of double integral of iterations.

• To check the accuracy of each method.

• To apply the Monte Carlo method for double integral.

1.4 Significance of the Study

The Significance of this study are to:

• Use the accurate method of double integral of iterations in different real life situa-
tions.

• Use the Monte Carlo method for double integral.

• Initiate other researchers for further Study.

5
2 Review of Related Literature

Mathematics is an elegant and precise subject: however when numerical answers are re-
quired one sometimes needs to reply on approximate methods to obtain answers. There
are many problems which simply do not have analytic solutions, or those whose exact
solution is beyond our current state of knowledge. There are also many problems which
are too long (or tedious) to solve by hand. When such problems arise we can exploit
numerical analysis to reduce the problem to one involving a finite number of unknowns
and use a computer to solve the resulting equations (Denier 2005).
Since computer come into existence, modeling of physical phenomena has gained much
importance for solution of real world problems which are generally multidimensional and
the emphasis in numerical integration has shifted from quadrature rules to evaluation of
multiple integrals, i.e. to drive cubature rules. Cubature rules were developed for differ-
ent two and three dimensional regions. In1971, Stroud published his work on multiple
numerical integration. In this book, he presented a complete summary of the theoretical
and practical aspects of multiple numerical integration and has listed almost all multiple
integration rules/cubature rules known at that time for a variety of regions. Numerical
approximation of integrals has been an area of mathematics that has been of great inter-
est for hundreds, even thousands of years. At first this meant determination of areas and
volumes of physical objects but today computational integration is applied in areas like
theoretical physics and computer graphics. Many great scientists have studied this art in-
cluding Newton, Kepler, Maxwell and even Archimedes who obtained strict bounds for π
by approximating a circle with inscribed and circumscribed polygons(Engels 1980).How-
ever, it is perhaps the contribution of Gauss that has influenced the modern numerical
integration the most. He noticed that by placing the evaluation points in some other way
than equidistantly, more accurate results can be obtained, (Henri 2005).
Numerical integration values obtained by using Simpson’s rule is more accurate (has a
smaller error) than that obtained using the Trapezoidal(Trapezium) rule and the ac-
curacy of both the Trapezoidal rule and Simpson’s rule become more accurate as the
interval length h gets smaller(Mayers 1958). According to the program errors, numerical
integration using trapezoidal rule in multiple dimensions gives a lower error at a greater

6
dimension resulting in more precise numerical integration values. Likewise, a greater di-
mension gives more precise values for Simpson’s rule, (Kathaleeya 2015). Many research
discussed the solution of single integrals numerically, but numerical evaluation of double
integrals is more challengeable than that of single integral, since the integrand depends
on two variables and we will deal with the regions or surfaces in the case (Santena 2000).
The use of approximation methods for double integrals is not limited to integrals with
rectangular regions of integration, but it’s extended to non-rectangular regions .Double
integral can be evaluated as an iterated integral by using a convenient numerical integra-
tion formula of Simpson’s and Trapezoid.The numerical method of solving double integral
by Simpson’s for variable limit is better approximation than Monte Carlo method (Nageri
2015). In more than two dimensions,generalizations of quadrature rules are not practical,
since the number of function evaluations needed to attain sufficient accuracy grows very
rapidly as the number of dimensions increases.An application is the Monte Carlo method,
which samples the integrand at n randomly selected points and attempts to compute the
mean value of the integrand on the entire domain.The method converges rather slowly but
its convergence rate depends only on n, not the number of dimensions(Dukkipati 2010).
Even if it’s challengeable, at this study the researcher will consider different numerical
methods and the stimulation of Monte Carlo method to find the numerical solution of
double integrals and to determine their accuracy.
Numerical integration methods based on Monte Carlo techniques are a valid tool for ap-
proximating multidimensional integrals when the space dimension of Rn gets larger. These
methods differ from the approaches considered thus far, since the choice of quadrature
nodes is done statistically according to the values attained by random variables having a
known probability distribution. The basic idea of the method is to interpret the integral
as a statistic mean value. A more efficient implementation of Monte Carlo methods is
based on composite approach or semi-analytic methods, where a composite Monte Carlo
method is employed for the computation of integrals over hyper cubes in Rn (Saleri 2000).

7
3 Methodology

3.1 Method and Procedures

In order to achieve a high accurate Numerical solution of double integrals,the researcher


has used the following procedures:

1. Drive a formula for Rectangular(Direct iteration) method,Trapezoidal rule,Simpson’s


rule in rectangular and non rectangular regions.

2. Drive a formula of Monte Carlo Simulation.

3. Finally,compare Rectangular(Direct iteration) method,Trapezoidal rule,Simpson’s


rule in rectangular and non rectangular regions with Monte Carlo simulation.

Further, for realistic and reasonable comparison between the methods, we had used the
MATLAB Software to save time in order to determine their accuracy.

3.2 Method of Data Analysis

The data gathered from Secondary sources (books, journals, and internets) were organized
and analyzed by Rectangular (Direct iteration) method, Trapezoidal rule, Simpson’s rule,
and simulation of Monte Carlo method, and conclusions had be given.

8
4 Result and Discussion

4.1 Approximation and Evaluation of Double Integrals Numer-


ically

4.1.1 Analogy formula of rectangular (Direct iteration)

1. Let R is closed region bounded by line x = a; x = b, y = ϕ(x) and y = ψ(x),where


ϕ(x) and ψ(x) continuous on [a, b] ,ϕ(x) 6 ψ(x) (as shown below in fig.1 and 2)

Figure 1: 2D region R defined by a ≤ x ≤ b and ϕ(x) ≤ y ≤ ψ(x)

9
Figure 2: 2D region R defined by a ≤ x ≤ b and ϕ(x) ≤ y ≤ ψ(x) and their corresponding
feval points

j
y = ϕ(x) + [ψ(x) − ϕ(x)], (j = 0, 1, 2, ..., n) (1)
n

Let us divided [a, b] in to m equal part, such that a = x0 < x1 < x2 < ... < xm−1 <
xm = b.
Through this parallel line to oy

x = xi (i = 0, 1, 2, ..., m) (2)

By using (1) and (2) in region R from fig.2 above, evaluating at four points pi,j (xi , yij ),
pi+1,j (xi+1 , yi+1,j ), pi,j+1 (xi , yi,j+1 ), pi+1,j+1 (xi+1 , yi+1,j+1 ) where i = 0, 1, 2, .., m; j =
0, 1, 2, ..., n.
For fixed point i(0 6 i 6 m) where the right angle triangle is not depend on j.
ψ(x) − ϕ(x)
|pi,j − pi,j+1 | = ; j = 0, 1, 2, ..., n
n
The volume of fig.2 denoted by ∆wij , is
1 Z xi+1
∆wij = [ψ(x) − ϕ(x)]dx (3)
n xi

10
From (3) the value of ∆wij do not depend on j , therefore ∆wij = ∆wi ,
0 6 i 6 m − 1; 0 6 j 6 n − 1, for the double integral
RR
f (x, y)dxdy,where the
R
function f (x, y) be continuous on region R. Let us numerically integrate at the
selected points,pij ; pi+1,j ; pi,j+1 and pi+1,j+1 .
At pij the approximate value of
ZZ m−1
X n−1
X
f (x, y)dxdy ≈ ∆wi zij (4)
R i=0 j=0

Where
j
zij = f (xi , yij ); yij = ϕ(xi ) + [ψ(xi ) − ϕ(xi )] (5)
n

At pi+1,j the approximate value of


ZZ m−1
X n−1
X
f (x, y)dxdy ≈ ∆wi zi+1,j (6)
R i=0 j=0

At pi,j+1 the approximate value of


ZZ m−1
X n−1
X
f (x, y)dxdy ≈ ∆wi zi,j+1 (7)
R i=0 j=0

At pi+1,j+1 the approximate value of


ZZ m−1
X n−1
X
f (x, y)dxdy ≈ ∆wi zi+1,j+1 (8)
R i=0 j=0

From formula (4),(6),(7),(8) we can see analogy formula of rectangular for approx-
imation of definite integral .It is obvious that if the subdivision m and n are more
,then the accuracy is better.

11
2. For the condition a ≤ x ≤ b, c ≤ y ≤ d,then the value of ∆wi evaluated by formula
(b − a)(d − c)
∆wi = then formula (4),(6),(7) and (8) can be written as
mn
ZZ
(b − a)(d − c) m−1
X n−1
X
f (x, y)dxdy ≈ zij (9)
mn i=0 j=0
R

ZZ
(b − a)(d − c) m−1
X n−1
X
f (x, y)dxdy ≈ zi+1,j (10)
mn i=0 j=0
R

ZZ
(b − a)(d − c) m−1
X n−1
X
f (x, y)dxdy ≈ zi,j+1 (11)
mn i=0 j=0
R

ZZ
(b − a)(d − c) m−1
X n−1
X
f (x, y)dxdy ≈ zi+1,j+1 (12)
mn i=0 j=0
R

Here,formula (9)-(12) is the volume formula of parallelepiped.

3. If the function f (x, y) is monotone for each variable x and y ,then the double integral
evaluated with
(b − a)(d − c) ZZ
(b − a)(d − c)
N≤ f (x, y)dxdy ≤ M (13)
mn mn
R

Pm−1 Pn−1
Where M and N are corresponds to superimum and infimum sum of i=0 j=0 zij ,
Pm−1 Pn−1 Pm−1 Pn−1 Pm−1 Pn−1
i=0 j=0 zi+1,j , i=0 j=0 zi,j+1 , and i=0 j=0 zi+1,j+1 .
0 0
4. Let f (x, y) and the partial derivative fx (x, y) and fy (x, y) are continuous on region
R and on the rectangular region a ≤ x ≤ b; c ≤ y ≤ d.Then,the value of error
approximation formula (9)-(10) where defined as

(b − a)(d − c) M1 (b − a) M2 (d − c)
|R| ≤ [ + ] (14)
2 m n

12
where
0
M1 = max|fx (x, y)|
a6x6b
c 6 y 6 d;
0
M2 = max|fy (x, y)|
a6x6b
c6y6d

4.1.2 Analogy Formula of Chard Method


RR
1. Let double integral I = R f (x, y)dxdy and the rectangular region R on a 6 x 6 b;
c 6 y 6 d, with the condition satisfying
AC − B 2 > 0, A < 0, and C < 0 (15)

00 00 00
Where A = fxx , C = fyy and B = fxy denotes convex surface z = f (x, y) for all
point of region R.The analogy AC − B 2 > 0, A > 0, and C > 0 , is denoting concave
surface. Then for approximation value of double integral, we can formulate
ZZ
f (x, y)dxdy ≈ (b − a)(d − c)f (x, y) (16)
R

a+b c+d
Where x = ;y =
2 2
2. Let us divide region R by line x = xi ; (i = 0, 1, 2, ..., m) and y = yi (j = 0, 1, 2, ..., n)
on mn equally rectangle R. If we integrate at each point of the rectangle R(16) ,we
obtain the approximate solution
ZZ
(b − a)(d − c) m−1
X n−1
X
f (x, y)dxdy ≈ f (x, y) (17)
R mn i=0 j=0

xi+1 + xi yj+1 + yj
where xi = ; yj =
2 2
Equation (17) gives approximate value of double integral if condition (15) is satisfied.

13
4.1.3 Analogy Formula of Trapezoid

f (x, y)dxdy and the rectangular region R is on a ≤ x ≤ b,


RR
1. Let double integral I = R
c ≤ y ≤ d . Then the approximate integral value can be written as
ZZ
(b − a)(d − c)
f (x, y)dxdy ≈ (Z1 + Z2 + Z3 + Z4 ) (18)
R 4

where z1 = f (a, c), z2 = f (b, c), z3 = f (a, b), and z4 = f (b, d).
This formula gives the approximate value of double integral if condition (15) fulfilled.
The value of error approximation of equation (18) can be defined by inequality as
(a + b) (c + d)
(b − a)(c − d)f (
RR
, ) < R f (x, y)dxdy
2 2
f (a, c) + f (b, c) + f (a, d) + f (b, d)
< (b − a)(d − c) (19)
4
2. Let the region R divided into equal parts on x-axis and from rectangular mn,evaluating
double integral with the help of (18) ,we can obtain
ZZ
(b − a)(d − c)
f (x, y)dxdy ≈ (S0 + 2S1 + 4S2 ) (20)
R 4mn

Where S0 = z00 + zm0 + z0n + zmn ,(sum value function of open rectangular region)
Pm−1 Pn−1
S1 = i=1 (zi0 + zin ) + j=1 (z0j + zmj ),(Sum value of function for upper part)
Pm−1 Pn−1
S2 = i=1 j=1 zij ,(Sum value of function for lower part)
If condition (15) fulfilled and from analogy of inequality (19),we obtain
X n−1
(b − a)(d − c) m−1 X ZZ
(b − a)(d − c)
f (xi , yj ) < f (x, y)dxdy < (S0 + 2S1 + 4S2 )
4mn i=0 j=0 R 4mn
(21)
(xi+1 )(xi ) (yj+1 )(yj )
where xi = ; yj = . The error value is similar to (14)
2 2
3. If the region R bounded by x = a, x = b; y = ϕ(x) and y = ψ(x), then the approxi-
RR
mate value of R f (x, y)dxdy by formula (4),(6),(7) and (8)
ZZ
1 m−1
X n−1
X
f (x, y)dxdy ≈ ∆wi (zij + zi+1,j + zi,j+1 + zi+1,j+1 ) (22)
R 4 i=0 j=0

14
Where ∆wi (i = 0, 1, 2, ..., m − 1) fulfill (3) for value of zij by (4), (5), (6), (7), (8)
and (22).

4.1.4 Analogy Formula of Simpson

1. Let rectangular region R bounded and continuous on −h ≤ x ≤ h; −l ≤ y ≤ l, then


the coefficient of polynomial 3rd degree,
p3 (x, y) = a30 x3 + a21 x2 y + a12 xy 2 + a03 y 3 + a20 x2 + a11 xy + a02 y 2 + a10 x + a01 y + a00 .
Rh Rl Rh Rl
Then −h −l f (x, y)dxdy ≈ −h −l p3 (x, y)dxdy (as shown below in fig.3 and 4)

Figure 3: Rectangular Region of Simpson when −h ≤ x ≤ h; −l ≤ y ≤ l

Figure 4: Rectangular region of Simpson when −h < x < h; −l < y < l


Ra
That means −a ϕ(t)dt = 0 if ϕ(−t) = −ϕ(t) on [a, b] ,from this
Z h Z l
4hl
f (x, y)dxdy ≈ (a20 h2 + a02 l2 + 3a00 ) (23)
−h −l 3

15
From fig.3, fig.4 and formula (23), we can write
Z l Z h
hl
f (x, y)dxdy ≈ [f (h, l) + f (−h, l) + f (h, −l) + f (−h, −l) + 8f (0, 0)]
−l −h 3
(24)

Or
Z h Z l
2hl
f (x, y)dxdy ≈ [f (h, 0) + f (−h, 0) + f (0, l) + f (0, −l) + 2f (0, 0)] (25)
−h −l 3
For rectangular region a 6 x 6 b; c 6 y 6 d and from (24) and (25), we obtain
RbRd
a c f (x, y)dxdy ≈

a+b c+d
(b − a)(d − c)[f (a, c) + f (a, d) + f (b, c) + f (b, d) + 8f ( , )] (26)
2 2
RbRd (b − a)(d − c) (c + d) (c + d) (a + b)
a c f (x, y)dxdy ≈ [f (a, ) + f (b, ) + f( , c) +
6 2 2 2
(a + b) (a + b) (c + d)
f( , d) + 2f ( , )] (27)
2 2 2

2. Let rectangular region parallel to x -axis divided into 4mn equal parts, then by (26)
we can write as
Z bZ d
(b − a)(d − c)
f (x, y)dxdy ≈ (S0 + 2S1 + 4S2 + 8S3 ) (28)
a c 12mn
where S0 = f (a, c) + f (a, d) + f (b, c) + f (b, d)
Pm−1 Pn−1
S1 = i=1 [f (x2i , c) + f (x2i , d)] + j=1 [f (a, y2j ) + f (b, y2j )]
Pm−1 Pn−1
S2 = i=1 j=1 f (x2i , y2j )
(x2i + x2(i+1) ) (y2j + y2(j+1) )
Pm−1 Pn−1
S3 = i=1 j=1 f( , )
2 2
From formula (27) we can drive
Z bZ d
(a − b)(c − d)
f (x, y)dxdy ≈ (S1 + 2S2 + 4S3 ) (29)
a c 6mn
y2j + y2(j+1) y2j + y2(j+1)
 
Pn−1
where S1 = j=0 f (a, ) + f (b, ) +
2 2

16
x2i + x2(i+1) x2i + x2(i+1)
 
Pm−1
i=0 f( , c) + f ( , d)
2 2
x2i + x2(i+1) y2j + y2(j+1)
S2 = m−1
P Pn−1
i=0 j=0 f ( , )
2 2
x2i + x2(i+1) y2j + y2(j+1)
 
Pm−1 Pn−1
S3 = i=0 j=0 f ( , y2j ) + f (x2i , )
2 2
If f (x, y) ≡ P3 (x, y) then formula (25)-(28) is better approximation
x0 + x2
3. Let region R defined as x0 6 x 6 x2 and y0 (x) 6 y 6 y2 (x) where x1 = ,
2
y0 (x) + y2 (x)
y1 = , yj (xi ) = yij and zij = f (xi , yj )(i, j = 0, 1, 2). Then,
2
I = R f (x, y)dxdy = xx02 dxf (x, y)dy.By exchanging Simpson’s formula, we obtain
RR R

x2 − x0
R f (x, y)dxdy ≈ {(y02 − y00 )(z00 + 4z01 + z02 ) +
RR
36

4(y12 − y10 )(z10 + 4z11 + z12 ) + (y22 − y20 )(z20 + 4z21 + z22 )} (30)

If y2 (x) − y0 (x) = k=constant, then formula (30) can be written as


ZZ
x2 − x0
f (x, y)dxdy ≈ [z00 + z02 + z20 + z22 + 4(z01 + z10 + z12 + z21 + 16z11 )]
R 36
(31)

If a ≤ x ≤ b; c ≤ y ≤ d; partially formula (31) can be written as


(b − a)(d − c)
R f (x, y)dxdy ≈ {f (a, c) + f (a, d) + f (b, c) + f (b, d) +
RR
36

c+d c+d a+b a+b a+b c+d


4[f (a, ) + f (b, ) + f( , c) + f ( , d)] + 16f ( , )} (32)
2 2 2 2 2 2

4. If the region R of integration is circle with radius r ,then the integral can be written
as
RR R 2π Rr
R f (x, y)dxdy = 0 dϕ 0 f (ρcos(ϕ), ρsin(ϕ))ρdρ(as shown below in fig.5 and 6)

17
Figure 5: The circular region of Simpson

Figure 6: The polar region of Simpson

r
From fig.6 ϕ0ρ, if ϕ = π and ρ = 2
then from (24) and (26) we can write
ZZ
S −r
f (x, y)dxdy ≈ [f (r, 0) + 2f ( , 0)] (33)
R 3 2
ZZ
S r −r
f (x, y)dxdy ≈ [f ( , 0) + f (−r, 0) + f ( , 0)] (34)
R 3 2 2
Where S = πr2 is area of circle .From formula (32), we can write
ZZ
S r −r
f (x, y)dxdy ≈ [f (r, 0) + 2f ( , 0) + 2f (−r, 0) + 4f ( , 0)] (35)
R 3 2 2
x2 y 2
5. If the region of integration is bounded by ellipse + 2 = 1 and x = aρcos(ϕ);
a2 Rb2π
y = aρsin(ϕ) , then the integral I = R f (x, y)dxdy ≈ 0 0r abρ.f (aρcos(ϕ)).bρsin(ϕ)dρdϕ,
RR R

from formula (24) ;( 25) and (32)


S −a
I= [f (a, 0) + 2f ( , 0)] (36)
3 2

18
S a −a
I= [f ( , 0) + f (−a, 0) + f ( , 0)] (37)
3 2 2
S a −a
I=
[f (a, 0) + 2f ( , 0) + 2f (−a, 0) + 4f ( , 0)] (38)
3 2 2
Where S = πab area of ellipse

4.1.5 Evaluation of Integral by Monte Carlo method


R1
1. Let 0 dt ,where t-is uniformal distribution and p(t)-density of uniformal distribution
probability
 function.Then,



0, if t < 0


p(t)= 1, if 0 6 t 6 1




0, if t > 1


R1
Random number ϕ(t) defined as M [ϕ(t)] = 0 ϕ(t)dt.
Z 1
If p(t) = 1 then M [ϕ(t)] = ϕ(t)dt. (39)
0
n
1 X
If t1 , t2 , ..., tN t, then M [ϕ(t)] ≈ ϕ(ti ) (40)
N i=1

From (1) and (2)


n
Z 1
1 X
ϕ(t)dt ≈ ϕ(ti ) (41)
0 N i=1

2. If x = a + (b − a)t,then
Z b Z 1
f (x)dx = (b − a) ϕ(t)dt (42)
a 0

Where ϕ(t) = f [a + (b − a)t] from (41) by using (42)


n n
Z b
b−aX Z b
b−aX
f (x)dx ≈ ϕ(ti )or f (x)dx ≈ f (xi ) (43)
a N i=1 a N i=1
where,xi = a + (b − a)ti ; (i = 1, 2, ..., N ) .

19
Table 1: Shows the distribution of formula (43)
i ti xi = a + (b − a)ti f (xi )
1 t1 x1 f (x1 )
2 t2 x2 f (x2 )
. . . .
. . . .
N tN xN f (xN )
PN
i=1 f (xi )

Figure 7: The region of Monte Carlo integral

The figure (7 A) above bounded by x = a, x = b, y = 0, y = M, where

M ≥ 0, maxf (x)
a≤x≤b

If f (x) satisfies inequality f (x) ≥ 0 for all interval [a, b], then
Rb Rb
a f (x)dx = a [f (x) + h]dx − h(b − a),Where h > 0 and f (x) + h ≥ 0;for x[a, b].
If 0 ≤ ξ ≤ 1, 0 ≤ η ≤ 1 from (figure 7 B), x = a + (b − a)ξ, y = M η, then
dx = (b − a)dξ
Z 1
I = (b − a).M ϕ(ξ)dξ (44)
0

20
1
W here, ϕ(ξ) = f [a + (b − a)ξ] (45)
M
From (45),f (x) = M ϕ(ξ). If uniformly distributed for all point (ξ1 , η1 ), (ξ2 , η2 ), âĂę, (ξN , ηN )
equally
Z 1
n
ϕ(ξ)dξ ≈ (46)
0 N

Z 1
(b − a)nM
F rom(44)and(46), f (x)dx ≈ (47)
0 N

R1
f (x)dx
0 n
F rom(47), ≈ (48)
M (b − a) N

21
Table 2: Shows the distribution of formula (47)
i ξi ηi xi = a + (b − a)ξi yi = M ηi Yi = f (xi )
1 ξ1 η1 x1 y1 f (x1 )
2 ξ2 η2 x2 y2 f (x2 )
. . . . . .
. . . . . .
N ξN ηN xN yN f (xN )

where i = 1, 2, ..., N and yi < Yi

The Monte Carlo method can be used to numerically approximate the value of an integral.
For a function of one variable the steps are:

1. Pick n randomly distributed points x1 , x2 , x3 , ..., xn in the interval [a,b].


1 Pn
2. Determine the average value of the function fb = f (xi ).
n i=1
Rb
3. Compute the approximation to the integral a f (x)dx ≈ (b − a)fb.
s
fc2 − fb2 1 Pn
4. An estimate for the error is, Error ≈ (b − a) , where fc2 = f 2 (xi )
n n i=1
Every time a Monte Carlo simulation is made using the same sample size it will
come up with a slightly different value. Larger value of n will produce more accurate
−1
approximations. The values converge very slowly of the order o(n 2 ). This property
is a consequence of the central limit theorem [7].

4.1.6 Evaluation of Double Integral by Monte Carlo method

f (x, y)dxdy where domain D is a ≤ x ≤ b, ϕ1 (x) ≤ y ≤ ϕ2 (x) where


RR
1. Let D
ϕ1 (x)andϕ2 (x) continuous on [a, b] and ϕ1 (x) ≥ c; ϕ2 (x) ≤ d from figure (8 B ) as
shown below .

22
Figure 8: The Region of Monte Carlo double integral

Let us interchange the formula x = a + (b − a)ξ; y = c + (d − c)η then D → ∆ Where


0 ≤ ξ ≤ 1, 0 ≤ η ≤ 1 from (42)
ZZ
f (x, y)dxdy = f (x, y).S (49)
D

Where f (x, y), and S is area of D


n
1X
f (x, y) ≈ f (xi , yi ) (50)
n i=0

n
ZZ
sX
F rom(49)and(50), f (x, y)dxdy ≈ f (xi , yi ) (51)
D n i=1

S n n(b − a)(d − c)
F rom(48), ≈ , where S ≈ (52)
(b − a)(d − c) N N

n
ZZ
(b − a)(d − c) X
F rom(51)and(52), f (x, y)dxdy ≈ f (xi , yi ) (53)
D N i=1

where yi ≤ yi ≤ yi

23
Table 3: Shows the distribution of formula (53)
i ξi ηi xi = a + (b − a)ξi yi = c + (d − c)ηi yi = ϕ1 (xi ) yi = ϕ2 (xi ) f (xi , yi )
1 ξ1 η1 x1 y1 ϕ1 (x1 ) ϕ2 (x1 ) f (x1 , y1 )
2 ξ2 η2 x2 y2 ϕ1 (x2 ) ϕ2 (x2 ) f (x2 , y2 )
3 ξ3 η3 x3 y3 ϕ1 (x3 ) ϕ2 (x3 ) f (x3 , y3 )
. . . . . . . .
. . . . . . . .
N ξN ηN xN yN ϕ1 (xN ) ϕ2 (xN ) f (xN , yN )

f (x, y)dxdy, where a ≤ x ≤ b; ϕ1 (x) ≤ y ≤ ϕ2 (x) and if


RR
2. From (47), D

M ≥ maxf (x, y),


a6x6b
c6y6d
RR
then the double integral D f (x, y)dxdy is known for cylindrical volume on
a ≤ x ≤ b, ϕ1 (x) ≤ y ≤ ϕ2 (x), 0 ≤ z ≤ f (x, y) or a ≤ x ≤ b; c ≤ y ≤ d; 0 ≤ z ≤
M .with substituting new variable ξ, η and ε at x = a + (b − a)ξ, y = c + (d − c)η, z =
M ε, then the region v is transformed to region Ω ,define inequality
(ϕ1 (x) − c) (ϕ2 (x) − c)
0 ≤ ξ ≤ 1; ≤η≤ , 0 ≤ ε ≤ 1.
(d − c) (d − c)
Region Ω found in the cube,and bounded by ξ = 0, ξ = 1; η = 0, η = 1; ε = 0, ε = 1,
then I = (b − a)(d − c)M ∆ ϕ(ξ, η)dξdη.
RR
1
where ϕ(ξ, η) = f (a+(b−a)ξ, c+(d−c)η),from the random point (ξ1 , η1 , ε1 ), (ξ2 , η2 , ε2 ), ...,
M RR
n n
→ ∆ ϕ(ξ, η)dξdη or ∆ ϕ(ξ, η)dξdη ≈ .
RR
(ξN , ηN , εN ),
N N
ZZ
(b − a)(d − c)
f (x, y)dxdy ≈ nM (54)
D N

24
Table 4: Shows the distribution of formula (54)
i ξi ηi εi xi yi zi = M εi yi = ϕ1 (xi ) yi = ϕ2 (xi ) Zi = f (xi , yi )
1 ξ1 η1 ε1 x1 y1 z1 ϕ1 (x1 ) ϕ2 (x1 ) f (x1 , y1 )
2 ξ2 η2 ε2 x2 y2 z2 ϕ1 (x2 ) ϕ2 (x2 ) f (x2 , y2 )
. . . . . . . . . .
. . . . . . . . . .
N ξN ηN εN xN yN zN ϕ1 (xN ) ϕ2 (xN ) f (xN , yN )

Here,xi = a+(b−a)ξi and yi = c+(d−c)ηi where yi < yi < yi and zi < Zi = f (xi , yi ).
The Monte Carlo method can be used to numerically approximate the value of the double
integral[7] .For a function of two variables the steps are:

1. Pick n randomly distributed points (x1 , y1 ), (x2 , y2 ), (x3 , y3 ), ..., (xn , yn ) in the rect-
angle [a, b] × [c, d].
1 Pn
2. Determine the average values of the function fb = f (xi , yi ).
n i=1
RbRd
3. Compute the approximation to the integral a c f (x, y)dxdy ≈ (b − a)(d − c)fb.
s
fc2 − fb2 1 Pn
4. An estimate for the error is,Error ≈ (b−a)(d−c) , where fc2 = f 2 (xi , yi ).
n n i=1

25
Numerical Examples
2xy
R1R2
Example 1.Evaluate I = 0 1 dydx
(1 + x2 )(1 + y 2 )
i.Using the Trapezoidal rule with h=k=0.25.
ii.Using the Simpson’s rule with h=k=0.25.
iii.Compare the results obtained with the exact solution.
Solution
Exact solution is obtained as
2x y 1 1 5
I = 01
R2
dy = [ln(1 + x2 )]10 [ln(1 + y 2 )]21 = (ln 2)(ln ) = 0.317562.
R
2
dx. 1 2
1+x 1+y 2 2 2
1
With h = k = ,we have the nodal points.
4
i j
(xi , yi ), i = 0, 1, 2, 3, 4, j = 0, 1, 2, 3, 4,where xi = , i = 0, 1, ..., 4; yj = 1 + , j = 0, 1, ..., 4.
4 4
using the Trapezoidal rule, we obtain
k R1
I = 01 12 f (x, y)dydx =
R R
[f (x, y0 ) + 2f (x, y1 ) + 2f (x, y2 ) + 2f (x, y3 ) + f (x, y4 )]dx
2 0
hk 1
= [S1 + 2S2 + 4S3 ] = (S1 + 2S2 + 4S3 )
4 64
Where S1 = f (x0 , y0 ) + f (x4 , y0 ) + f (x0 , y4 ) + f (x4 , y4 ) = 0.9
P3 P3
S2 = i=1 [f (xi , y0 ) + f (xi , y4 )] + j=1 [f (x0 , yj ) + f (x4 , yj )] = 3.387642.
P3
S3 = i=1 [f (xi , y1 ) + f (xi , y2 ) + f (xi , y3 )] = 3.078463
Hence, we get I = 0.312330
Using Simpson’s rule, we obtain
k R1
I= [f (x, y0 ) + 4f (x, y1 ) + 4f (x, y3 ) + 2f (x, y2 ) + f (x, y4 )]dx
3 0
hk
= [T1 + 2T2 + 4T3 + 8T4 + 16T5 ]
9
1
= [T1 + 2T2 + 4T3 + 8T4 + 16T5 ]
144
Where,
T1 = f (x0 , y0 ) + f (x4 , y0 ) + f (x0 , y4 ) + f (x4 , y4 ) = 0.9
T2 = f (x2 , y0 ) + f (x2 , y4 ) + f (x0 , y2 ) + f (x4 , y2 ) = 1.181538
T3 = f (x0 , y1 )+f (x4 , y1 )+f (x0 , y3 )+f (x4 , y3 )+f (x1 , y4 )+f (x3 , y4 )+f (x1 , y0 )+f (x3 , y0 )+
f (x2 , y2 ) = 2.575334
T4 = f (x2 , y1 ) + f (x2 , y3 ) + f (x1 , y2 ) + f (x3 , y2 ) = 1.395131
T5 = f (x1 , y1 ) + f (x3 , y1 ) + f (x1 , y3 ) + f (x3 , y3 ) = 1.314101
Hence, we get I = 0.317716

26
The magnitudes of errors in the solutions are
Trapezoidal rule:|0.312330 − 0.317562| = 0.005232
|0.312330 − 0.317562|
The relative error(σ) = × 100% = 1.65%
0.317562
Simpson’s rule:|0.317716 − 0.317562| = 0.000154
|0.317716 − 0.317562|
The relative (σ) = × 100% ≈ 0.05%
0.317562
Example 2. Evaluate approximate solution of I = 01 (1 − t2 )dt by using Monte Carlo
R

method .
solution

Table 5: Shows the distribution of data from(1-30)


i ti t2i i ti t2i
1 0.857 0.734 16 0.805 0.648
2 0.457 0.209 17 0.516 0.266
3 0.499 0.249 18 0.296 0.088
4 0.762 0.581 19 0.149 0.022
5 0.431 0.186 20 0.815 0.664
6 0.689 0.487 21 0.070 0.005
7 0.038 0.001 22 0.692 0.478
8 0.558 0.311 23 0.896 0.484
9 0.653 0.426 24 0.203 0.041
10 0.573 0.328 25 0.350 0.122
11 0.609 0.371 26 0.900 0.810
12 0.176 0.032 27 0.451 0.203
13 0.974 0.949 28 0.318 0.101
14 0.011 0.0001 29 0.798 0.637
15 0.098 0.010 30 0.111 0.012

P30 P30
Therefore, i=1 (1 − ti )2 = 30 − 2
i=1 ti = 30 − 9.455 = 20.545
From(41)
R1 1
0 (1 − t2 )dt = × 20.545 ≈ 0.685
30
And

27
t3 1 2
Analytically,I = [(t − )] = = 0.667
3 0 3
|0.667 − 0.685| 0.018
The relative error (σ) = × 100%= × 100% ≈ 2.7%.
0.667 RR 0.667
Example 3.Find the approximate value of I = R (x + 2y)dxdy,if it is bounded by contin-
x
uous points 0 6 x 6 1, 6 y 6 x by using Monte Carlo method.
2
solution
a = 0, b = 1; then region R can be distributed as follows

Table 6: Shows the distribution of the given region R when N=10


xi
i xi yi yi = y i = xi 2yi f (xi , yi ) = xi + 2yi
2
1 0.857 0.457 0.428 0.857 0.914 1.771
2 0.499 0.762 0.249 0.499
3 0.431 0.698 0.215 0.431
4 0.038 0.558 0.019 0.038
5 0.653 0.573 0.326 0.653 1.146 1.799
6 0.609 0.179 0.304 0.609
7 0.974 0.011 0.487 0.974
8 0.098 0.805 0.049 0.098
9 0.516 0.296 0.258 0.516 0.592 1.108
10 0.149 0.815 0.074 0.149

Here,N = 10, n = 3. From formula(53),

(1.771 + 1.799 + 1.108)


I= ≈ 0.458
10
And
R1Rx 1 R1 1 R1
x (x + 2y)dxdy= 0 [(x + 2y)2 ]xx dx= 0 (9x2 −
RR
Analytically,I = R (x + 2y)dxdy = 0
4 4
2 2
4x2 )dx

5 x3 2
=[ ( )]1 ≈ 0.417
4 3
|0.417 − 0.458|
The relative error(σ)= × 100% ≈ 9.83%
0.417

28
RR √
Example 4.Evaluate the double integral I = R( x + y)dxdy where R is bounded by
lines x = 0, x = 4, y = 3x, y = 8x by using Monte Carlo method.
Solution
R4 R 8x √
I= 0 dx 3x ( x + y)dy, a=0, b=4, ϕ1 (x) = 3x, ϕ2 (x) = 8x, ϕ1 (x) > 0 and ϕ2 (x) 6 32.
Then,c = 0, d = 32, i.e.

max x + y = 6,
06x64
0 6 y 6 32

Therefore,x = 4ξ, y = 32η and z = 6δ. Then,y = 3x and y = 8x are transformed to


3
η = ξ,
8
η = ξ and N=20.

29
Table 7: Shows the distribution of the given data
i ξi ηi δi xi = 4ξi yi = 32ηi zi = 6δi yi = 3xi yi = 8xi zi = xi + yi zi
1 0.857 0.457 0.499 3.428 14.624 2.994 10.284 27.424 18.052 4.049
2 0.762 0.431 0.698 3.048 13.792 4.188 9.144 24.384 16.840 4.104
3 0.088 0.558 0.179 0.152 17.856 0.456 1.216
4 0.573 0.609 0.098 2.292 19.488 0.588 6.876 18.336
5 0.974 0.011 0.296 3.896 0.352 1.776 11.688 31.168
6 0.805 0.516 0.070 3.220 16.512 9.660 25.760 19.732 4.441
7 0.149 0.815 0.203 0.596 26.080 1.788 4.768
8 0.692 0.696 0.451 2.768 22.272 2.706 8.304 22.144
9 0.035 0.900 0.111 1.400 28.800 4.200 11.200
10 0.318 0.798 0.183 1.272 25.536 3.816 10.176
11 0.933 0.199 0.104 3.732 6.368 0.624 11.196 26.976
12 0.421 0.338 0.449 1.684 10.816 2.694 5.052 13.472 12.500 3.536
13 0.190 0.150 0.617 0.760 4.800 3.702 2.280 6.080 5.560 2.353
14 0.320 0.165 0.248 1.280 5.280 1.488 3.840 10.240 6.560 2.561
15 0.369 0.069 0.367 1.476 2.208 2.202 4.428 11.808
16 0.960 0.652 0.189 3.840 20.864 11.520 30.720 24.704 5.70
17 0.168 0.261 0.486 0.672 8.352 2.916 2.016 5.376
18 0.703 0.142 0.291 2.812 4.544 8.436 22.496
19 0.233 0.424 0.514 0.932 13.568 3.084 2.796 7.456
20 0.473 0.645 0.347 1.892 20.640 2.082 5.676 15.136

where zi = xi + yi . From(54) and n=4,


(4 − 0)(32 − 0)(6.4)
I= = 153.6
20
And
2 R4 3
8x 76 5 4
I= 0 [(x + y) ]3x dx =
2 [x 2 ]0 ≈ 162.1
3 15
|162.1 − 153.6|
The relative error (σ) = × 100% ≈ 5.24%
162.1

30

Example 5. Let f (x, y) = 4 − x2 − y 2 . use the Monte Carlo method to calculate
R5R5√
approximations to the double integral 04 04 4 − x2 − y 2 dydx.
Solution
When points generated were n = 100.Then,the average of [f (xi )]100 i=1 is given by
1 P 100
fb = f (xi ) = 1.71156
100 i=1
Approximation for the integral,
R 54 R 54 √
4 − x2 − y 2 dydx ≈ (b − a) × (d − c) × n1 ni=1 f (xi , yi )
P
0 0
R 45 R 54 √ 1 P100
0 0 4 − x2 − y 2 dydx ≈ (b − a) × (d − c) × f (xi )
100 i=1
R 45 R 54 √
0 0 4 − x2 − y 2 dydx ≈ (b − a) × (d − c) × fb
R 45 R 54 √ 25
0 0 4 − x2 − y 2 dydx ≈ × 1.71156
16
R4R4√
5 5

0 0 4 − x2 − y 2 dydx ≈ 2.67432
The ’error estimate’≈ 0.0299215
Actual |volume − approx.| ≈ 0.00526343

Figure 9: The graph of Monte Carlo results when (n=100)

When points generated were n = 1000.Then,the average of [f (xi )]1000 i=1 is given by
1 P 1000
fb = f (xi ) = 1.70730
1000 i=1
Approximation for the integral,
R 54 R 54 √
4 − x2 − y 2 dydx ≈ (b − a) × (d − c) × n1 ni=1 f (xi , yi )
P
0 0
R 45 R 54 √ 1 P1000
0 0 4 − x2 − y 2 dydx ≈ (b − a) × (d − c) × f (xi )
1000 i=1
R 45 R 54 √
0 0 4 − x2 − y 2 dydx ≈ (b − a) × (d − c) × fb
R 45 R 54 √ 25
0 0 4 − x2 − y 2 dydx ≈ × 1.70730
16
31
5 5 √
4 − x2 − y 2 dydx ≈ 2.66766
R 4
R 4
0 0

The ’error estimate’≈ 0.0101795


Actual |volume − approx.| ≈ 0.00139563

Figure 10: The graph of Monte Carlo results when (n=1000)

When points generated were n = 10, 000.Then,the average of [f (xi )]10,000 i=1 is given by
1 P10,000
f=
b f (xi ) = 1.70826
10, 000 i=1
Approximation for the integral,
R 54 R 54 √
4 − x2 − y 2 dydx ≈ (b − a) × (d − c) × n1 ni=1 f (xi , yi )
P
0 0
R 45 R 54 √ 1 P10,000
0 0 4 − x2 − y 2 dydx ≈ (b − a) × (d − c) × f (xi )
10, 000 i=1
R 45 R 54 √
0 0 4 − x2 − y 2 dydx ≈ (b − a) × (d − c) × fb
R 45 R 54 √ 25
0 0 4 − x2 − y 2 dydx ≈ × 1.70826
16
R 54 R 54 √
0 0 4 − x2 − y 2 dydx ≈ 2.66916
The ’error estimate’≈ 0.00314594
Actual |volume − approx.| ≈ 0.0001046

32
Figure 11: The graph of Monte Carlo results when (n=10,000)

5 5 √
4 − x2 − y 2 dydx = 2.66905414.
R R
The analytic value of the double integral, 0
4 4
0


Figure 12: The graph of z = f (x, y) = 4 − x2 − y 2 on [ −5 , 5]
4 4

The approximations obtained with Monte Carlo simulation:


Using n=100, volume ≈ 2.674317568
|2.66905414 − 2.674317568|
The relative error (σ) = × 100% ≈ 0.19%
2.66905414
Using n=1000, volume ≈ 2.66765851
|2.66905414 − 2.66765851|
The relative error (σ) = × 100% ≈ 0.05%
2.66905414
Using n=10,000, volume ≈ 2.6691587114
|2.66905414 − 2.6691587114|
The relative error (σ) = × 100% ≈ 0.004%
2.66905414

33
5 Conclusion and Recommendation

5.1 Conclusion

The numerical evaluation of double integral is more complicated than that of single inte-
gral,since the integrand depends on two variables and we deal with the regions or surfaces
in the case.In this study the researcher had compared direct iteration method,Trapezoidal
rule and Simpson’s rule of double integral of iterations and also compared Simpson’s rule
in rectangular and non-rectangular regions with simulation of Monte Carlo for double
integrals.From the results of discussion,we concluded that Simpson’s rule for double in-
tegral of iteration is more efficient and has a less error estimations when compared to
exact value than that of Trapezoidal rule and simulation of Monte Carlo,and the accu-
racy of the methods would increase as the number of iterations were large.In more than
two dimensions,generalizations of quadrature rules are not practical, since the number
of function evaluations needed to be attain sufficient accuracy grows very rapidly as the
number of dimensions increases.An application is the Monte Carlo method,which samples
the integrand at n randomly selected points and attempts to compute the mean value
of the integrand on the entire domain by having a known probability distribution.The
method converges rather slowly but its convergence rate depends only on n, but not on
the number of dimensions.

5.2 Recommendation

This study focused on comparing different methods of double integral of iterations and
determining their accuracy to apply for Monte Carlo method.

• In this study,iterations by Trapezoidal rule, Simpson’s rule and simulation of Monte


Carlo in rectangular and non-rectangular regions were compared, and identified the
more efficient method from them when compared to the exact value.

• Further study could employ the accuracy of triple integral of iterations by Monte

34
Carlo simulation in rectangular and non-rectangular regions.

• A more efficient implementation of Monte Carlo methods is based on composite


approach or semi-analytical methods, than the further study could employ a com-
posite Monte Carlo method for the computation of integrals over hyper cubes in
Rn .

35
References

[1] Alfio Quarteroi, Riccardo Sacco and Fausto Saleri ,Numerical


Mathematics,(Springer-verlag New York,Inc,2000).

[2] Berg, Bernd A., ”Markov Chain Monte Carlo simulation and their statistical anal-
ysis”. Hackensach, NJ: world scientific,2004.

[3] Burden and Faires J.D. ”Numerical Analysis” Youngston state university 9th edi-
tion,2011.

[4] Fox L. and Mayers D.F. Computing Methods for Scientists and Engineers, Oxford
university press ,1958.

[5] Ivan Dimov, Stefka Dimova and Natalia Kolkovska,Numerical methods and
Applications(Springer-verlag Berlin Heidelberge,2011).

[6] Jain M.K., Iyenger S.R.K. and Jain R.K. ,Numerical Methods (problems and solu-
tions) New Age International publishers,2nd edition,2009.

[7] Kahaner, D.K. ”A survey of existing multidimensional quadrature routines”, in


statistical multiple integration,1991.

[8] Kathaleeya Chanada ,Komon Paisal ,on his thesis (Development of Numerical In-
tegration program ,2015).

[9] Kroese, D.P.; Taimre T.; Botev Z.I. ”Handbook of Monte Carlo methods” . New
York ,2011.

[10] Otto S.R. and Denier J.P. ” An introduction to programming and Numerical Meth-
ods in MATLAB” (Springer-verilag London Limited 2005).

[11] Peng, L.Empirical-likelihood-based confidence interval for the mean with a heavy-
tailed distribution. Annals of Statistics,32(3):1192-1214,2004.

[12] Qin, H. and Li, L. Comparison of variance estimates for the ratio estimator based
on small sample. Acta Mathematicae Applicatae Sinica, 17(4):449-456,2001.

36
[13] Ragab Khalil ,Strategic Integration of Surveying Services(Hong Kong
SAR,china,13-17 May 2007).

[14] Rao. V.Dukkipati, Numerical Methods, (New Age International (p), Ltd. Publisher,
2010).

[15] Saxena H.C., on his thesis (”Finite Differences and Numerical Analysis”, pp.120-
137, 2000).

[16] Nageri F., on his thesis (”Probability Function and Monte Carlo Double Integral ”,
pp.40-45, 2015).

37
Appendix 1

Matlab code for double integral of Trapezoidal


% f.m
function[ab]=f(x,y)
ab=sqrt((exp(sin(x.*pi-y.*pi)))+(exp(cos(x.*y.*pi))))
% trap.m
function[T]=trap(a,b,N)
h=(b-a)./N;
x=a+[0:N]*h;
y=f(x);
T=(y(1)+y(N+1)+2*sum(y(2:N)))*h/2
%main.m
clear;
Tr=zeros(6);
a=0;
b=3;
N=2.ˆ[1:10]);
for i=1:2:10;
[Tr(i)]=trap(a,b,N(i),% first integration);% second integration...
end

38
Appendix 2

Matlab code for double integral of Simpson’s


function I=simp2var(fsimp,c,d,a,b,m,n)
% I=simp2var(’fsimp’,c,d,a,b,m,n)
% simpson integration for 2 variables
% Eidt bounders ’c’,’d’,they can be variable.
%’a’ and ’b’ are fixed boundaries
h=(b-a)/(2*n);
I1=0;
I2=0;
I3=0;
for i=0;(2*n)
x=a+i*h;
dx=feval(d,x)
%cx=feval(c,x);
%dx=d;
cx=c;
kx=(dx-cx)./(2*m);
k1=feval(fsimp,x,cx)+ feval(fsimp,x,dx);
k2=0;
k3=0;
for j=1:(2*m-1)
y=cx + j*kx;
z=feval(fsimp,x,y);
if gcd(2,j)==2
k2=k2 + z;
else
k3=k3 + z;
end
end

39
L=(kx/3)*(k1 + 2*k2 + 4*k3);
if i=0|i==2*n
I1=I1 + L;
else
if gcd(2,i)==2
I2=I2 + L;
else
I3=I3 + L;
end
end
end
I=(h/3).*(I1 + 2*I2 + 4* I3);

40
Appendix 3

MatLab code for Monte Carlo method


function result=Monte Carlo_double(f,g,x0,x1,y0,y1,n )
%
%Monte Carlo integration of f over a domain g>=0,embedded
% in a rectangular [x0,x1]x[y0,y1].nˆ2 is the number of %random points.
% Draw nˆ2 random points in the rectangle.
x=x0+(x1-x0)* rand(n,1);
y=y0+ (y1-y0)* rand(n,1);
%compute sum of f values inside the integration domain f_mean=0;
num_inside =0;% number of x,y points inside domain (g>=0)
for i=1:length(x)
for j=1:length(y)
if g(x(i),y(j))>=0
num_inside=num_inside + 1;
f_mean=f_mean + f(x(i),y(j));
end
end
end
f_mean=f_mean/num_inside ;
area=num_inside/(nˆ2)* (x1 - x0)* (y1-y0);
result=area * f_mean;
end

41

You might also like