Sie sind auf Seite 1von 54

NUMERICAL

INTEGRATION:
NEWTON COTEs
FORMULAS

GROUP MEMBERS
Muhammad Saad Qureshi
Athar Minallah
Faizan Shahid
Arslan Ahmed
Najam Tariq
http://numericalmethods.eng.usf.e
du


LIST OF TOPICS TO BE COVERED
Trapezoidal Rule & its Error Analysis
Simpsons 1/3 Rule & its Error Analysis
Simpsons 3/8 Rule & its Error Analysis
EXAMPLES !
http://numericalmethods.eng.usf.e
du

What is Numerical
Integration
Integration:

The process of
measuring the area
under a function plotted
on a graph.
b

I f ( x )dx
a

Where:
f(x) is the integrand
a= lower limit of
integration
b= upper limit of
integration

Newton cotes
integration
formula

Trapezoidal
Rule

SAAD QURESHI

Basis of Trapezoidal
Rule
Trapezoidal Rule is based on the Newton-Cotes
Formula that states if one can approximate the
integrand as an nth order polynomial
b

I f ( x)dx

where

f ( x ) fn( x )

and

f n ( x ) a0 a1 x ... an 1 x n 1 an x n

http://numericalmethods.eng.
usf.edu

Basis of Trapezoidal
Rule

Then the integral of that function is


approximated
by
the
integral
of
that
nth
b
b
orderf (polynomial.
x ) fn( x )
a

Trapezoidal Rule assumes n=1, that is, the


area
under the linear polynomial,
b

f ( a ) f ( b )

(
b

a
)
f ( x )dx

2
http://numericalmethods.eng.
usf.edu


Derivation of the Trapezoidal
Rule

Method Derived From


Geometry

The area under the


curve is a
trapezoid. The
integral

f ( x)dx Area of
a

trapezoid

1
( Avgheight )( width)
2

1
f ( b ) f ( a )( b a )
2

f ( a ) f ( b )
( b a )

Example 1
The vertical distance covered by a rocket from t=8
to t=30 seconds is given by:

140000

x 2000 ln

9
.
8
t
dt

140000 2100t

8
30

a) Use single segment Trapezoidal rule to find the distance


covered.
Et
b) Find the true error,
for part (a). a
c) Find the absolute relative true error,
for part (a).

Solution
a)

f (a) f (b)

I (b a )

a 8

b 30

140000

f ( t ) 2000 ln
9.8t

140000 2100t

140000

f ( 8 ) 2000 ln
9.8( 8 )

140000 2100( 8 )

177.27 m / s

140000

9.8( 30 ) 901.67 m / s

140000 2100( 30 )

f ( 30 ) 2000 ln

10

Solution (cont)

177.27 901.67
I ( 30 8 )

a)

11868 m

b)The exact value of the above integral is


140000

x 2000 ln

9
.
8
t
dt

140000 2100t

8
30

11061 m

11

Solution (cont)

b)

Et True Value Approximat e Value


11061 11868
807 m

c) The absolute relative true error


, t , would be
11061 11868
t
100 7.2959%
11061
12

Multiple Segment Trapezoidal


Rule
Divide into equal
segments as shown in
Figure 4. Then the width
of each segment
b a is:

The integral I is:


b

I f ( x )dx
a

Figure 4: Multiple (n=4) Segment Trapezoidal


Rule
13

Multiple Segment Trapezoidal


Rule

The integral I can be broken into h integrals


as:
a ( n 1 )h
b
ah
a 2h

f ( x )dx
a

f ( x )dx f ( x )dx ...


a

ah

f ( x )dx

a ( n 2 )h

a ( n 1 ) h

Applying Trapezoidal rule on each segment gives:


b

ba

f
(
a
)

2
f ( x )dx

2n

f
(
a

ih
)

f
(
b
)

i 1

n 1

14

f ( x )dx

Example 2

The vertical distance covered by a rocket from to


seconds is given by:
30

140000

x 2000 ln
9.8t dt

140000 2100t

a) Use two-segment Trapezoidal rule to find the distance


Et
covered.
b) Find the true error,
for part (a). a
c) Find the absolute relative true error,
for part (a).

15

Solution

a) The solution using 2-segment Trapezoidal rule is

ba

I
f
(
a
)

2n

n2

n 1

i 1

f ( a ih ) f ( b )

a8

ba
30 8
h

n
2

b 30
11

16

Solution (cont)

Then:

30 8

I
f
(
8
)

2( 2 )

