Professional Documents
Culture Documents
Numerical Differentiation: First Derivatives and Second Order Derivatives, Richardson Extrapolation, Numerical Integration
Numerical Differentiation: First Derivatives and Second Order Derivatives, Richardson Extrapolation, Numerical Integration
1
1.2 Quadratic interpolation
For quadratic interpolation, we have
(x − x1 )(x − x2 ) (x − x0 )(x − x2 )
P2 (x) = f (x0 ) + f (x1 )+
(x0 − x1 )(x0 − x2 ) (x1 − x0 )(x1 − x2 )
(x − x0 )(x − x1 )
f (x2 ); i = 1, 2, ..., n
(x2 − x0 )(x2 − x1 )
Differentiate w.r.t. ”x” we have
2x− x1 − x2 2x − x0 − x2
f ′ (x) = P2′ (x) = f0 + f1 +
(x0 − x1 )(x0 − x2 ) (x1 − x0 )(x1 − x2 )
2x − x0 − x1
f2 (2)
(x2 − x0 )(x2 − x1 )
which is same ∀x ∈ [x0 , x2 ] with the error at the tabular point x0 is written
as
1 1
E ′′ (x0 ) = (2x0 − x1 − x2 )f ′′′ (ξ) + (x0 − x1 )(x0 − x2 )[f iv (η1 ) + f iv (η2 )]
3 24
where x, η1 , η2 ∈ (x0 , x2 )
1
E2′′ (x1 ) = f ′′ (x1 ) − [f (x0 ) − 2f (x1 ) + f (x2 )]
h2
h2 iv
= − f (ξ2 ), x0 < ξ2 < x1
12
1
E2′′ (x2 ) = f ′′ (x2 ) − [f (x0 ) − 2f (x1 ) + f (x2 )]
h2
= hf ′′′ (ξ3), x0 < ξ3 < x1
Ef (x) = f (x + h)
= f (x) + hf ′ (x) + h2 /2!f ′′ (x) + h3 /3!f ′′′ (x) + · · ·
h2 D 2 h3 D 3
= 1 + hD + + + · · · f (x)
2! 3!
= ehD f (x)
⇒ E = ehD where the differential operator D = d/dx
⇒ hD = log E = log(1 + ∆) = ∆ − 1/2∆2 + 1/3∆3 · · ·
= log E = − log(1 − ▽) = ▽ + 1/2▽2 + 1/3▽3 + · · ·
and
δ = (E 1/2 − E −1/2 ) = (ehD/2 − e−hD/2 ) = 2 sinh(hD/2)
δ 1
⇒ hD = 2 sinh −1
= δ − 2 δ3 + · · ·
2 2 3!
1 1 2 1 3
h
∆f k − 2
∆ f k + 3
∆ − · · ·
1 1 2 1 3
′
f (xk ) = h n k 2▽f + ▽ fk + 3
▽ fok · · ·
δfk − 122 δ 3 fk + · · ·
1
h 2 3!
4
Similarly for second derivatives
1 2 3 11 4
h2 ∆ fk − ∆ fk + 12 ∆ − · ·
·
f ′′ (xk ) = h12 ▽2 fk + ▽3 fk + 11
12
▽4 fk · · ·
1 2 1 4 1 6
δ fk − 12 δ fk + 90 δ fk − · · ·
h2
Please solve the above example using these formulae also construct the
table as given in previous notes.
3 Extrapolation Methods
By this method we combines the computed values obtained by using a certain
method with different step sizes.
Let g(h) denotes the approximate value of g, obtained by using a method
of order p, with step size h and g(qh) denote the value of g obtained by using
the same method of order p, with step size qh. We have
g(qh) = g + cq p hp + O(hp+1)
Eliminating c from the above equations, we get
q p g(h) − g(qh)
g= + O(hp+1)
qp − 1
Thus we obtain
q p g(h) − g(qh)
g (1) (h) = = g + O(hp+1) (3)
qp − 1
which is of order p + 1. This technique of combining two computed values
obtained by using the same method with two different step sizes, to obtain a
higher order method is called the Extrapolation method or Richardson’s
extrapolation.
To illustrate this procedure we consider the method
f1 − f−1 f (x0 + h) − f (x0 − h)
f ′ (x0 ) = = using Taylor series we have (4)
2h 2h
f ′′′ (x0 ) 2 f v (x0 ) 4 f vii (x0 ) 6
= f ′ (x0 ) + h + h + h +···
3! 5! 7!
5
The local truncation error is obtained as
f (x0 + h) − f (x0 − h)
E ′ (x0 ) = f ′ (x0 ) −
2h
v vii
f (x0 ) 2 f (x0 ) 4 f (x0 ) 6
′′′
=− h − h − h −···
3! 5! 7!
′′′ (x v (x vii (x
Now taking c1 = − f 3!
0)
, c2 = − f 5!
0)
, c3 = − f 7!
0)
,···
therefore
E ′ (x0 ) = c1 h2 + c2 h4 + c3 h6 + · · ·
Let g(x) = f ′ (x0 ) be the quantity which is to be obtained and g(h/2r ) denote
the approximate value of g(x) obtained by using (4) with the step length
h/2r , r = 0, 1, 2, 3, .... Thus we have
g(h) = g(x) + c1 h2 + c2 h4 + c3 h6 + · · ·
h c1 h2 c2 h4 c3 h6
g( ) = g(x) + + + +··· (5)
2 4 16 64
h c1 h2 c2 h4 c3 h6
g( 2 ) = g(x) + + + +···
2 16 256 4096
Eliminating c1 from the above equation we obtain
4g(h/2) − g(h)
g (1) (h) =
3
c2 h4 5c3 h6
= g(x) − − −···
4 16
4g(h/22) − g(h/2)
g (1) (h/2) =
3
c2 h4 5c3 h6
= g(x) − − −··· (6)
64 1024
Thus g (1) (h), g (1) (h/2), · · · given by (6) are O(h4 ) approximations to g(x),
Eliminating c2 from (6), we have
6
Table 1: Extrapolation Table
Order Second Fourth Sixth Eighth
h g(h)
4g(h/2)−g(h)
h/2 g(h/2) g (1) (h) = 3
4g(h/22 )−g(h/2) 42 g (1) (h/2)−g (1) (h)
h/22 g(h/22) g (1) (h/2) = 3
g (2) (h) = 42 −1
4g(h/23 )−g(h/22 ) 42 g (1) (h/22 )−g (1) (h/2)
h/23 g(h/23) g (1) (h/22 ) = 3
g (2) (h/2) = 42 −1
g (3) (h) =
43 g (2) (h/2)−g (2) (h)
43 −1
Thus the successive higher order results can be obtained from the formula
Z b
f (x)dx = In (f ) Newton-Cotes formula
a
Z b X n
!
= Ln,i (x)f (xi ) dx
a i=0
n
X Z b
= Ln,i (x)dx f (xi )
i=0 a
Xn
= wi f (xi )
i=0
7
Rb Pn
where wi = a
Ln,i (x)dx and i=0 Ln,i (x)f (xi ) is Lagrange Polynomial where
b b
x−b b−a
Z Z
w0 = L1,0 (x)dx = dx =
a a a−b 2
and
b b
x−a b−a
Z Z
w1 = L1,1 (x)dx = dx =
a a b−a 2
Z b
f (x)dx = w0 f (x0 ) + w1 f (x1 )
a
b
b−a b−a b−a
Z
f (x)dx = f (a) + f (b) = [f (a) + f (b)]
a 2 2 2
Z b
b−a
f (x)dx = [f (a) + f (b)]
a 2
Composite Trapezoid rule: Interval [a, b] is divided into n sub-intervals
such as [a = x0 , x1 ], [x1 , x2 ], [x2 , x3 ] · · · [xn−1 , xn = b]. All sub-intervals are
equal distance h = b−a n
Z b Z x1 Z x2 Z xn
f (x)dx = f (x)dx + f (x)dx + · · · + f (x)dx
a x0 x1 xn−1
h
[(f (x0 ) + f (x1 )) + (f (x1 ) + f (x2 )) + (f (x2 ) + f (x3 )) + · · · + (f (xn−1 ) + f (xn ))]
2
Z b
h
f (x)dx = [f (a) + 2(f (x1 ) + f (x2 ) + f (x3 ) · · · + f (xn−1 )) + f (b)]
a 2
8
Simpson’s one-three rule: for this method taking n = 2 so that the
intervals contains three nodal points x0 , x1 , x2 are [x0 , x2 ] & h = b−a
2
and
x0 = a, x1 = a + h = (a + b)/2 & x2 = a + 2h = b
Z b
f (x)dx = w0 f (x0 )+w1 f (x1 )+w2 f (x2 ) = w0 f (a)+w1 f ((a+b)/2)+w3 f (b)
a
b b
(x − (a + b)/2)(x − b) (b − a)/2
Z Z
w0 = L2,0 (x)dx = dx =
a a (a − (a + b)/2)(a − b) 3
4 b−a
b b
(x − a)(x − b)
Z Z
2
w1 = L2,1 (x)dx = dx =
a a ((a + b)/2 − a)((a + b)/2 − b) 3
Z b Z b b−a
(x − a)(x − (a + b)/2) 2
w2 = L2,2 (x)dx = dx =
a a (b − a)(b − (a + b)/2) 3
Z b
f (x)dx = w0 f (x0 ) + w1 f (x1 ) + w2 f (x2 )
a
b−a b−a b−a
4
2 2 b−a 2
= f (a) + f + f (b)
3 3 2 3
b−a
2
= [f (a) + f ((a + b)/2) + f (b)]
3
h a+b
= f (a) + 4f + f (b)
3 2
b
h
Z
f (x)dx = [(f0 + 4f1 + f2 ) + (f2 + 4f3 + f4 ) + · · · + (f2N −2 + 4f2N −1 + f2N )]
a 3
b
h
Z
f (x)dx = [f0 +4(f1 +f3 +f5 +· · ·+f2N −1 )+2(f2 +f4 +f6 +· · ·+f2N −2 )+f2N ]
a 3
9
Simpson’s three-eight rule: for this method taking n = 3 so that the
intervals contains four nodal points x0 , x1 , x2 , x3 are [x0 , x3 ] & h = b−a
3
and
x0 = a, x1 = a + h, x2 = a + 2h & x3 = a + 3h = b i.e. h = x1 − x0 , 2h =
x2 − x0 , 3h = x3 − x0
Z b
f (x)dx = w0 f (x0 ) + w1 f (x1 ) + w2 f (x2 ) + w3 f (x3 )
a
b b
(x − x1 )(x − x2 )(x − x3 )
Z Z
w0 = L3,0 (x)dx = dx
a a (x0 − x1 )(x0 − x2 )(x0 − x3 )
3h
=
8
b b
(x − x0 )(x − x2 )(x − x3 )
Z Z
w1 = L3,1 (x)dx = dx
a a (x1 − x0 )(x1 − x2 )(x1 − x3 )
9h
=
8
b b
(x − x0 )(x − x1 )(x − x3 )
Z Z
w2 = L3,2 (x)dx = dx
a a (x2 − x0 )(x2 − x1 )(x2 − x3 )
9h
=
8
b b
(x − x0 )(x − x1 )(x − x2 )
Z Z
w3 = L3,3 (x)dx = dx
a a (x3 − x0 )(x3 − x1 )(x3 − x2 )
3h
=
8
Z b
f (x)dx = w0 f (x0 ) + w1 f (x1 ) + w2 f (x2 ) + w3 f (x3 )
a
3h 9h 9h 3h
= f (a) + f (a + h) + f (a + 2h) + f (b)
8 8 8 8
3h
= [f (a) + 3f (a + h) + 3f (a + 2h) + f (b)]
8
10
Composite Simpson’s three-eight rule: We need four nodal points for
this method. Interval [a, b] is divided into 2N sub-intervals of equal length.
Sub-intervals are taken as [a = x0 , x3 ], [x3 , x6 ], [x6 , x9 ] · · · [x3N −3 , x3N = b].
All sub-intervals are equal distance h = b−a
3N
.
Z b Z x3 Z x6 Z x9 Z x3N
f (x)dx = f (x)dx +
f (x)dx + f (x)dx + · · · + f (x)dx
a x0 x6 x3 x3N−3
3h 3h
= (f (x0 ) + 3f (x1 ) + 3f (x2 ) + f (x3 )) + (f (x3 ) + 3f (x4 ) + 3f (x5 ) + f (x6 )) +
8 8
3h
···+ (f (x3N −3 ) + 3f (x3N −2 ) + 3f (x3N −1 ) + f (x3N ))
8
b
3h
Z
f (x)dx = [f (x0 ) + 3 {f (x1 ) + f (x4 ) + f (x7 ) + · · · + f (x3N −2 )} +
a 8
3 {f (x2 ) + f (x5 ) + f (x8 ) + · · · + f (x3N −1 )} +
2 {f (x3 ) + f (x6 ) + f (x9 ) + · · · + f (x3N −3 )} + f (x3N )]
where Z b Z b
w0 = L0,0 (x)dx = 1dx = b − a
a a
so that
Z b
f (x)dx = w0 f (x0 ) = (b − a)f (a + h) = 2hf (a + h)
a
11
Two-point rule: Another open Newton-Cotes formula corresponds to
n = 1 interval [a, b] is divided into three sub-intervals and leave the end points
a and b. So that with n = 1, h = b−a 3
and the nodal points are x0 = a + h,
x1 = a + 2h. Z b
f (x)dx = w0 f (x0 ) + w1 f (x1 )
a
where
b b
(x − x1 ) (x − (a + 2h))
Z Z
w0 = dx = dx
a x0 − x1 a (a + h) − (a + 2h)
3
w0 = h
2
and
b b
(x − x0 ) (x − (a + h))
Z Z
w1 = dx = dx
a x1 − x0 a (a + 2h) − (a + h)
3
w1 = h
2
So that
b
3
Z
f (x)dx = h [f (a + h) + f (a + 2h)]
a 2
Three-point rule: Another open Newton-Cotes formula corresponds to
n = 2 interval [a, b] is divided into four sub-intervals and leave the end points
a and b. So that with n = 2, h = b−a 4
and the nodal points are x0 = a + h,
x1 = a + 2h & x2 = a + 3h.
Z b
f (x)dx = w0 f (x0 ) + w1 f (x1 ) + w2 f (x2 )
a
where
b
(x − x1 )(x − x2 )
Z
w0 = dx
a (x0 − x1 )(x0 − x2 )
8
w0 = h
3
b
(x − x0 )(x − x2 )
Z
w1 = dx
a (x1 − x0 )(x1 − x2 )
4
w1 = − h
3
12
b
(x − x0 )(x − x1 )
Z
w2 = dx
a (x2 − x0 )(x2 − x1 )
8
w2 = h
3
Z b
8 4 8
f (x)dx = h f (x0 ) − h f (x1 ) + h f (x2 )
a 3 3 3
Z b
4
f (x)dx = h [2f (a + h) − f (a + 2h) + 2f (a + 3h)]
a 3
Four-point rule: Another open Newton-Cotes formula corresponds to
n = 3 interval [a, b] is divided into five sub-intervals and leave the end points
a and b. So that with n = 3, h = b−a 5
and the nodal points are x0 = a + h,
x1 = a + 2h, x2 = a + 3h & x3 = a + 4h.
Z b
f (x)dx = w0 f (x0 ) + w1 f (x1 ) + w2 f (x2 ) + w3 f (x3 )
a
where
b
(x − x1 )(x − x2 )(x − x3 )
Z
w0 = dx
a (x0 − x1 )(x0 − x2 )(x0 − x3 )
55
w0 = h
24
b
(x − x0 )(x − x2 )(x − x3 )
Z
w1 = dx
a (x1 − x0 )(x1 − x2 )(x1 − x3 )
5
w1 = h
24
b
(x − x0 )(x − x1 )(x − x3 )
Z
w2 = dx
a (x2 − x0 )(x2 − x1 )(x2 − x3 )
5
w2 = h
24
b
(x − x0 )(x − x1 )(x − x2 )
Z
w3 = dx
a (x3 − x0 )(x3 − x1 )(x3 − x2 )
55
w3 = h
24
13
b
55 5 5 55
Z
f (x)dx = h f (x0 ) + h f (x1 ) + h f (x2 ) + + h f (x3 )
a 24 24 24 24
Z b
5
f (x)dx = h [11f (a + h) + f (a + 2h) + f (a + 3h) + 11f (a + 3h)]
a 24
Please you all have to learn formulae of all methods except four-point rule.
Exercise-1: Find approximate value of
Z 1
dx
I=
0 1+x
using (i) trapezoidal rule (ii) Simpson’s one-three rule (iii) Simpson’s three-
rule.
And from above example also solve using composite rules of all methods
taking n = 6.
Also solve above example using open Newton-Cotes formula i.e. using
one-point rule, two-point rule and three-point rule.
In this case, all the nodes xk and weights λk are unknown. Consider the
following cases. One-point formula: n = 0. The formula is given by
Z 1
f (x)dx = λ0 f (x0 ) (11)
−1
14
to evaluate λ0 and x0 we have f (x) = 1 & f (x) = x,
R1
for f (x) = 1, 1dx = 2 = λ0 f (x0 ) = λ0 , ⇒ λ0 = 2
R−1
1
for f (x) = x, −1
xdx = 0 = λ0 f (x0 ) = λ0 x0 , ⇒ x0 = 0
Hence the method is given by
Z 1
f (x)dx = 2f (0) (12)
−1
1
1 1
Z
f (x)dx = f (− √ ) + f ( √ ) (14)
−1 3 3
Three-point formula: n = 2. The formula is given by
Z 1
f (x)dx = λ0 f (x0 ) + λ1 f (x1 ) + +λ2 f (x2 ) (15)
−1
15
After solvingqabove six equations we have λ0 = λ2 = 5/9, λ1 = 8/9 and
x1 = 0, x1 = 35 = −x0 Hence the method is given by
" r r #
1
1 3 3
Z
f (x)dx = f (− ) + 8f (0) + 5f ( ) (16)
−1 9 5 5
Note: Must all the learn formulae and also learn this the transformation
x = b−a
2
t + b+a
2
for the change of limit of given integration.
Exercise: Evaluate the integral
Z 1
dx
I=
0 1+x
using Gauss-Legendre (i) one-point (ii) two-point (iii) three point formula.
The errors in the composite trapezoidal rule IT and the composite Simpson’s
rule IS can be obtained as
I = IT + c1 h2 + c2 h4 + c3 h6 + · · · (18)
I = IS + d1 h4 + d2 h6 + d3 h8 + · · · (19)
where c’s and d’s are constants independent of h. The extrapolation proce-
dure as we have done in (5) for the trapezoidal rule (18) becomes as
(m−1) (m−1)
(m) 4 m IT (h/2) − IT (h)
IT (h) = , m = 1, 2, 3, ... (20)
4m − 1
The extrapolation procedure as we have done in (5) for the trapezoidal
rule (19) becomes as
(m−1) (m−1)
(m) 4m+1 IS (h/2) − IS (h)
IS (h) = , m = 1, 2, 3, ... (21)
4m+1 − 1
16
Exercise: Find the approximate value of the integral
Z 1
dx
I=
0 1+x
using (i) Composite trapezoidal rule with 2,3,5,9 nodes and Romberg inte-
gration,
(ii) Composite Simpson’s rule with 3,5,9 nodes and Romberg integration.
Note: Kindly this example at page no. 391.
17