Tải bản đầy đủ (.pdf) (10 trang)

A textbook of Computer Based Numerical and Statiscal Techniques part 35 pptx

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (152.14 KB, 10 trang )

326
COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES

[]
2(10)
7(0) 32(4) 12(7) 32(9) 7(12) 32(15) 12(14) 32(8) 7(3)
45
= +++++ + ++
= 708
Hence the required area of the cross-section of the river = 708 sq. m. Ans.
(ii) By Simpson’s one-third rule,

[]
80
08 1357 246
0
()4( )2( )
3
h
ydx yy yyyy yyy
= ++++++++


()
10
[ 0 3 4(4 9 15 8) 2(7 12 14)]
3
=++++++++
= 710
Hence the required area of the cross-section of the river = 710 sq. m. Ans.
Example 10. Evaluate


1
0
1
dx
x+

by dividing the interval of integration into 8 equal parts. Hence find
log
e
2 approximately.
Sol. Since the interval of integration is divided into an even number of subintervals, we shall
use Simpson’s one-third rule.
Here,
1
()
1
yfx
x
==
+
0
1
(0) 1,
10
yf== =
+

1
118
,

1
89
1
8
yf

===


+

2
24
,
85
yf

==


3
38
,
811
yf

==


4

42
,
83
yf

==



5
58
,
813
yf

==


6
64
,
87
yf

==


7
78
,

815
yf

==


and
8
1
(1) .
2
yf==
Hence,
012345678
1234567
0 1
8888888
84828481
1
9 5113137152
x
y
yyyyyyyyy
By Simpson’s one-third rule

[]
1
08 1357 246
0
()4( )2( )

13
dx h
yy yyyy yyy
x
= + + +++ + ++
+

=
1 1 8888 424
14 2
24 2 9 11 13 15 5 3 7

  
++ +++ + ++
  

  

(Hence, h = 1/8)
= 0.69315453. Ans.
NUMERICAL DIFFERENTIATION AND INTEGRATION
327
Since
[]
1
1
0
0
log,(1 )
log 2

1
dx
x
x
+
==
+

log
e
2 = 0.69315452. Ans.
6.10 EULER-MACLAURIN’S FORMULA
This formula is based on the expansion of operators. Suppose
() (),
Fx fx∆=
then an operator
1−

,
called inverse operator, is defined as

1
() ()
Fx f x

=∆
Again we have
0
() ( )
Fx f x∆=



10 0
() () ()
Fx Fx f x−=
() ()
21 1
()
Fx F x f x
−=


11
()()()
nn n
Fx Fx fx
−−
−=
Adding all these, we get

1
0
0
() () ()
n
ni
i
Fx Fx f x

=

−=

(1)
where x
0,
x
1,
x
n
, are the (n+1) equidistant values of x with interval h.
Now
11
() ()(1)()
Fx f x E f x
−−
=∆ = −

()
1
1()
hD
efx

=−

1
22 33
1 1 ( )
2! 3!
hD hD

hD f x




=++ + + −






1
22 33
( )
2! 3!
hD hD
hD f x


=+ + +



1
22
1
( ) 1 ( )
2! 3!
hD h D

hD f x





=+++






()
2
22 22
1
1(1)(2)
1
2! 3! 2! 2! 3!
hD h D hD h D
Dfx
h



−−

=−+++ +++






22 44
1
1
1 ()
2! 12 720
hD h D h D
Dfx
h


= −+−+



3
11
() () () ()
212 720
hh
fxdx fx f x f x
h
′′′′
=−+−

(2)
328

COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES
Between limits x = x
0
and x = x
n
from equation (2), we have

{}{}
0
000
11
() () () () () () ()
212
n
x
nnn
x
h
Fx Fx fxdx fx fx f x f x
h
′′
−= − − + −

3
0
{ ( ) ( )}
720
n
h
fx fx

′′′ ′′′
−−+
(3)
From eqs. (1) and (3), we have

{}{}
1
00
0
1
11
() () () () () ()
212
n
n
x
inn
i
h
fx fxdx fx fx f x f x
h

=
′′
=−−+−


{}
3
0

( ) ( )
720
n
h
fx fx
′′′ ′′′
−−+
But
1
00
() () ( )

==
=−
∑∑
nn
iin
ii
fx fx fx
and
0
n
xxnh
=+
. Then the above relation reduces to
()
{}
{}
0
0