2 1

i 1

f ( a ih ) f ( 30 )

22
f ( 8 ) 2 f ( 19 ) f ( 30 )
4

22
177.27 2( 484.75 ) 901.67
4

11266 m
17

Solution (cont)

b) The exact value of the above integral is


30

140000

x 2000 ln

9
.
8
t
dt 11061 m

140000 2100t

so the true error is


E t True Value Approximat e Value
11061 11266
18

Newton cotes
integration
formula

Error Analysis of Trapezoidal


Rule

ATHAR

Error analysis of
Trapezoidal
rule

The error of the composite trapezoidal rule is


the difference between the value of the
integral and the numerical result

The error can be written as

There exixt a number between a and


http://numericalmethods.eng.usf.e
du
b

20


Example on Error
Analysis
http://numericalmethods.eng.usf.e
du

21

Newton cotes
integration
formula

Simpsons
1/3 Rule

FAIZAN SHAHID

Introduction:

Simpson's rule also corresponds to the three-point Newton


Cotes Quadrature Rule.
The method is credited to the mathematician Thomas
Simpson (17101761) of Leicestershire, England.
Kepler used similar formulas over 100 years prior. For this
reason the method is sometimes called Kepler's rule.
Simpsons 1/3rd rule is an extension of Trapezoidal rule and a
further improvement.
Instead of approximating the curve by a straight line, we
approximate it by a quadratic or cubic function.

Mathematical Explanation:

1/3rd rule is an extension of Trapezoidal rule


Simpsons

where the integrand is approximated by a second order


polynomial.
Hence we show below the basic mathematical background
b
b
by showing that,
I f ( x)dx f 2 ( x)dx
a

Where is a second order polynomial.2


f 2 ( x ) a0 a1 x a2 x

mathematical explanation:
(Simple Or Single Segment Case)
Choose

a b a b
,f

2
2

( a , f ( a )),

and

( b , f ( b ))

as the three points of the function to evaluate a0, a1


and a2.
2

f ( a ) f 2 ( a ) a0 a1a a 2 a

a b
a b
a b
a b
f

2
0
1
2
2
2
2
2
f ( b ) f 2 ( b ) a 0 a1b a 2 b 2
Solving the previous equations for a0, a1 and a2 give

a0

a1

a b
2
abf ( a ) b f ( a )
2
2
a 2ab b 2
a b
3af ( b ) 3bf ( a ) 4bf
bf ( b )
2

2
2
a 2ab b

a b
f(a) 2 f
f ( b )
2

a 2 2ab b 2

a 2 f ( b ) abf ( b ) 4abf
a b

af ( a ) 4af

2
a2

mathematical explanation:
(Simple Or Single Segment Case)
Then

I f 2 ( x )dx
a

a0 a1 x a 2 x 2 dx
b

x2
x3
a0 x a1 a 2
2
3 a

b2 a2
b3 a3
a0 ( b a ) a1
a2
2
3

Substituting values of a0, a1, a 2 give


b

f 2 ( x )dx

ba

a b
f
(
a
)

4
f

f
(
b
)

6
2

a
Hence
Since for Simpsons 1/3rd Rule, the interval [a, b] is broken into 2 segments, the
segment width

ba
2

f 2 ( x )dx f ( a ) 4 f
3

a b

f ( b )
2

Example:
(Simple Or two Segment Case)

Consider
the definite integral in interval [1,2].

Solve for using Simpson's 1/3 rule for function by using simple
or 2 segment case:

SOLUTION: We know that for two segment case, the Simpsons 1/3
Rule is known as,

Where, it is given:

Example:
(Simple Or two Segment Case)

Now,
we calculate as,

So, putting in the values,

mathematical explanation:
(multiple Segment Case)

Just like in multiple segment Trapezoidal Rule, one can subdivide


the interval
[a, b] into n segments band applyxn Simpsons 1/3rd Rule
ba
xn b
x0 a
repeatedly over
f ( x )dx f ( x )dx
h
a
x0
n
every
twox2segments.
x4 Note that n needs to be even. Divide
b
( xinto
)dx f ( x )dx .....
f(x)
interval
[a, fb]
f ( x )dx
a

0
2
equal segments,
hence
the segment
width.
xn 2
xn
Where,
.... f ( x )dx f ( x )dx

xn 4

. . .

xn 2

Apply Simpsons 1/3rd Rule over each interval,

f ( x0 ) 4 f ( x1 ) f ( x2 )
...
f ( x )dx ( x2 x0 )

