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

A textbook of Computer Based Numerical and Statiscal Techniques part 26 ppsx

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 (114.59 KB, 10 trang )

236
COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES
10. If f(x) =
1
ax−
show that
f(x
0
, x
1
, x
2
, x
3
, x
n
) =
()()()
01
1

n
ax ax ax
−− −
and f(x
0
, x
1
, x
2
, x


3
, x
n
,

x)
=
()()()()
01
1

n
ax ax ax ax
−− −−
11. Certain corresponding values of x and log
10
x are given as
10
: 300 304 305 307
log : 2.4771 2.4829 2.4843 2.4871
x
x
Find the log
10
301 by Lagrange’s formula. [Ans. 2.4786]
12. The following table gives the normal weights of babies during the first 12 months of life:
Age in Months :02581012
Weight in lbs : 7.5 10.25 15 16 18 21
Find the weight of babies during 5 to 5.6 months of life. [Ans. 15.67]
13. Find the value of tan 33° by Lagrange’s formula if tan 30° = 0.5774, tan 32° = 0.6249, tan

35° = 0.7002, tan 38° = 0.7813. [Ans. 0.64942084]
14. Apply Lagrange’s formula to find f(5) and f(6) given that f(2) = 4, f(1) = 2, f(3) = 8, f(7) =
128. Explain why the result differs from those obtained by completing the series of powers
of 2? [Ans. 38.8, 74; 2
x
is not a polynomial]
5.3 ERRORS IN POLYNOMIAL INTERPOLATION
Let the function y(x), defined by the (n + 1) points (x
i
, y
i
)i = 0, 1, 2, n be continuous and
differentiable (n + 1) times, and let y(x) be approximated by a polynomial
n
φ (x) of degree not
exceeding n such that
n
φ (x
i
)= yi, i = 1, 2, n. (1)
Now use
n
φ (x) to obtain approximate value of y(x) at some points other than those defined
by (1). Since the expression y(x)–
n
φ (x) vanishes for x = x
0
, x
1
, x

n
, we put
y(x) –
n
φ (x)= L
π
n+1
(x) (2)
where
π
n+1
(x) = (x – x
0
) (x – x
1
) (x – x
n
) (3)
and L is to be determined such that equation (2) holds for any intermediate value of x, say
x = x’, x
0
< x’ < x
n
clearly,
L =
() ()
()
1
n
n

yx x
x
+
′′
−φ

π
(4)
We construct a function F(x) such that
F(x)= y(x) –
()
n
x
φ
– L.
()
1n
x
+
π
(5)
INTERPOLATION WITH UNEQUAL INTERVAL
237
where L is given by (4).
It is clear that
F(x
0
) = F(x
1
) = F(x

n
) = F(x’) = 0
that is F(x) vanished (n + 2) times in the interval x
0
≤ x ≤ x
n
; consequently, by the repeated
application of Rolle’s theorem, F
|
(x) must vanish (n + 1) times, F
||
(x) must vanish n times, etc.,
in the interval x
0
< x < x
n
;. In particular, F
(n + 1)
(x) must vanish once in the interval. Let this point
be given by x =
ξ
, x
0
<
ξ
< x
n
. On differentiating (5) (n + 1) times with respect to x and putting
x =
ξ

, we obtain
0= y
(n + 1)
(
ξ
) – L. (n + 1)!
so that L =
()
()
()
1
1!
n
y
n
+
ξ
+
(6)
On comparison of (4) and (6), we get
y(x’) –
n
φ (x’) =
()
()
()
1
1!
n
y

n
+
ξ
+
π
n + 1
(x’)
Dropping the prime on x′, we obtain
y (x) –
n
φ (x)=
()
()
1
1!
n
x
n
+
π
+
y
(n + 1)
(
ξ
), x
0
<
ξ
< x

n
(7)
Which is the required Expression for error.
5.3.1 Error in Lagrange’s interpolation formula
To estimate the error of Lagrange’s interpolation formula for the class of functions which have
continuous derivatives of order upto (n + 1) on [a, b] we use above equation 7 (Art. 5.3).
Therefore we have,
y (x) – L
n
(x)= R
n
(x) =
()
()
1
1!
n
x
n
+
π
+
y
(n + 1)
(
ξ
), a <
ξ
< b
and the quantity E

