You are on page 1of 11

Advanced Numerical Analysis

Numerical Integration

EMAN MAHMOUD ALAROUD


Department of Mathematics, College of Science, The Ajloun National University

Abstract

In this article we will discass, that numerical integration constitutes a broad family of algorithms for calculating
the numerical value of a definite integral, and by extension, the term is also sometimes used to describe the
numerical solution of differential equations. many functions either cannot be expressed or cannot be
expressed easily in closed form (that is, in terms of known functions). Consequently, rather than evaluate
definite integrals of these functions directly, we resort to various techniques of numerical integration to
approximate their values. we explore several of these techniques. In addition, we examine the process of
estimating the error in using these techniques.. The suggested techniques

Trapezoidal rule
Simpson's rule

1. Introduction

The study of numerical integration focuses on how to calculate an integral's numerical value. The roots of
this topic can be found in antiquity. The Greek quadrature of the circle by means of inscribed and
circumscribed regular polygons is a beautiful illustration of ancient numerical integration, but one that is
perfectly consistent with the spirit of the present volume. Archimedes arrived at an upper and lower bound
for the value of π.nd by this approach.

Numerous techniques for numerical integration have been developed throughout history

quadrature method

In which the approximate numerical value of the integration is calculated using some nodes and the values
of the integral function at these nodes. We also have the base of the left rectangles, the base of the right
rectangles, and the base of the trapezoid, in addition to the Simson rule

‫ هى‬this paper, we will focus a little on Simpson's rule in the first place, and on the trapezoidal rule

1
Advanced Numerical Analysis

In reality Simpson's rule for estimating definite integrals is named after Thomas Simpson (1710-1761), who
published it in 1743. However, Simpson was not the first to discover the rule; Bonaventura Cavalieri (1598-
1647) found a version of it as early as 1639, and James Gregory (1638-1675) published it in 1668 [3, p. 77].
Gregory also discovered another family of numerical integration rules

Our purpose in this paper is to introduce a generalization of Simpson's rule. Like Simpson's rule, our
generalization involves estimating a definite integral by using quadratic polynomials to approximate the
integrand on a sequence of intervals. How- ever, some instances of our generalized Simpson's rule are
significantly more accurate than Simpson's rule.

All of the numerical integration formulas we discuss in this paper have the form

∫ f ( x ) . dx ≈ w1 f ( x 1) + w2 f ( x 2 ) +…+ wn 〖 f ( x 〗¿¿ n )−∞ ≤ a ≤ b ≤ ∞ ¿


a

2. Numerical methods for calculating numerical integration

a) Trapezoids method:

When using the trapezoidal method to determine a rough estimate of the definite integral:

The "Trapezoidal Rule" is one of calculus's most important integration rules. This form is called a trapezoid
because tiny trapezoids, rather than rectangles, are utilized to divide the overall area when calculating the
area under the curve. In order to approximate the definite integrals, this rule uses the linear approximations
of the functions.

The trapezoidal rule is widely used in numerical analysis techniques. We can also estimate the definite
integrals using Riemann sums, which use tiny rectangles to get the area under the curve.

2
Advanced Numerical Analysis

Trapezoidal Rule Formula

• Let f ( x)be a continuous function on the interval [a, b]. Now divide the intervals [a, b] into n equal
subintervals with each of width,

• Δ x=(b−a)/ n , Such that a=x 0< x 1< x 2< x 3<… ..< x n=b

• Then the Trapezoidal Rule formula for area approximating the definite integral ∫ a b f ( x )dx is given
by:

b ∆x
• ∫ f ( x ) . dx ≈ T n= 2
[ f ( x 0 )+ 2 f ( x 1) + 2 f ( x2 ) + …+…+2 f ( x n−1 ) + f (x n)] ¿
a
¿
Where , xi=a+i Δ x
b

• If n → ∞, R . H . S of the expressionapproaches the definite integral∫ f ( x )dx .


a
Error bound for trapezoidal rule
iiiii 3
M (b−a)
T n≤ 3
12 n

3
Advanced Numerical Analysis

Example

∫ sin 2 . dx=¿ ¿ Use the Trapezoidal Rule with n=6 to approximate


0
: solution
: Here
a=0∧b=π . f (x)=sin ⁡(x )