a
f ( x2 ) 4 f ( x3 ) f ( x4 )
( x 4 x 2 )
...
6

x
x0

x2

xn
-2

xn

mathematical explanation:
(multiple Segment Case)

f ( xn 4 ) 4 f ( x n 3 ) f ( xn 2 )
f ( xn 2 ) 4 f ( xn 1 ) f ( xn )
... ( xn 2 xn 4 )

...

(
x

x
)
n
n

6
6

Since

x i xi 2 2 h

i 2 , 4, ..., n

Then
b

f ( x0 ) 4 f ( x1 ) f ( x2 )
...

f ( x2 ) 4 f ( x3 ) f ( x4 )
2h
...

f ( x )dx 2h

f ( x n 4 ) 4 f ( xn 3 ) f ( x n 2 )
...

f ( xn 2 ) 4 f ( xn 1 ) f ( xn )
2h

2h

mathematical explanation:
(multiple Segment Case)

h
3

f ( x )dx f ( x0 ) 4 f ( x1 ) f ( x3 ) ... f ( xn 1 ) ...

... 2 f ( x2 ) f ( x4 ) ... f ( xn 2 ) f ( xn )}]

n 1
n2
h

f ( x 0 ) 4 f ( xi ) 2 f ( xi ) f ( x n )

3
i 1
i 2
i

odd
i

even

n 1
n 2
ba

f ( x 0 ) 4 f ( xi ) 2 f ( xi ) f ( x n )

3n
i 1
i 2
i

odd
i

even

example:
(multiple Segment Case)

Consider
the definite integral in interval [1,2].

Solve for using Simpson's 1/3 rule for function by using


6 segments:

n 1
n2
h
f for
SOLUTION: We knowthat
the
( x0 )multiple
4 f ( xisegment
) 2 f ( xcase,
i ) f ( xn )

3
1
i 2
Simpsons 1/3 Rule is known
as, i i odd
i

even

Where,

example:
(multiple Segment Case)

We
know that,

Calculating
points and their function values,
POINTS:
FUNCTION

POINTS:

FUNCTION VALUES:
VALUES:

example:
(multiple Segment Case)

Putting
the values in the function,

Advantages & DisAdvantages:

In the Trapezoid rule method, we start with


rectangular area-elements and replace their
horizontal-line tops with slanted lines. The areaelements used to approximate, say, the area under
the graph of a function and above a closed interval
then become trapezoids. Simpsons method
replaces the slanted-line tops with parabolas.
Simpsons rule approximations usually achieve a
given level of accuracy faster. Simpsons rule is
indeed much better than the Trapezoid rule. As n
it generally converges much more rapidly to the
value of the definite integral than does the
Trapezoid rule.

Newton cotes
integration
formula

Simpsons
3/8 Rule

ARSLAN AHMED

Formula

Derivation

using matrixes
using lagrange interpolation
Not to discuss here

composite simpson 3/8 rule for


multiple segments

Example 1 (Single Simpson 3 8 rule)


Compute
b 30

140,000

I 2000 ln
9.8 x dx,
140,000 2100 x

a 8

by using a single segment Simpson 3/8 rule


Solution
In this example:
b a 30 8
h http://numericalmethods.eng.

7.3333
40
3usf.edu 3

140000

x0 8 f x0 2000 ln
9.8 8 177 .2667
140000 2100 8

x1 x0 h 8 7.3333 15.3333

140000

f x1 2000 ln 140000 2100 15.3333 9.8 15.3333 372 .4629

http://numericalmethods.eng.
usf.edu

41

x2 x0 2h 8 2(7.3333) 22.6666

140000

f
x

2000
ln

9.8 22.6666 608 .8976


2

140000 2100 22.6666

x3 x0 3h 8 3(7.3333) 30

140000

f
x

2000
ln

9.8 30 901 .6740


3

140000 2100 30

http://numericalmethods.eng.
usf.edu

42

Applying Eq. (12), one has:


3
I 7.3333 177 .2667 3 372 .4629 3 608 .8976 901 .6740
8
I 11063 .3104

The exact answer can be computed as


I exact 11061 .34
http://numericalmethods.eng.
usf.edu

43

3
Example 2 (Multiple segments Simpson
8
b 30

rule)

140,000

ComputeI 2000 ln
9.8 x dx,
140,000 2100 x

a 8

sing Simple
8multiple segments rule, with numbe
of
"h) "segments = n= 6 (which corresponds to 2
big segments).
http://numericalmethods.eng.
usf.edu

