Sei sulla pagina 1di 16

B3001/UNIT 4/1

UNIT 4

TRAPEZOIDAL AND SIMPSONS


RULE

OBJECTIVES

General Objective

To determine the area of an uninformed plane using


Trapezoidal and Simpsons Rule.

Specific Objectives :

On completion of this unit, you should be able to:

find the area of a plane using the Trapezoidal rule.

find the area of a plane using the Simpsons rule

Pepared by : Nithya A/P Periasamy

Page 1

B3001/UNIT 4/1

INPUT

4.0

INTRODUCTION
Using numerical analysis, function y can be determined for some values of x in an

experiment data or calculation of function. These data can be retrieved from experiments
or calculated from given function. These data are filled in the table form for function
y = f(x) then its is equivalent to the integral of function y = f(x) within x = a and x = b.
X

X0

X1

X2

Xn

Y0

Y1

Y2

yn

Using x0=a and xn=b the values of x are constant h;


i.e
h=xi+1 xi

i = 0,1, n 1

Figure 6.1 shows the values for yi is a function of xi.. Integrating the function of f
between x = a and x = b, you will find the area graph and the x-axis. Geometrically this
area can be estimated from the sum of area from rectangles width h and height yi
(i=0,1,.,n-1) shown in the figure. 6.2
y2

y3
yn-2

y1

yn-1
yn
y0

a=x0

x1

x2

x3

xn-2

xn-1

xn

Fig. 6.1
Pepared by : Nithya A/P Periasamy

Page 2

B3001/UNIT 4/1
y3

y2

Yn-2
y1

Yn-1

yn
y0

a=x0

x1

x2

x3

xn-2

xn-1

xn

Fig 6.2
Mathematically, we write the equation as
Sum of area = hy0 + hy1 + hy2 + . + hyn-2 + hyn-1
or
n 1

Area = h yi
i 0

In other words, we have to integrate as


b

f ( x)dx h

n 1

y
i 0

This is just a rough estimate and it is best to choose a small value of h


(distance between xn).

Pepared by : Nithya A/P Periasamy

Page 3

B3001/UNIT 4/1

INPUT

4.1 TRAPEZOIDAL RULE


Using this method, the area under a function curve can be substituted with the
area within limits of adjacent yi. This limit forming a trapezium and its area can be
defined as in figure 4.3 below:.
y3
yn-2

y2

yn-1
yn

y1
y0

x0

x1

x2

x3

xn-2

xn-1

xn

Figure 6.3

The area for each trapezium with corresponding heights yi and yi+1 is given as

h
Area = ( yi + yi 1 ) ; i = 0,1,2,.n-1
2

Pepared by : Nithya A/P Periasamy

Page 4

B3001/UNIT 4/1
The sum area of all trapezium between x0 and xn as
h
h
h
h
h
= ( y0 y1 ) ( y1 y2 ) ( y2 y3 ) ... ( yn 2 yn 1 ) ( yn 1 yn )
2
2
2
2
2

Sum area

h
= ( y0 2 y1 2 y2 ...... 2 yn 2 2 yn 1 yn )
2

This sum of area can be summarized as


b

f ( x)dx 2 ( y

2 y1 2 y2 ..... 2 yn 2 2 yn 1 yn )

yi= f(x), x0=a, xn= b and h = xi+1 xi (i=0,1,2,.,n-1)


Example 4.1 :
Using the trapezoidal rule for y = 2x2 we can calculate the values of I
10

I= f ( x)dx
0

For values of yi f ( xi ) are calculated in the table below:

10

32

72

128

200

Solutions :
Using the trapezoidal rule,
b

f ( x)dx 2 ( y

2 y1 2 y2 ..... 2 yn 2 2 yn 1 yn )

for h = 2, then :
I

2
0 2(8 32 72 128) 200
2

= 680.0

This answer is just estimation. Using differentiation, the real value is 2000/3 = 666.7.
Pepared by : Nithya A/P Periasamy

Page 5

B3001/UNIT 4/1

ACTIVITY 4a

1.

Given the differentiation of

1
is tan-1 x. Comparing tan-1 s with
1 x2

dx

1 x

for s = 0.1,0.2,..,2.0. and h = 0.05 (Use Trapezium rule)

2.

Calculate

x dx

using trapezium rule for s = 2, s = 3, s= 3

s = 4, s = 5 and h = 0.025. Compare your answer with ln s.

Pepared by : Nithya A/P Periasamy

Page 6

B3001/UNIT 4/1

FEEDBACKS 4a
1

Integrate

Integrate

1
x2 1

Trapezium Rule

Tan-1s

0.1

0.09963

0.09966

0.2

0.19732

0.19739

0.3

0.29135

0.29145

0.4

0.38038

0.38050

0.5

0.46351

0.46364

0.6

0.54028

0.54041

0.7

0.61059

0.61072

0.8

0.67462

0.67474

0.9

0.73270

0.73281

1.0

0.78529

0.78539

1.1

0.83289

0.83298

1.2

0.87597

0.87605

1.3

0.91503

0.91510

1.4

0.95048

0.95054

1.5

0.98273

0.78279

1.6

1.01214

1.01219

1.7

1.03903

1.03907

1.8

1.06366

1.06369

1.9

1.08628

1.08631

2.0

1.10712

1.17014

Trapezium rule

Ln S

2.0

0.69319

0.69314

3.0

1.09866

1.09861

4.0

1.338634

1.38629

5.0

1.60949

1.60943

1
x