The width of each subinterval is


b−a
∆ x=
n
π
=
6

π
π
∫ sin 2 x dx= 12 ¿¿¿
0

Exact solution

4
Advanced Numerical Analysis

b-Simpson's Rule

In the last part , Trapezoidal Rule, we used straight lines to model a curve and learned that it was an
improvement over using rectangles for finding areas under curves because we had much less "missing" from
each segment. We seek an even better approximation for the area under a curve

We will use parabolas to approximate each component of the curve in Simpson's Rule. Since it is typically
more precise than the other numerical methods, this tends to be quite effective. iv

Note: In Simpson's Rule, n must be EVEN

Simpson’s Rule Formula


The formula for Simpson's rule methods forn+1equally spaced subdivision is given below. Simpson's rule
methods are more accurate than the other numerical approximations
b
.∫ f ( x ).d x ≈ (h/3)[f (x 0)+ 4 f ( x 1)+2 f (x 2)+ …+2 f (xn−2)+ 4 f (xn−1)+ f ( x n)]
a

5
Advanced Numerical Analysis

Here ,
n is an even number which isthe number of subintervals that the interval[ a , b] should be divided into .
(n is usually mentioned ∈the problem)
x 0=a∧xn=b
h=[(b−a)/n]
x 0 , x 1, … . , xn are theends of then subintervals .

Example

0.5

∫ x ( ln x+1 ) . dx for n=6 Use Simpson's rule to evaluate the integral


−0.5

x 0=−0.5
x 1=−0.333
x 2=−0.166
x 3=0
x 4 =0.166
x 5=0.5
1 0.5−−0.5
6 = h=
6
0.5

∫ x ( ln x+1 ) . dx= 16 [ ]
−0.5
3

6
Advanced Numerical Analysis

Exact solution

Integrate by parts using the formula ∫udv=uv−∫vdu


0.08802039

Comparison of errors in Simpson's method and trapezoid method

∫ e−x dx ¿ ¿ Approximate
2

0
2

¿ two decimal places. The second derivative of f =e−x


is( 4 x 2−2) e−x 2 ,∧¿ is not hard ¿ seethat on[0,1]
2 2
,∨(4 x −2)e−x ∨≤ 2

7
Advanced Numerical Analysis

. We beginby estimating the number of


subintervals we are likely ¿ need .¿ get
two decimal places of accuracy , we will certainly need
E( Δ x)<0.005
¿
1 1
( 2 ) 2 <0.005
12 n
1
( 200 )< n2
6
5.777 ≈
√ 100
3
<n
1
With n=6 the error estimate is thus ¿ < 0.00047 ¿
3
6

compute the trapezoid approximation for six intervals:

( f (0)
2 () ()
+f
1
6
+f
2
6
+ ⋯+ f
6 ()
5 f (1) 1
+
2 6 )
≈ 0.74512 .

So the true value of the integral is between 0.74512−0.0047=0.74042

and 0.74512+0.0047=0.74982

. Unfortunately, the first rounds to 0.74

and the second rounds to 0.75

, so we can't be sure of the correct value in the second decimal place; we need to pick a larger n

As it turns out, we need to go to n=12

to get two bounds that both round to the same value, which turns out to be 0.75

. For comparison, using 12

rectangles to approximate the area gives 0.7727

, which is considerably less accurate than the approximation using six trapezoids.

In practice it generally pays to start by requiring better than the maximum possible error; for example, we
might have initially required E(Δx)<0.001

8
Advanced Numerical Analysis

, or

1 1
( 2 ) <0.001
12 n2

1
( 1000 ) < n2
6

12.91 ≈
√ 500
3
<n

Had we immediately tried n=13

this would have given us the desired answer

Error by Simpson's method

9
Advanced Numerical Analysis

10
i
)https://byjus.com/maths/trapezoidal-rule/
https://ar.wikipedia.org/wiki/%D9%82%D8%A7%D8%B9%D8%AF%D8%A9_
%D8%B3%D9%85%D8%A8%D8%B3%D9%88%D9%86
ii
)the GeneralizeedSipsons Rule by Daniel J Velleman
iii
) https://www.cuemath.com/trapezoidal-rule-formula
iv
https://www.intmath.com/integration/6-simpsons-rule.php

You might also like