44

Solution
In this example, one has (see Eq. 14):
30 8
h
3.6666
6

x0 , f x0 8,177.2667

x1, f x1 11 .6666,270.4104; where x1 x0 h 8 3.6666


11 .6666
x2 , f x2 15.3333,372.4629; where x2 x0 2h 15.3333

x3 , f x3 19,484.7455; where x3 x0 3h 19
http://numericalmethods.eng.
usf.edu

45

x4 , f x4 22.6666,608.8976; where x4 x0 4h 22.6666

x5 , f x5 26.3333,746.9870; where x5 x0 5h 26.3333


x6 , f x6 30,901.6740; where x6 x0 6h 30
http://numericalmethods.eng.
usf.edu

46

Applying Eq. (17), one obtains:


n 2 4
n 1 5
n 3 3

3
I 3.6666 177 .2667 3 f xi 3 f xi 2 f xi 901 .6740
8
i 1, 4,..
i 2,5,..
i 3,6,..

177 .2667 3 270 .4104 608 .8976 3 372 .4629 746 .9870
I 1.3750

2
484
.
7455

901
.
6740

I 11,601 .4696

http://numericalmethods.eng.
usf.edu

47

x0 a 8

x1 x0 1h 8 3.1429 11 .1429

x2 x0 2h 8 2 3.1429 14.2857 Simpson 1 rule


3
x3 x0 3h 8 3 3.1429 17.4286

x4 x0 4h 8 4 3.1429 20.5714
x5 x0 5h 8 5 3.1429 23.7143

x6 x0 6h 8 6 3.1429 26.8571
x7 x0 7 h 8 http://numericalmethods.eng.
7 3.1429 30
usf.edu

48

140,000

f x0 8 2000 ln
9.8 8 177 .2667
140,000 2100 8

Similarly:

f x1 11 .1429 256 .5863


f x2 342 .3241
f x3 435 .2749

f x4 536 .3909
f x5 646 .8260

f x6 767 .9978
f x7 901 .6740

http://numericalmethods.eng.
usf.edu

49

For multiple segments n1 first 4 segments


using Simpson 1 rule, one obtains (See Eq. 19):
3
n1 13
n1 2 2

h
I1 f x0 4 f xi 2 f xi f xn1
3
i 1,3,...
i 2,...

3.1429
I1
177 .2667 4 256 .5863 435 .2749 2 342 .3241 536 .3909
3

I1 4364 .1197

http://numericalmethods.eng.
usf.edu

50

For multiple segments n2 last 3 segments


using Simpson 3/8 rule, one obtains (See Eq. 17):
n2 2 1
n2 1 2
n2 3 0

3h
I2
f x0 3 f xi 3 f xi 2 f xi f xn1
8
i 1,3,...
i 2,...
i 3 , 6 ,...

I 2 3.1429 177 .2667 3 256 .5863 3 342 .3241 skip! 435 .2749
8

I 2 6697 .2748

The mixed (combined) Simpson 1/3 and 3/8 rules giv


I I1 I 2 4364 .1197 6697 .2748
http://numericalmethods.eng.
I 11,061 .3946
usf.edu

51

Remarks:
(a) Comparing the truncated error of Simpson 1/3 ru
Et

b a

2880

(18)

With Simple 3/8 rule (See Eq. 13), the latter seems
offer slightly more accurate answer than the former
However, the cost associated with Simpson 3/8 rule
(using 3rd order polynomial function) is significant
higher than the one associated with Simpson 1/3 ru
http://numericalmethods.eng.
(using 2nd order polynomial
function). 52
usf.edu

(b) The number of multiple segments that can be us


in the conjunction with Simpson 1/3 rule is 2,4,6,8,..
(any even numbers).

h
f x0 4 f x1 f x2 f x2 4 f x3 f x4 ..... f xn 2 4 f xn 1 f xn
3

I1

n 1
n2

h
I 2 f x0 4 f xi 2 f xi f xn
3
i 1,3,...
i 2, 4, 6...

http://numericalmethods.eng.
usf.edu

(19)

53

However, Simpson 3/8 rule can be used with the


number of segments equal to 3,6,9,12,.. (can be
either certain odd or even numbers).

(c) If the user wishes to use, say 7 segments, then t


mixed Simpson 1/3 rule (for the first 4 segments),
and Simpson 3/8 rule (for the last 3 segments).

http://numericalmethods.eng.
usf.edu

54

Das könnte Ihnen auch gefallen