L
where
E
L
=
[]
,
max
ab
|R
n
(x)|
may be taken as an estimate of error. Further, if we assume that
()
()
1n
y
+
ξ

M
n

+ 1
, a

ξ

b
then E

L


()
1
1!
n
M
n
+
+
[]
,
max
ab

()
1n
x
+
π
Example 1. Find the Value of Sin
16
π



from the data given using by Lagrange’s interpolation
formula. Hence estimate the error in the solution.
:0 4 /2

sin : 0 0.70711 1.0
x
yx
ππ
=
238
COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES
Sol. sin
6
π



=
0
662
0
442
πππ
 
−−
 
 
πππ
 
−−
 
 
(0.70711) +
0

664
0
224
πππ
 
−−
 
 
πππ
 
−−
 
 
(1)
=
8
9
(0.70711) –
1
9
=
4.65688
9
= 0.51743
Now, y(x) = sin x, y’(x) = cos x, y’’(x) = sin x, y’’’(x) = – cos x,
Hence,
()
y
′′′
ξ

< 1
When x = π/6
()
n
Rx

0
66462
3!
πππππ
 
−− −
 
 
= 0.02392
where agrees with the actual error in problem.
Example 2. Show that the truncation error of quadratic interpolation in an equidistant table is
bounded by
3
h
93
max
f
ξ
′′′
where h is the step size and f is the tabulated function.
Sol. Let x
i –1
, x
i

, x
i + 1
denote three consecutive equispaced points with step size h. The
truncation error of the quadratic Lagrange interpolation is bounded by
()
2
;
Efx



3
6
M
max
()()()
11iii
xx xx xx
−+
−−−
where x
i – 1

x

x
i + 1
and M
3
=

()
11
max
x
fx
−≤ ≤
′′′
Substitute t =
i
xx
h

then,
x – x
i – 1
= x – (x
i
– h)= x – x
i
+ h = th + h = (t + 1) h
x – x
i + 1
= x – (x
i
+ h)= x – x
i
– h = th – h = (t – 1) h
and (x – x
i – 1
) (x – x

i
) (x – x
i + 1
)= (t + 1) t(t – 1)h
3
= t(t
2
– 1) h
3
= g(t)
Setting g′(t) = 0, we get
3t
2
– 1 = 0

t =
±
1
3
For both these values of t, we obtain
max
()
()( )
11iii
xx xx xx
−+
−−−
= h
3


11
max
t−≤≤
t
2
(1)
t −
=
3
2
33
h
Hence, the truncation error of the quadratic interpolation is bounded by
()
3
23
;
93
h
Efx M

()
()
3
2
;max
93
h
Efx f
′′′

≤ξ
INTERPOLATION WITH UNEQUAL INTERVAL
239
Example 3. Determine the step size that can be used in the tabulation of f(x) = sin x in the interval
0,
4
π



at equally spaced nodal points so that the truncation error of the quadratic interpolation is less than
5
×
10
–8
.
Sol. From Example 2, we know
()
3
23
;
93
h
Efx M

For f(x) = sin x, we get f’’’ (x) = – cos x and M
3
=
0/4
max cos

x
x
≤≤π
= 1
Hence the step size h is given by
3
8
5 10 0.009
93
h
or h

≤× =
5.3.2 Inverse Interpolation
We know different formulae for obtaining y corresponding to argument value of x (for equal and
unequal spaced argument). On the other hand the process of Estimating the value of x for a entry
value of y (which is not in the table) is called Inverse Interpolation. In this case when the
values of x are unequally spaced, we use Lagrange’s method and when x are equally spaced, then
Iterative method should be employed.
(a) Lagranges method for inverse interpolation: The only difference of this formula
from Lagrange’s method is that x is assumed to be expressible as a polynomial in y. So on
interchanging x and y in the Lagrange’s formula we have,
x =
()()()
()()()
()()()
()()()
12 02
01
0102 0 1012 1



nn
nn
yy yy yy yy yy yy
xx
yyyy yy yyyy yy
−− − −− −
++
−− − −− −

+
()()
()
()()( )
01 1
01 1