00
0
11
() ( ) ( ) ( ) ()
212
n
xnh
in
x
i
h
fxdx fx fx f x f x nh f x
h
+
=
′′
=−+− +−


{}
3
00
( ) ( )
720
h
fxnh fx
′′′ ′′′
−+−+
(4)


{}

=+++++

0
012 1
() ()2()2() 2( ) ()
2
n
x
nn
x
h
fxdx fx fx fx fx fx
()
{}
{}
′ ′ ′′ ′′
−−+ −+
24
00
() () ()
12 720
nn
hh
fx fx fx fx

0
24
01 2 1 0 0

(2 2)()()
212720
n
x
nn n n
x
hhh
ydx y y y y y y y y y

′ ′ ′′′ ′′′
=+++++− −+ −+

which is known as Euler’s Maclaurin’s summation formula.
Example 11. Evaluate
1
0
1
dx
x+

to five places of decimal, using Euler-Maclaurin’ formula.
Sol. Let
1
1
y
x
=
+
Here, we have x
0

= 0, n = 10 and h = 0.1
Then we want to evaluate
1
0
x
x
ydx

where
2
1
(1 )
y
x

=
+
and
4
6
(1 )
y
x
′′′
=−
+
Using Euler-Maclaurin formula, we get

()()
24

1
012 0 0
0
22 ( )
1 2 12 720
nn n
dx h h h
yyy y yy yy
x
′ ′ ′′′ ′′′
=++++− −+ −+
+

NUMERICAL DIFFERENTIATION AND INTEGRATION
329

0.112222222221
2 1 1.01 1.02 1.03 1.04 1.05 1.06 1.07 1.08 1.09 2

= ++++++++++


24
222 44
(0.1) 1 1 (0.1) 6 6
720
121 21

−−++−+



= 0.693773 − 0.000625+0.000001 = 0.693149. Ans.
Example 12. Using Euler-Maclaurin’s formula, obtain the value of log
e
2 from
1
0
1
dx
x+

.
Sol. Let
1
()
1
yfx
x
==
+

0
1
, 0, 10, 0.1, 1.
1
n
yxnhx
x
=====
+



23
12
,
(1 ) (1 )
yy
xx
′′′
=− =
++
and
4
6
(1 )
y
x
′′′
=−
+
Then by Euler-Maclaurins’s formula, we get

1
0
11222222 2

2 1 0 1 0.1 1 0.2 1 0.3 1 0.4 1 0.5 1 0.6 1 1.0
ydx

= ++++++++


+++++++ +



()
24
22 4 4
(0.1) 1 1 (0.1) 6 6
12 720
(1 0) (1 1) (1 0)
11



−+−+


+++
+



= 0.693773 − 0.000625 + 0.0000010
= 0.631149. Ans.
Example 13. Find the sum of the series using Euler-Maclaurin formula.
222 2
111 1
.
51 53 55 99

++++
Sol. Here, we have
0
2
1
,51,24,2
yxnh
x
====
Then
1
35
224
,
yy
xx

′′′
==−
and so on.
Using Euler-Maclaurin’s formula, we get

()
′ ′ ′′′ ′′′
=+++++− −+ −+

24
99
012 2324 240 240
2

51
1
(22 2 ) ( )
212720
hhh
dx y y y y y y y y y
x

222 22 33 55
1 2 2 2 1 4 2 2 16 24 24

12 720
51 53 55 97 99 99 51 99 51

= +++++ −−+ + −+ +


which gives

99
222 22 2 33 55
51
122 21 1 211 811

315
51 53 55 97 99 51 99 51 55
dx
x

+++++= + − − − +





99
222 2 2 22 33 55
51
111 1 1 11211 811
2
315
51 53 55 99 51 99 51 99 51 55
dx
x
  
++++= +++ −− −+
  
  

330
COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES

99
222 2 22 33 55
51
111 111 111111 411

22 3 15
51 53 55 99 51 99 51 99 51 99
x


++++=−+++−− −+




= 0.00475 + 0.00024 + 0.000002 +
= 0.00499. Ans.
Example 14. Use Euler-Maclaurin’s formula to prove that

2
(1)(21)
6
n
i
nn n
x
++
=

·
Sol. By Euler-Maclaurin’s formula,
()
()
0
24 6
02 1 0 0 0
( 2 2 2 ) ( )
2 12 720 30240
n
x

