Numerical Analysis by Dr. Anita Pal Assistant Professor Department of Mathematics National Institute of Technology Durgapur Durgapur-713209
Numerical Analysis by Dr. Anita Pal Assistant Professor Department of Mathematics National Institute of Technology Durgapur Durgapur-713209
by
Dr. Anita Pal
Assistant Professor
Department of Mathematics
National Institute of Technology Durgapur
Durgapur-713209
email: [email protected]
.
Chapter 1
Numerical Errors
Module No. 3
Different types of finite difference operators are defined, among them forward dif-
ference, backward difference and central difference operators are widely used. In this
section, these operators are discussed.
The third order differences are also defined in similar manner, i.e.
x y ∆ ∆2 ∆3 ∆4
x0 y0
∆y0
x1 y1 ∆ 2 y0
∆y1 ∆ 3 y0
x2 y2 ∆ 2 y1 ∆4 y0
∆y2 ∆ 3 y1
x3 y3 ∆ 2 y2
∆y3
x4 y4
If any entry of the difference table is erroneous, then this error spread over the table
in convex manner.
The propagation of error in a difference table is illustrated in Table 3.2. Let us
assumed that y3 be erroneous and the amount of the error be ε.
Following observations are noted from Table 3.2.
2
......................................................................................
x y ∆y ∆2 y ∆3 y ∆4 y ∆5 y
x0 y0
∆y0
x1 y1 ∆2 y0
∆y1 ∆3 y0 + ε
x2 y2 ∆2 y1 + ε ∆4 y0 − 4ε
∆y2 + ε ∆3 y1 − 3ε ∆5 y0 + 10ε
x3 y3 + ε ∆2 y2 − 2ε ∆4 y1 + 6ε
∆y3 − ε ∆3 y2 + 3ε ∆5 y1 − 10ε
x4 y4 ∆2 y3 + ε ∆4 y2 − 4ε
∆y4 ∆3 y3 − ε
x5 y5 ∆2 y4
∆y5
x6 y6
(ii) The error is maximum (in magnitude) along the horizontal line through the erro-
neous tabulated value.
(iii) In the kth difference column, the coefficients of errors are the binomial coefficients
in the expansion of (1 − x)k . In particular, the errors in the second difference
column are ε, −2ε, ε, in the third difference column these are ε, −3ε, 3ε, −ε, and
so on.
If there is any error in a single entry of the table, then we can detect and correct
it from the difference table. The position of the error in an entry can be identified by
performing the following steps.
(i) If at any stage, the differences do not follow a smooth pattern, then there is an
error.
3
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operators in Numerical Analysis
(ii) If the differences of some order (it is generally happens in higher order) becomes
alternating in sign then the middle entry contains an error.
Properties
Example 3.1
4
......................................................................................
f (x) g(x)∆f (x) − f (x)∆g(x)
Example 3.2 ∆ = , g(x) 6= 0.
g(x) g(x + h)g(x)
f (x) f (x + h) f (x)
∆ = −
g(x) g(x + h) g(x)
f (x + h)g(x) − g(x + h)f (x)
=
g(x + h)g(x)
g(x)[f (x + h) − f (x)] − f (x)[g(x + h) − g(x)]
=
g(x + h)g(x)
g(x)∆f (x) − f (x)∆g(x)
= .
g(x + h)g(x)
In particular,
These are called the first order backward differences. The second order differences
are denoted by ∇2 y2 , ∇2 y3 , . . . , ∇2 yn . First two second order backward differences are
∇2 y2 = ∇(∇y2 ) = ∇(y2 − y1 ) = ∇y2 − ∇y1 = (y2 − y1 ) − (y1 − y0 ) = y2 − 2y1 + y0 , and
∇2 y3 = y3 − 2y2 + y1 , ∇2 y4 = y4 − 2y3 + y2 .
The other second order differences can be obtained in similar manner.
5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operators in Numerical Analysis
In general,
where ∇0 yi = yi , ∇1 yi = ∇yi .
Like forward differences, these backward differences can be written in a tabular form,
called backward difference or horizontal difference table.
All backward difference table for the arguments x0 , x1 , . . . , x4 are shown in Table 3.3.
x y ∇ ∇2 ∇3 ∇4
x0 y0
x1 y1 ∇y1
x2 y2 ∇y2 ∇ 2 y2
x3 y3 ∇y3 ∇ 2 y3 ∇ 3 y3
x4 y4 ∇y4 ∇ 2 y4 ∇ 3 y4 ∇4 y4
It is observed from the forward and backward difference tables that for a given table
of values both the tables are same. Practically, there are no differences among the values
of the tables, but, theoretically they have separate significant.
There is another kind of finite difference operator known as central difference operator.
This operator is denoted by δ and is defined by
In general,
x y δ δ2 δ3 δ4
x0 y0
δy1/2
x1 y1 δ 2 y1
δy3/2 δ 3 y3/2
x2 y2 δ 2 y2 δ 4 y2
δy5/2 δ 3 y5/2
x3 y3 δ 2 y3
δy7/2
x4 y4
It may be observed that all odd (even) order differences have fraction suffices (integral
suffices).
Shift operator, E:
Note that shift operator increases subscript of y by one. When the shift operator is
applied twice on the function f (x), then the subscript of y is increased by 2.
7
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operators in Numerical Analysis
That is,
In general,
The inverse shift operator can also be find in similar manner. It is denoted by E −1
and is defined by
Similarly, second and higher order inverse operators are defined as follows:
Properties
Average operator, µ:
Differential operator, D:
The differential operator is well known from differential calculus and it is denoted by
D. This operator gives the derivative. That is,
d
Df (x) = f (x) = f 0 (x) (3.19)
dx
d2
D2 f (x) = 2 f (x) = f 00 (x) (3.20)
dx
······ ···············
dn
Dn f (x) = n f (x) = f n (x). (3.21)
dx
9
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operators in Numerical Analysis
The factorial notation is a very useful notation in calculus of finite difference. Using
this notation one can find all order differences by the rules used in differential calculus.
It is also very useful and simple notation to find anti-differences. The nth factorial of x
is denoted by x(n) and is defined by
Note that this property is analogous to the differential formula D(xn ) = nxn−1 when
h = 1.
The above formula can also be used to find anti-difference (like integration in integral
calculus), as
1 (n)
∆−1 x(n−1) = x . (3.24)
nh
10
......................................................................................
Lot of useful and interesting results can be derived among the operators discussed
above. First of all, we determine the relation between forward and backward difference
operators.
etc.
In general,
∆n yi = ∇n yi+n , i = 0, 1, 2, . . . . (3.25)
From this relation one can conclude that the operators ∆ and E − 1 are equivalent.
That is,
∆≡E−1 or E ≡ ∆ + 1. (3.26)
That is,
∇ ≡ 1 − E −1 . (3.27)
The expression for higher order forward differences in terms of function values can
be derived as per following way:
δf (x) = f (x + h/2) − f (x − h/2) = E 1/2 f (x) − E −1/2 f (x) = (E 1/2 − E −1/2 )f (x).
That is,
11
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operators in Numerical Analysis
1 1/2 2
µ2 f (x) = E + E −1/2 f (x)
4
1 1
= (E 1/2 − E −1/2 )2 + 4 f (x) = δ 2 + 4 f (x).
4 4
Hence,
r
1
1 + δ2.
µ≡ (3.30)
4
Every operator defined earlier can be expressed in terms of other operator(s). Few
more relations among the operators ∆, ∇, E and δ are deduced in the following.
∆ ≡ ∇E ≡ δE 1/2 . (3.31)
There is a very nice relation among the operators E and D, deduced below.
h2 00 h3
Ef (x) = f (x + h) = f (x) + hf 0 (x) + f (x) + f 000 (x) + · · ·
2! 3!
[by Taylor’s series]
h2 h3
= f (x) + hDf (x) + D2 f (x) + D3 f (x) + · · ·
2! 3!
h2 2 h3 3
= 1 + hD + D + D + · · · f (x)
2! 3!
= ehD f (x).
12
......................................................................................
Hence,
E ≡ ehD . (3.32)
Some of the operators are commutative with other operators. For example, µ and E
are commutative, as
1
µEf (x) = µf (x + h) = f (x + 3h/2) + f (x + h/2) ,
2
and
h1 i 1
Eµf (x) = E f (x + h/2) + f (x − h/2) = f (x + 3h/2) + f (x + h/2) .
2 2
Hence,
µE ≡ Eµ. (3.38)
13
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operators in Numerical Analysis
(1 + ∆)(1 − ∇) ≡ 1. (3.39)
(ii)
1 1
µf (x) = [E 1/2 + E −1/2 ]f (x) = ehD/2 + e−hD/2 f (x)
2 2
hD
= cosh f (x).
2
(iii)
∆+∇ 1
f (x) = [∆f (x) + ∇f (x)]
2 2
1
= [f (x + h) − f (x) + f (x) − f (x − h)]
2
1 1
= [f (x + h) − f (x − h)] = [E − E −1 ]f (x)
2 2
= µδf (x) (as in previous case).
Thus,
∆+∇
µδ ≡ . (3.40)
2
14
......................................................................................
Hence,
∆∇ ≡ ∇∆ ≡ (E 1/2 − E −1/2 )2 ≡ δ 2 . (3.41)
(v)
∆E −1 ∆
1
+ f (x) = [∆f (x − h) + ∆f (x)]
2 2 2
1
= [f (x) − f (x − h) + f (x + h) − f (x)]
2
1 1
= [f (x + h) − f (x − h)] = [E − E −1 ]f (x)
2 2
1 1/2
= (E + E −1/2 )(E 1/2 − E −1/2 )f (x)
2
= µδf (x).
Hence
∆E −1 ∆
+ ≡ µδ. (3.42)
2 2
δ 1 1/2 −1/2 1 1/2 −1/2
(vi) µ + f (x) = [E + E ] + [E − E ] f (x) = E 1/2 f (x).
2 2 2
Thus
δ
E 1/2 ≡ µ + . (3.43)
2
(vii) δµf (x) = 12 (E 1/2 + E −1/2 )(E 1/2 − E −1/2 )f (x) = 12 [E − E −1 ]f (x).
Therefore,
1
(1 + δ 2 µ2 )f (x) = 1 + (E − E −1 )2 f (x)
4
1 1
= 1 + (E 2 − 2 + E −2 ) f (x) = (E + E −1 )2 f (x)
4 4
2
δ2 2
1 1/2 −1/2 2
= 1 + (E − E ) f (x) = 1 + f (x).
2 2
15
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operators in Numerical Analysis
Hence 2
δ2
1 + δ 2 µ2 ≡ 1+ . (3.44)
2
(viii) r
δ2 δ2
+δ 1+ f (x)
2 4
r
1 1/2 −1/2 2 1/2 −1/2 1 1/2 −1/2 2
= (E − E ) f (x) + (E − E ) 1 + (E − E ) f (x)
2 4
1 1
= [E + E −1 − 2]f (x) + (E 1/2 − E −1/2 )(E 1/2 + E −1/2 )f (x)
2 2
1 1
= [E + E − 2]f (x) + (E − E −1 )f (x)
−1
2 2
= (E − 1)f (x).
Hence, δ2
r
δ2
+δ 1+ ≡ E − 1 ≡ ∆. (3.45)
2 4
In Table 3.5, it is shown that any operator can be expressed with the help of another
operator.
E ∆ ∇ δ hD
r
δ2 δ2
E E ∆+1 (1 − ∇)−1 1+
+ δ 1+ ehD
2 r 4
δ2 δ2
∆ E−1 ∆ (1 − ∇)−1 − 1 +δ 1+ ehD − 1
2 r 4
δ2 δ2
∇ 1 − E −1 1 − (1 + ∆)−1 ∇ − +δ 1+ 1 − e−hD
2 4
δ E 1/2−E −1/2 ∆(1 + ∆)−1/2 ∇(1 − ∇)−1/2 δ 2 sinh(hD/2)
E 1/2+E −1/2 δ 2
µ (1 + ∆/2) (1−∇/2)(1−∇)−1/2 1+ cosh(hD/2)
2 4
×(1 + ∆)−1/2
hD log E log(1 + ∆) − log(1 − ∇) 2 sinh−1 (δ/2) hD
x(0) = 1
x(1) = x
x(2) = x(x − h) (3.46)
x(3) = x(x − h)(x − 2h)
x(4) = x(x − h)(x − 2h)(x − 3h)
and so on.
From these equations it is obvious that the base terms (x, x2 , x3 , . . .) of a polynomial
can be expressed in terms of factorial notations x(1) , x(2) , x(3) , . . ., as shown below.
1 = x(0)
x = x(1)
(3.47)
x2 = x(2) + hx(1)
x3 = x(3) + 3hx(2) + h2 x(1)
x4 = x(4) + 6hx(3) + 7h2 x(2) + h3 x(1)
17
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operators in Numerical Analysis
and so on.
Note that the degree of xk (for any k = 1, 2, 3, . . .) remains unchanged while expressed
it in factorial notation. This observation leads to the following lemma.
Lemma 3.1 Any polynomial f (x) in x can be expressed in factorial notation with same
degree.
Since all the base terms of a polynomial are expressed in terms of factorial notation,
every polynomial can be written with the help of factorial notation. Once a polynomial
is expressed in a factorial notation, then its differences can be determined by using the
formula like differential calculus.
Example 3.4 Express f (x) = 10x4 − 41x3 + 4x2 + 3x + 7 in factorial notation and
find its first and second differences.
Solution. For simplicity, we assume that h = 1.
Now by (3.47), x = x(1) , x2 = x(2) + x(1) , x3 = x(3) + 3x(2) + x(1) ,
x4 = x(4) + 6x(3) + 7x(2) + x(1) .
Substituting these values to the function f (x) and we obtained
f (x) = 10 x(4) + 6x(3) + 7x(2) + x(1) − 41 x(3) + 3x(2) + x(1) + 4 x(2) + x(1) + 3x(1) + 7
Now, the relation ∆x(n) = nx(n−1) (Property 3.1) is used to find the first and second
order differences. Therefore,
∆f (x) = 10.4x(3) + 19.3x(2) − 49.2x(1) − 24.1x(0) = 40x(3) + 57x(2) − 98x(1) − 24
= 40x(x − 1)(x − 2) + 57x(x − 1) − 98x − 24 = 40x3 − 63x2 − 75x − 24
and ∆2 f (x) = 120x(2) + 114x(1) − 98 = 120x(x − 1) + 114x − 98 = 120x2 − 6x − 98.
The above process to convert a polynomial in a factorial notation is a very labourious
task when the degree of the polynomial is large. There is a systematic method, similar to
Maclaurin’s formula in differential calculus, is used to convert a polynomial in factorial
notation. This technique is also useful for a function which satisfies the Maclaurin’s
theorem for infinite series.
Let f (x) be a polynomial in x of degree n. We assumed that in factorial notation
f (x) is of the following form
Solution. Let h = 1. For the given function, f (0) = 11, f (1) = 17, f (2) = 203, f (3) =
1091, f (4) = 3563.
19
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Operators in Numerical Analysis
Therefore,
By similar way,
22