n
n
nn nn
yy yy yy
x
yyyy yy


−− −
−− −
Which is the inverse interpolation formula.

(b) Iterative method: Newton’s forward interpolation formula is
y
u
= y
0
+ u

y
0
+
() ()()
23
00
112

2! 3!
uu uu u
yy
−−−
∆+ ∆+
From this
u =
() ()()
23
00 0
0
112
1

2! 3!

u
uu uu u
yy y y
y
−−−
−− ∆− ∆−



(1)
On neglecting the second and higher order differences, we get first approximation to u as
u
1
=
0
0
u
yy
y


(2)
240
COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES
To find second approximation, retaining the term with second difference in (1) and replace
u by u
1
, we get
u
2

=
0
1
y


()
11
2
00
1
2!
u
uu
yy y


−− ∆


Similarly, u
3
=
0
1
y


() ()()
22 22 2

23
00 0
112
2! 3!
u
uu uu u
yy y y
−−−
−− ∆ − ∆


This process is continued till two successive approximations of u agree with desired accuracy.
This technique can equally be also applied by starting with any other interpolation formula. This
method is a powerful iterative procedure for finding the roots of an equation to a good degree.
Example 4. Using Inverse interpolation find the real root of the equation x
3
+ x – 3 which is closed
to 1.2.
Sol.
234
21 1
0.431
1 1.1 0.569 0.066
0.497 0.006
0 1.2 0.072 0.072 0
0.569 0.006
1 1.3 0.497 0.078
0.647
2 1.4 1.144
xy y y yy∆∆ ∆∆

−−
−−

Let the origin be at 1.2. Using Stirling’s formula
y = y
0
+ u
()()
33
2
01
2
12
1
11
22 6 2
y
y
uuu
yy
u
y

−−

∆+∆

+−

∆+∆

+∆ +





we have, 0 = – 0.072 + u
()
2
2
1
0. 569 0.497 0.006 0.006
(0.072)
22 6 2
uu
u

++
 
++
 
 
or 0 = – 0.072 + 0.533u + 0.036u
2
+ u (u
2
– 1) (0.001)
or 0 = – 0.072 + 0.532u + 0.036u
2
+ 0.00lu

3
(1)
From equation (1)
u = 0.1353 – 0.0675u
2
– 0.0019u
3
(2)
Neglecting all terms beyond the R.H.S of (2), we get
u
(1)
= 0.1353
INTERPOLATION WITH UNEQUAL INTERVAL
241
Substitute u
(1)
for u in (2), we get second approximation
u
(2)
= 0.1341
u
(1)
and u
(2)
are nearly equal up to third decimal place so the required root is
x = uh + x
0
= 1.2 + 0.1
×
0.134. Since u =

0
xx
h

= 1.2134
Example 5. Values of elliptic integral F(
θ
) =

2
0
d
2
1cos
θ
θ
θ
+

are given below:
()
:212325
: 0.3706 0.4068 0.4433F
θ°°°
θ
Find
θ
for which F(
θ
) = 0.3887.

Sol. By inverse interpolation formula
θ
=
()()
()()
()()
()()
()()
()()
12 02 01
012
0102 1012 2021
FF FF FF FF FF FF
FFFF FFFF FFFF
−− −− −−
θ+ θ+ θ
−− −− −−
=
()( )
()()
()
0.3887 0.4068 0. 3887 0.4433
0.3706
0.3706 0.4068 0.3706 0.4433
−−
−−
+ +
= 7.884 + 17.20 – 3.087 = 22°
Example 6. From the given table
()

:20 25 3035
: 0.342 0.423 0.5 0.65
x
yx
Find the value of x for y(x) = 0.390.
Sol. By inverse interpolation formula,
x =
()()()
()()()
()()()
()()()
123 023
0
010203 101213
yy yy yy yy yy yy
x
yyyyyy yyyyyy
−−− −−−
+
−−− −−−
x
1
+
()()()
()()()
()()()
()()()
013 012
23
202123 303132