vv
innnnn
x
hhhh
ydx y y y y y y y y y y y

′ ′ ′′′ ′′′
=+++++− −+ −− −+



012 1
11

22
nn
yyy y y

+++ + +

()()
()
0
35
00
1

12 720 30240
n
x

vv
nn n n
x
hh h
ydx yy yy yy
h
′ ′ ′′′ ′′′
= + −− −+ −−

(1)
Here,
2
() , () 2
yx x y x x

==
and
1h =


From (1),
Sum
()
()
22
1
11
122
212
n

xdx n n
=+++−

3
1
2
1
2
1
22
0
2
yy
n
n
==
F
H
G
I
K
J
,

()()
()
32
111 (1)(21)
111
326 6

nn n
nnn
++
=−+++−=
. (Proved)
PROBLEM SET 6.2
1. Use Trapezoidal rule to evaluate
1
3
0
xdx

consisting five sub-intervals. [Ans. 0.26]
2. Calculate an approximate value of integral
/2
0
sin
xdx
π

, by using Trapezoidal rule.
[Ans. 0.99795]
3. Evaluate the integral
4
0
x
edx

by Simpson’s one-third rule. [Ans. 53.87]
4. Using Simpson’s

3
8
rule, evalute
1
0
1
1
dx
x+

with
1
6
h =
·[Ans. 0.69319]
5. Use Boole’s rule to compute
/2
0
sin
xdx
π

.[Ans. 1.18062]
6. Using Weddle’s rule to evaluate
5
0
45
dx
x +


.[Ans. 0.4023]
7. Evaluate the integral
/2
0
cos
d
π
θθ

by dividing the interval into six parts. [Ans. 1.1873]
NUMERICAL DIFFERENTIATION AND INTEGRATION
331
8. Evaluate using Trapezoidal rule
(i)
0
sin
ttdt
π

(ii)
2
2
52
tdt
t

+

[Ans. (i) 3.14, (ii) –0.747]
9. Use Simpson’s rule dividing the range into ten equal parts to show that

2
1
2
0
log(1 )
1
x
dx
x
+
+

= 0.173.
10. A rocket is launched from the ground. Its acceleration is registered during the first 80 seconds
and is given in the table below. Using simpson’s one-third rule, find the velocity of the rocket
at t = 80 seconds.
()
()
2
sec 0 10 20 30 40 50 60 70 80
cm sec 30 31.63 33.34 35.47 37.75 40.33 43.25 46.69 50.67
t
f
[Ans. 30.87 m/sec.]
11. Find by Weddle’s rule the value of the integral I =
1.6
0.4
sin
x
dx

hx

by taking 12 sub-intervals.
[Ans. 1.0101996]
12. Evaluate
1.4
0.2
(sin log )
x
e
xxedx
−+

approximately using Weddle’s rule correct to four
decimals.
[Ans. 4.051]
13. Evaluate
1/2
2
0
1
dx
x−

using Weddle’s rule. [Ans. 0.52359895]
14. Using
3
8
th


Simpson’s rule. Evaluate
6
4
0
1
dx
x+

.[Ans. 1.019286497]
15. Evaluate
2
1
2
0
2
1
x
x
+
+

dx, using Weddle’s rule correct to four places of decimals. [Ans. 1.7854]
16. Evaluate
1
0
sin cos
xxdx+

correct to two decimal places using seven ordinates. [Ans. 1.14]
17. Evaluate

/2
0
sin
xdx
π

using the Euler-Maclaurin’s formula. [Ans. 1.000003]
18. Prove that
{}
2
3
1
(1)
2
n
nn
x
+
=

applying Euler-Maclaurin’s formula.
19. Find the sum of the fourth powers of the first n natural numbers by means of the Euler-
Maclaurin’s formula.
243
52330
nnn n

++−



Ans.
20. Using Euler-Maclaurin’s formula, sum the following series.
(i) ++++
11 11