Pepared by : Nithya A/P Periasamy

Page 7

B3001/UNIT 4/1

INPUT

4.2

SIMPSONS RULE

In the following equation


y f 0 pf 0

p( p 1) 2
p( p 1)( p 2) 3
f0
f 0 .....
2
6

if you integrate between x0 and x2, you will find


x2

x0

ydx h ydp
2

1
1
1
1
1
1

h pf 0 p 2 f 0 ( p3 p 2 )2 f 0 ( p 4 p3 p 2 )3 f 0 ...
2
6
4
24
6
6

0
1

h 2 f 0 2f 0 2 f 0 03 f 0 ........
3

and if the first 3 terms are taken, you will find


x2

ydx h2 f

x0

2f 0 3 f 0
3

= h 2 f 0 2( f1 f 0 ) ( f 2 2 f1 f 0
3

= h( f 0 4 f1 f 2 )
and in this formula, the first term involved 4 f 0 is ignored as the coefficient of 3 f 0 = 0
It can be shown that this term is

h 4
f 0 and you can expect Simpsons rule to be
90

more precise than the trapezium rule.


On implementing it, you have to group y in a group of threes. In between a darker
line is marked. On every three points, two marked lines will represent the area
h
h
h
( y0 4 y1 y2 ), ( y2 4 y3 y4 ), ( y4 4 y5 y6 ),.........
3
3
3

Pepared by : Nithya A/P Periasamy

Page 8

B3001/UNIT 4/1
The sum of area

h
h
h
( f 0 4 f1 f 2 ) ( f 2 4 f3 f 4 ) ( f 4 4 f5 f 6 ),.....
3
3
3

h
( f 0 4 f1 2 f 2 4 f3 2 f 4 4 f5 .....)
3

Y4
Y3

Y2
y0
y1

x0

x1

x2

x3

x4

Fig 6.4
This rule can be expanded for all values of x ; each has to consist 2 marked lines (for
every three points). If the number of marked lines is n, the rule will follow.

xn

ydx 3 ( f

4 f1 2 f 2 4 f3 .... 4 f n 3 2 f n 2 4 f n 1 f n )

x0

Example 4.2 :
10

Integrate y= 2x2 using Simpsons rule if I =

f ( x)dx
0

Solution :
with h = 1, you have 10 marked lines with 11 points.

Pepared by : Nithya A/P Periasamy

Page 9

B3001/UNIT 4/1

10

18

32

50

72

98

128

162

200

Using Simpson rule, you will have :


1
0 4(2) 2(8) 4(18) 2(32) 4(50) 2(72) 4(98) 2(128) 4(162) 200
3
2000
I
3
I

I 666.7

Pepared by : Nithya A/P Periasamy

Page 10

B3001/UNIT 4/1

ACTIVITY 4b
1.

1
Given the differentiation of
is tan-1 x. Comparing tan-1 s with
2
1 x

dx

1 x

for s

= 0.1,0.2,..,2.0. and h = 0.05 [Use Simpson rule)

2.

Calculate

x dx

using Simpsons rule for s = 2, s = 3, s= 3

s = 4, s = 5 and h = 0.025. Compare your answer with ln s.

Pepared by : Nithya A/P Periasamy

Page 11

B3001/UNIT 4/1

FEEDBACK 4b
1.

2.

Integrate

1
x2 1

Differentiate

Simpson rule

Tan-1s

0.1

0.09967

0.09966

0.2

0.19740

0.19739

0.3

0.29146

0.29145

0.4

0.38051

0.38050

0.5

0.46365

0.46364

0.6

0.54042

0.54041

0.7

0.61073

0.61072

0.8

0.67474

0.67474

0.9

0.73282

0.73281

1.0

0.78540

0.78539

1.1

0.83298

0.83298

1.2

0.87606

0.87605

1.3

0.91510

0.91510

1.4

095055

0.95054

1.5

0.98279

0.78279

1.6

1.01220

1.01219

1.7

1.03907

1.03907

1.8

1.06370

1.06369

1.9

1.08632

1.08631

2.0

1.10715

1.10714

Simpson rule

ln s

2.0

0.69315

0.69314

3.0

1.09861

1.09861

4.0

1.38629

1.38629

5.0

1.60944

1.60943

1
x

Pepared by : Nithya A/P Periasamy

Page 12

B3001/UNIT 4/1

SELF ASSESSMENT

1.

Using Simpsons rule, integrate

y.dx when y=f(x)


2

10

2.

Calculate

x2

dx . For x = 10 , the values of integration did not contribute

much , then the answer is best in the form of

3.

4.

Estimate

12

Trapeziums rule for n = 12

b)

Simpsons rule for n = 6

dx

1 x
0

. Use h = 1, h =0.5 and h = 0.1.

x 2 dx using

a)

Estimate

using

a)

Trapeziums rule for n = 6

b)

Simpsons rule for n = 3

Pepared by : Nithya A/P Periasamy

Page 13

B3001/UNIT 4/1

Pepared by : Nithya A/P Periasamy

Page 14

B3001/UNIT 4/1

FEEDBACK TO SELF ASSESSMENT

1.

44.3 unit2

2.

Intgration for e x

Trapezium rule

Simpson rule

1.0

0.886318602

0.836214302

0.5

0.886226926

0.886196367

0.1

0.886226926

0.886226924

a) 578
b) 576

4.

a) 1.15
b) 1.16

Pepared by : Nithya A/P Periasamy

Page 15

Potrebbero piacerti anche