yy yy yy yy yy yy
xx
yyyyyy yyyyyy
−−− −−−
+
−−− −−−
=
()()()
()()()
()
()()()
()()()
()
.39 .423 .39 .5 .39 .65 .39 .342 .39 .5 .39 .65
20 25
.342 .423 .342 .5 .342 .65 .423 .342 .423 .5 .423 .65
−−− −−−
+
−−− −−−
+
()()()
()()()
()
()()()
()()()
()
.39 .342 .39 .423 .39 .65 .39 .342 .39 .423 .39 .5
30 35
.5 .342 .5 .423 .5 .65 .65 .342 .65 .423 .65 .5
−−− −−−

+
−−− − − −
= 22.84057797. Ans.
242
COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES
Example 7. Find the value of x correct to one decimal place for which y = 7
Given
x:1 3 4
y:41219
Sol. Here we use Lagrange’s inverse interpolation formula i.e.,
x =
()()
()()
()()
()()
()()
()()
12 02 01
012
0102 1012 2021
yy yy yy yy yy yy
xxx
yyyy yyyy yyyy
−− −− −−
++
−− −− −−
=
()()
()()
()( )

()( )
()( )
()( )
712719 7 4719 7 4712
134
4 12 4 19 12 4 12 19 19 4 19 12
−− −− −−
×+ ×+ ×
−− −− −−
= 0.5 + 1.9286 – 0.5714
x = 1.8572
Example 8. Tabulate y = x
3
for x = 2, 3, 4, 5 and calculate the cube root of 10 correct to three
decimal places.
Sol. For x = 2, y = 8
x = 3, y = 27
x = 4, y = 64
x = 5, y = 125 respectively.
Here h = 1 so form forward difference table
23
28
19
327 18
37 6
464 24
61
5125
xyyyy∆∆ ∆
The first approximation is given by (using Newton’s Forward formula)

u
1
=
0
1
y

(y
u
– y
0
) =
1
19
(10 – 8) = 0.1
The second approximation is
u
2
=
()
1
2
00
0
1
1
2!
u
u
yy y

y


−− ∆




=
()
()
0.1 0.1 1
1
10 8 18
19 2


−−


= 0.15
INTERPOLATION WITH UNEQUAL INTERVAL
243
The third approximation is
u
3
=
() ()()
22 2 2 2
23

00 0
0
112
1
2! 3!
u
uu uu u
yy y y
y
−−−
−− ∆ − ∆




=
1
19

() ()()
0.15 0. 15 1 0.15 0.15 1 0.15 2
10 8 18 6
26
−−−
−− −


= 0.1532
Similarly fourth approximation is
u

4
=
0
1
y

=
() ()() ()()()
33 33 3 33 3 3
23 4
00 0 0
112123
2! 3! 4!
u
uu uu u uu u u
yy y y y
−−−−−−
 
−− ∆ − ∆ − ∆
 
 
 
=
() ()()
0.1532 0.1532 1 0.1532 0.1532 1 0.1532 2
1
10 8 18 6
19 2 6

−−−

−− −


= 0.1541
and fifth approximation is
u
5
= 0.1542
Hence u
4

u
5
(correct to 3 places of decimal)
We have to find cube root of 10. Since 10 lies between the value of y corresponding to x =2
and x = 3, therefore the required value of
3
10
is x = x
0
+ uh
= 2 + 0.1541
×
1
x = 2.154. Ans.
5.3.3 Expression of Function as a Sum of Partial Fractions
Example 9. Let f(x) =
2
32
xx3

x2xx2
+−
−−+
Sol. Consider
φ
(x) = x
2
+ x – 3 and tabulate its values for x = 1, –1, 2, we get
2
112
3133
x
xx

+− − −
Using Lagrange’s formula, we get
f(x)=
()()
()()
()
()()
()()
()
()()
()()
()
12 12 11
133
1112 11 12 2121
xx xx xx

+− −− −+
−+ −+
+− −−−− −+
=
1
2
(x + 1) (x – 2) –
1
2
(x – 1) (x – 2) + (x – 1) (x + 1)

f(x)=
()
()()()
112
x
xxx
φ
−+−
=
()()
111
2121 2xxx
−+
−+−
. Ans.
244
COMPUTER BASED NUMERICAL AND STATISTICAL TECHNIQUES
Example 10. Show that the sum of Lagrangian co-efficients is unity.
Sol. Let

()
x