400 402 498 505
(ii) ++++
11111
100 101 102 103 104
[Ans. (i) 0.11382114 (ii) 0.0490291]
GGG
+0)26-4 %
Numerical Solution of Ordinary
Differential Equation
7.1 INTRODUCTION
In the fields of Engineering and Science, we come across physical and natural phenomena which,
when represented by mathematical models, happen to be differential equations. For example,
simple harmonic motion, equation of motion, deflection of a beam etc., are represented by differ-
ential equations. Hence, the solution of differential equation is a necessity in such studies. There
are number of differential equations which we studied in Calculus to get closed form solutions. But,
all differential equations do not possess closed form of finite form solutions. Even if they possess
closed form solutions, we do not know the method of getting it. In such situations, depending upon
the need of the hour, we go in for numerical solutions of differential equations. In researches,
especially after the advent of computer, the numerical solutions of the differential equations have
become easy for manipulations. Hence, we present below some of the methods of numerical
solutions of the ordinary differential equations. No doubt, such numerical solutions are approxi-
mate solutions. But, in many cases approximate solutions to the required accuracy are quite
sufficient.
7.2 TAYLOR’S METHOD
Consider the differential equation


()
,
dy
fxy
dx
=
(1)
with the initial condition y(x
0
) = y
0
If y(x) is the exact solution of (1) then y(x) can be expanded into a Taylor’s series about the
point x = x
0
as
()
3
2
0
0
000 0 0
()
( ) ( )
2! 3!
xx
xx
yx y x y y y y



′ ′′ ′′′
=+−+++
(2)
where dashed denote diferentiation w.r.t. ‘x’
Differentiating (1) successively w.r.t x, we get

ffdyf f
yfff
xydxxyxy

∂∂ ∂ ∂
∂∂
′′
=+ =+ = +

∂∂ ∂∂∂∂

(3)
332
NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATION
333

()
ff
yy f f
xxyxy

∂∂
∂∂∂
′′′ ′′

==+ +

∂∂∂∂∂


2
222 2
2
22
fff f f f f
fff f
x y xy xy y
xy

∂∂∂ ∂ ∂ ∂ ∂
=+ + + + +

∂ ∂ ∂∂ ∂∂ ∂
∂∂

(4)
and so on.
Putting x = x
0
and y = y
0
in the expressions for
, , yy y
′ ′′ ′′′
and substituting them in

equation (2), we can obtain the solution of (1).
Note: Taylor’s series method has advantages that it is derived in any order and values of y(x) are
easily obtained. However, the method suffers from time consumed in computing higher derivatives.
Example 1. Solve the differential equation

dy
xy
dx
=+
with
(0) 1,y =
x ∈ [0,1]
by Taylor series expansion to obtain y for x = 0.1.
Sol. Here, x
0
= 0, y
0
= 1

(),yxy

=+
0
01 1
y

=+=

(1 ),yy
′′ ′

=+
0
11 2
y
′′
=+=

(0 ),yy
′′′ ′′
=+
0
02 2
y
′′′
=+=
Using Taylor series expansions about x
0
= 0 is given by

()
()
2
3
00 0 0
0
0
( ) ( 0)
2! 3!
x
x

yx y x y y y


′′′′′′
=+− + + +
at x = 0.1

() ()
=+++++
23
4
20.1 20.1
2(0.1)
(0.1) 1 0.1
2! 3! 4!
y
= 1 + 0.1 + 0.1 + 0.000333 + 0.0000083
= 1.11033. Ans.
Example 2. Using Taylor series for y(x), find y(0.1) correct to four decimal places if y(x) satisfies
2
(),(0)1
yx y y

=+− =
where x(0) = 0.
Sol. Here, x
0
= 0, y
0
= 1


2
,
yxy

=−

0
01 1
y

=−=−

12 ,yyy
′′ ′
=−

0
121(1)3
y
′′
=−××− =

2
22
yyyy
′′′ ′′ ′
=− −

0

8
y
′′′
=−

26,yyyyy
′′′′ ′′′ ′ ′′
=− −

0
34
y
′′′′
=
2
28 6,
yyyyyy
′′′′′ ′′′′ ′ ′′′ ′′
=− − −
0
186
y
′′′′′
=−
334
COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES
The Taylor sereis expansion about x
0
= 0 is given by


()
()
()
() () ()
2345
000000
0000

2! 3! 4! 5!
xx x x
yx y x yy y y y y
−− − −
′ ′′ ′′′ ′′′′ ′′′′′
=+− + + + + +
at x = 0.1,
y(0.1) = 1 + 0.1(–1) ++++−+
01
2
3
01
3
01
4
34
01
5
186
23 4 5
.
!

.
!
–8
.
!
.
!

af
af
af
af
af
af
af
af
= 0.91379
= 0.9138. Ans.
Example 3. Using Taylor’s series, find the solution of the differential equation
,xy x y

=−
y(2) = 2
at x = 2.1 correct to five decimal places.
Sol. Here, x
0
= 2, y
0
= 2.
Also,

1,
y
y
x

=−
0
0
y

=

2
,
yy
y
x
x

′′
=− +

0
1
0
42
2
y
′′
=− + =


23
22
,
yyy
y
x
xx
′′ ′
′′′
=− + −
0
3
4
y
′′′
=−

234
366
,
yyyy
y
x
xxx
′′′ ′′ ′
′′′′
=− + − +

0

3
4
y
′′′′
=
Using Taylor series expansion, we obtain

()
()
() ()
23 4
00 0
000 0 0 0
( )
2! 3! 4!
xx xx xx
yx y x x y y y y
−− −
′ ′′ ′′′ ′′′′
=+− + + + +
at
2.1,x=

()
()
()
()() ()
23 4
2.1 2 2.1 2 2.1 2
133

2.1 2 2.1 2 0
2! 2 3! 4 4! 2
y
−− −
 
=+ − + ×+ − +
 
 
= 2.00238. (correct to five decimal places) Ans.
Example 4. Using Taylor’s series Expansion tabulate the solution
4x =
to
4.4x =
in steps of 0.1
of differential equation.
5xy′ + y′′ − 2 = 0
with y(4) = 1
Sol. Differentiating successively the differential equation, we obtain

5520xy y yy
′′ ′ ′
++ =

2
510220
xy yyyy
′′′ ′′ ′′ ′
+++=
515260xy y yy y y
′′′′ ′′′ ′′′ ′ ′′

+++ =

2
5202860
xy y yy y y y
′′′′′ ′′′′ ′′′′ ′ ′′′ ′′
++++=
The values of various derivatives at
0
4, 1
xy==
are
0
0.05,
y

=

0
0.0175,
y
′′
=−

0
.01025,
y
′′′
=


0
.00845,
y
′′′′
=−

0
.008998125.
y
′′′′′
=
NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATION
335
Then by Taylor series, we obtain

()
() () ()
()
()
23 4
1 0.05 4 . 00875 4 .0017083 4 .0003521 4
yx x x x x
=+ −− −+ −+− −
()
5
.00007498 4
x
+−+
Tabulating from
4x =

to
4.4x =
we obtain


(4.3) 1.014256y =
and
(4.4) 1.018701y =
. Ans.
Example 5. Solve the equation
21,yxy

=+
given that
0,y =
at
0,x =
by the use of Taylor series,
taking
0.2h =
and going as far as
4.x=
Sol. The first few derivatives and their values at
0
0,
x =

0
0,
y =

are

21,yxy

=+

0
1
y

=

()
2,yxyy
′′ ′
=+

0
0
y
′′
=

()
2,yxyyy
′′′ ′′ ′ ′
=++

0
4

y
′′′
=

()
2,yxyyyy
′′′′ ′′′ ′′ ′′ ′′
=+++

0
0
y
′′′′
=

()
2,y xy yyyy
′′′′′ ′′′′ ′′′ ′′′ ′′′ ′′′
=++++
0
32
y
′′′′′
=
Now by Taylor’s series, we have
()
()
()
() () ()
−− − −

′ ′′ ′′′ ′′′′ ′′′′′
=+− + + + + +
23 4 5
00 0 0
000 0 0 0 0

2! 3! 4! 5!
xx xx xx xx
yxyxxyyy y y
Substituting the values of
0
y
and its derivatives, we obtain

() ()()()()
()
()
()
()
()
()
345
2
.2 .2 .2
.20.21.204032
3! 4! 5!
y
=+++++
= .2 + .00533 + .00002133
= .20535466

= .21
Now, with
11
.2, .21,
xy==
we compute
()
.4 .y
So, we have

()( )

=+=
1
2 .2 .21 1 1.084
y

()
1
2{.2 1.084 .21} .8536
y
′′
=+=

()
1
2{.2 .8536 2 1.084} 4.67744
y
′′′
=+×=


()
1
2{.2 4.67744 3 .8536} 6.992576
y
′′′′
=+×=

1
2{.2(6.992576) 4 4.67744} 40.21655
y
′′′′′
=+×=
Substituting the values of
1
y
and its derivativies in Taylor series expansion, we obtain

()
()
()
()
23
10 10
1101 1 1

2! 3!
xx xx
yx y x x y y y
−−

′ ′′ ′′′
=+ − + + +

×