=
()
()
()
01

n
xx xx xx
−− −
The reciprocal of
()
x



()
()()()
01
11

n
xxxxx xx
=
∏−−−
Let
()()()
01

1

n
xx xx xx
−− −
=
0
12
012

n
n
AAAA
xx xx xx xx
++++
−−− −
=
0
n
i
i
i
A
xx
=


(This can be expressible as partial fractions.)
Now, A
i

=
()()()()()
01 1 1
1

i i ii ii in
xxxx xx xx xx
−+
−− − − −
(1)
is obtained by taking L.C.M. of (1) and setting x = x
i
A
i
can be written as A
i
=
()
()
1
i
at x x
x



=
()
1
x

i


From (1)
()
1
x
Π
=
()
()
0
1
n
ii
i
xxx
=

Π−

Multiply both sides by
()
x

, we get
1=
()
()
()

0
n
ii
i
x
xxx
=


∏−

=
()
0
n
i
i
Lx
=

. Proved.
PROBLEM SET 5.2
1. Given that y
10
= 1754, y
15
= 2648, y
20
= 3564, find the value of x for y = 3000 by using,
iterative method of inverse interpolation. [Ans. 16.935]

2. Given that
:1.82.02.22.42.6
: 2.9 3.6 4.4 5.5 6.7
x
y
Find x when y = 5 using iterative interpolation formula.
3. Using inverse interpolation find the real root of the equation x
3
– 15x + 4 = 0 close to 0.3
correct upto 4 decimal places. [Ans. 0.2679]
4. Find the value of
θ
if f(
θ
) = 0.3887 from the table given below:
()
21 23 25
0.3706 0.4068 0.4433f
θ°°°
θ
[Ans. 22°]
5. Find x when f(x) = 14 for the following data using Lagrange’s inverse interpolation formula.
()
0 5 10 15
16.35 14.88 13.59 12.46
x
fx
[Ans. 8.337]
INTERPOLATION WITH UNEQUAL INTERVAL
245

6. Using Lagrange’s interpolation formula express the function
()()()
2
31
123
xx
xxx
++
−−−
as sums
of partial fractions.
() ()
51531

21 223xx x

−+

−− −


Ans.
7. Express the function
()
()()
2
2
61
146
xx

xxx
++
−−−
as a sum of partial factions using Lagrange’s
interpolation formula.
() ()()()
131371

5 1 35 1 10 4 70 6xxxx

+−+

−+−−


Ans.
8. From the following data find the value of x corresponding to y = 12 using Lagrange’s
technique of inverse interpolation.
: 1.2 2.1 2.8 4.1 4.9 6.2
: 4.2 6.8 9.8 13.4 15.5 19.6
x
y
[Ans. 3.55]
9. Obtain the values of t when A = 85 from the following table using Lagrange’s Method of
inverse interpolation.
:2 5 8 14
: 94.8 87.9 81.3 68.7
t
A
[Ans. 6.5928]

5.4 DIVIDED DIFFERENCE
When the values of the argument are given at unequal spaced interval, then the various differences
will also be affected by the changes in the values of the argument. The differences defined by taking
into consideration the changes in the values of argument are known as divided differences
where as the difference defined earlier are called ordinary differences. Lagrange’s interpolation
formula has the disadvantage that if any other interpolation point were added, the interpolation
co-efficient will have to be recomputed. So an interpolation polynomial, which has the property that
a polynomial of higher degree may be derived from it by simply adding new terms, in Newton’s
divided difference formula.
Let (x
0
, y
0
), (x
1
, y
1
), (x
2
, y
2
) (x
n
, y
n
) be given (n + 1) points. Let y
0
, y
1
, y

2
, y
n
be the values
of the function corresponding to the values of argument x
0
, x
1
, x
2
, x
n
which are not equally spaced.
Since the difference of the function values with respect to the difference of the arguments are called
divided differences, so the first divided difference for the arguments x
0
, x
1
, is given by
f(x
0
, x
1
) =
1
x

y
1
= [x

0
, x
1
] =
10
10
yy
xx


Similarly f(x
1
, x
2
) =
2
x

y
1
= [x
1
, x
2
] =
21
21
yy
xx



and so on.

×