15MA206-Numerical Methods: S Athithan
15MA206-Numerical Methods: S Athithan
15MA206-Numerical Methods
S
N
A
H
IT
Prepared by
H
AT
S ATHITHAN
Assistant Professor
F
O
Department of of Mathematics
Faculty of Engineering and Technology
S
TE
SRM UNIVERSITY
Kattankulathur-603203, Kancheepuram District.
O
N
E
R
TU
C
LE
SRM UNIVERSITY
2 Numerical Integration 7
2.1 Trapezoidal Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Simpson’s one-third rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Simpson’s three-eighth rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
S
3.1 Illustrative Examples on Numerical Differenciation . . . . . . . . . . . . . . . 8
N
3.2 Illustrative Examples on Numerical Integration . . . . . . . . . . . . . . . . . 9
A
3.3 Trapezoidal Rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
H
3.4 Simpson’s one-third rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
IT
3.5 Simpson’s three-eighth rule . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
H
4 Exercise/Practice/Assignment Problems AT 13
F
O
S
TE
O
N
E
R
TU
C
LE
Page 1 of 13 https://sites.google.com/site/lecturenotesofathithans/home
Numerical Methods S.ATHITHAN
Unit-3
Numerical Differentiation and Integration
T OPICS :
? Introduction to Numerical Differentiation.
? Numerical Differentiation
– Newton’s forward and backward differences formulae to compute first and higher
order derivatives.
– Applications of Newton’s forward and backward differences formulae to compute
S
first and higher order derivatives.
N
? Introduction - Numerical Integration
A
? Numerical Integration
H
– Trapezoidal rule
IT
– Simpson’s one third rule
H
– Simpson’s three eighth rule.
AT
– More problems using Trapezoidal rule, Simpson’s one third rule and Simpson’s
F
Page 2 of 13 https://sites.google.com/site/lecturenotesofathithans/home
Numerical Methods S.ATHITHAN
1 Finite Difference and Differentiation
Forward Difference Operator(∆)
If the given data is of the form given in the table, then we define the forward difference opera-
tors as follows:
x x0 x1 x2 . . . xn−1 xn
y y0 y1 y2 . . . yn−1 yn
Here the values of x are called arguments and the values of y are called entries.
S
∆f (x) = f (x + h) − f (x)
N
∆2 f (x) = ∆f (x + h) − ∆f (x)
A
H
= f (x + 2h) − 2f (x + h) + f (x)
IT
∆ f (x) = ∆2 f (x + h) − ∆2 f (x)
3
H
AT
Backward Difference Operator(∇)
F
O
S
∇f (x) = f (x) − f (x − h)
TE
∇2 f (x) = ∇f (x) − ∇f (x − h)
= f (x) − 2f (x − h) + f (x − 2h)
O
N
E
R
Differential Operator(D)
TU
d
C
Df (x) =
dx
LE
d2
D2 f (x) = f (x)
dx2
Page 3 of 13 https://sites.google.com/site/lecturenotesofathithans/home
Numerical Methods S.ATHITHAN
Forward Difference Table
x y ∆y ∆2 y ∆3 y ∆4 y ∆5 y ∆6 y
x0 y0
∆y0
x1 y1 ∆2 y0
∆y1 ∆3 y0
x2 y2 ∆2 y1 ∆4 y0
3
∆y2 ∆ y1 ∆5 y0
x3 y3 ∆2 y2 ∆4 y1 ∆6 y0
∆y3 ∆3 y2 ∆5 y1
S
2 4
x4 y4 ∆ y3 ∆ y2
3
∆y4 ∆ y3
N
2
x5 y5 ∆ y4
A
∆y5
H
x6 y 6
IT
Note 1.1. The above table is also called diagonal difference table. The value y0 (first value of
y) is called the leading term and the differences ∆y0 = y1 − y0 , ∆2 y0 = ∆y1 − ∆y0 , ∆3 y0 =
H
∆2 y1 − ∆2 y0 , . . . are called the leading differences.
AT
Backward Difference Table
F
O
x y ∇y ∇2 y ∇3 y ∇4 y ∇5 y ∇6 y
S
x0 y0
TE
∇y0
x1 y1 ∇2 y0
O
∇y1 ∇3 y0
N
x2 y2 ∇2 y1 ∇4 y0
3
∇y2 ∇ y1 ∇5 y0
E
x3 y3 ∇2 y2 ∇4 y1 ∇6 y0
R
∇y3 ∇3 y2 ∇5 y1
TU
2 4
x4 y4 ∇ y3 ∇ y2
3
∇y4 ∇ y3
C
2
x5 y5 ∇ y4
LE
∇y5
x6 y 6
Note 1.2. The value y6 (last value of y) is called the leading term and the differences ∇y6 =
y6 − y5 , ∇2 y6 = ∇y6 − ∇y5 , ∇3 y6 = ∇2 y6 − ∇2 y5 , . . . are called the leading differences.
S
Differentiating (1) w.r.to x, we get
N
d2 y
d dy du 1 d dy
A
= = ·
dx2 du dx dx h du dx
H
2
6u2 − 18u + 11 4
dy 1
IT
2 3
= 2 ∆ y0 + (u − 1)∆ y0 + ∆ y0 + . . .
dx2 h 12
H
In the same way we get the third derivative as
AT
d3 y
1 3 (12u − 18) 4
F
= 3 ∆ y0 + ∆ y0 + . . .
dx3 h 12
O
1 1 1 2 1 3 1 4
∴D = log(1 + ∆) = ∆ − ∆ + ∆ − ∆ + ...
h h 2 3 4
O
dy 1 1 2 1 3 1 4
N
= Dy0 = ∆y0 − ∆ y0 + ∆ y0 − ∆ y0 + . . .
dx x=x0 h 2 3 4
E
1 11
D2 = ∆2 − ∆3 + ∆4 + . . .
R
h 2 12
TU
d2 y
2 1 2 3 11 4
= D y0 = 2 ∆ y0 − ∆ y0 + ∆ y0 + . . .
dx2 x=x0 h 12
C
1 3
D3 = ∆3 − ∆4 + . . .
LE
h 3 2
d2 y
3 1 3 3 4
= D y0 = 3 ∆ y0 − ∆ y0 + . . .
dx2 x=x0 h 2
Page 5 of 13 https://sites.google.com/site/lecturenotesofathithans/home
Numerical Methods S.ATHITHAN
x − xn
where y(x) is a polynomial of degree n in x and v = .
h
Differentiating w.r.t. x, we get
dy dy dv 1 dy
= = ·
dx dvdx h dv
3v 2 + 6v + 2 3 4v 3 + 18v 2 + 22v + 6 4
dy 1 2v + 1 2
= ∇yn + ∇ yn + ∇ yn + ∇ yn + . . . (3)
dx h 2 6 24
S
N
Differentiating (3) w.r.to x, we get
A
H
d2 y
d dy dv 1 d dy
= = ·
IT
dx2 dv dx dx h dv dx
2
6v 2 + 18v + 11 4
H
dy 1 2 3
= 2 ∇ yn + (v + 1)∇ yn + ∇ yn + . . .
AT
dx2 h 12
d3 y
1 3 (12v + 18) 4
= 3 ∇ yn + ∇ yn + . . .
dx3
S
h 12
TE
1
Remark 1.4. We know that E = ehD =
1−∇
O
N
1 1 1 2 1 3 1 4
∴D = − log(1 − ∇) = ∇ + ∇ + ∇ + ∇ + ...
h h 2 3 4
E
dy 1 1 2 1 3 1 4
R
= Dyn = ∇yn + ∇ yn + ∇ yn + ∇ yn + . . .
dx h 2 3 4
TU
x=xn
1 11 4
D2 = ∇ 2
+ ∇ 3
+ ∇ + ...
h2 12
C
d2 y
LE
2 1 2 3 11 4
= D yn = 2 ∇ yn + ∇ yn + ∇ yn + . . .
dx2 x=xn h 12
1 3
D3 = 3
∇3 + ∇4 + . . .
h 2
d2 y
3 1 3 3 4
= D yn = 3 ∇ yn + ∇ yn + . . .
dx2 x=xn h 2
Page 6 of 13 https://sites.google.com/site/lecturenotesofathithans/home
Numerical Methods S.ATHITHAN
2 Numerical Integration
Z xn Z x0 +nh
f (x)dx = f (x)dx
x0 x0
h
= [(y0 + yn ) + 2(y1 + y2 + · · · + yn−1 )]
2
h
= [(Sum of the first and the ordinates) + 2(Sum of the remaining ordinates)]
S
2
N
2.2 Simpson’s one-third rule
A
H
IT
Z xn Z x0 +nh
f (x)dx = f (x)dx
H
x0 x0 AT
h
= [(y0 + yn ) + 2(y2 + y4 + . . . ) + 4(y1 + y3 + . . . )]
3
h
F
= [(Sum of the first and the ordinates) + 2(Sum of the remaining odd ordinates)
3
O
Note 2.1. Even though y2 has the suffix 2, it is the third ordinate in the given data as all our
data points we starts from y0 .
O
.
N
E
Z xn Z x0 +nh
f (x)dx = f (x)dx
C
x0 x0
LE
3h
= [(y0 + yn ) + 3(y1 + y2 + · · · + yn−1 ) + 2(y3 + y6 + y9 + · · · + yn )]
8
Note 2.2. Simpson’s three-eighth rule is applicable only when ‘n’ is multiple of 3.
Page 7 of 13 https://sites.google.com/site/lecturenotesofathithans/home
Numerical Methods S.ATHITHAN
3 Worked out Examples
S
x y ∆y
1931 40.62
N
20.18
A
1941 60.80 −1.03
H
19.15 5.49
IT
1951 79.95 4.46 −4.47
23.61 1.02
H
1961 103.56 5.48 AT
29.09
1971 132.65
F
We use this same table for the forward and backward differences.
O
To get f 0 (1931) and f 0 (1941), we use forward formula. In the same way we use backward
S
x − x0 1931 − 1931
For f 0 (1931), u = = = 0.
N
h 10
E
dy dy 1 1 2 1 3 1 4
R
= = ∆y0 − ∆ y0 + ∆ y0 − ∆ y0 + . . .
TU
dx x=1931 dx u=0 h 2 3 4
= 2.36425
C
LE
x − x0 1941 − 1931
For f 0 (1941), u = = = 1.
h 10
Page 8 of 13 https://sites.google.com/site/lecturenotesofathithans/home
Numerical Methods S.ATHITHAN
x − x n 1971 − 1971
For f 0 (1971), v = = = 0.
h 10
dy dy 1 1 2 1 3 1 4
= = ∇yn + ∇ yn + ∇ yn + ∇ yn + . . .
dx x=1971 dx v=0 h 2 3 4
= 3.10525.
x − xn 1961 − 1971
For f 0 (1961), v = = = −1.
h 10
dy dy
S
=
dx x=1961 dx v=−1
N
3v 2 + 6v + 2 3 4v 3 + 18v 2 + 22v + 6 4
1 2v + 1 2
= ∇yn + ∇ yn + ∇ yn + ∇ yn + . . .
A
h 2 6 24
H
= 2.65525
IT
H
AT
Example: 2. Fin the first three derivatives for the function given by the following data at x=0.5
x 0 1 2 3 4
and x=4.5.
y 0 0.25 0 2.25 16
F
O
Z 6
1
Example: 3. Evaluate dx using Trapezoidal rule and Sympson’s rule(both one-third
O
0 1+x
N
6−0
R
6
x 0 1 2 3 4 5 6
C
1 1 1 1 1 1 1
LE
y= 1
1+x 2 3 4 5 6 7
Trapezoidal Rule
Z xn Z x0 +nh
f (x)dx = f (x)dx
x0 x0
h
= [(y0 + yn ) + 2(y1 + y2 + · · · + yn−1 )]
2
h
= [(Sum of the first and the ordinates) + 2(Sum of the remaining ordinates)]
2
= 2.02142857
Page 9 of 13 https://sites.google.com/site/lecturenotesofathithans/home
Numerical Methods S.ATHITHAN
Simpson’s one-third rule
Z xn Z x0 +nh
f (x)dx = f (x)dx
x0 x0
h
= [(y0 + yn ) + 2(y2 + y4 + . . . ) + 4(y1 + y3 + . . . )]
3
h
= [(Sum of the first and the ordinates) + 2(Sum of the remaining odd ordinates)
3
+4(Sum of the remaining even ordinates)]
= 1.95873016
S
N
Simpson’s three-eighth rule
A
H
IT
Z xn Z x0 +nh
f (x)dx = f (x)dx
H
x0 x0 AT
3h
= [(y0 + yn ) + 3(y1 + y2 + · · · + yn−1 ) + 2(y3 + y6 + y9 + · · · + yn )]
8
F
= 1.96607143
O
S
Z 6
1
dx = [log(1 + x)]60 = loge 7 = 1.94591015.
O
0 1 + x
N
Z 6
1
Example: 4. Evaluate 2
dx using Trapezoidal rule and Sympson’s rule(both one-third
0 1+x
E
Hints/Solution:
6−0
Take the no. of intervals as 6, we have h = = 1.
C
6
LE
x 0 1 2 3 4 5 6
1 1 1 1 1 1 1
y= 1.00
1 + x2 2 5 10 17 26 37
Page 10 of 13 https://sites.google.com/site/lecturenotesofathithans/home
Numerical Methods S.ATHITHAN
Trapezoidal Rule
Z xn Z x0 +nh
f (x)dx = f (x)dx
x0 x0
h
= [(y0 + yn ) + 2(y1 + y2 + · · · + yn−1 )]
2
h
= [(Sum of the first and the ordinates) + 2(Sum of the remaining ordinates)]
2
= 1.41079950
S
Simpson’s one-third rule
N
A
H
Z xn Z x0 +nh
f (x)dx = f (x)dx
IT
x0 x0
H
h
= [(y0 + yn ) + 2(y2 + y4 + . . . ) + 4(y1 + y3 + . . . )]
AT
3
h
= [(Sum of the first and the ordinates) + 2(Sum of the remaining odd ordinates)
3
F
= 1.36617433
S
TE
Z xn Z x0 +nh
f (x)dx = f (x)dx
E
x0 x0
R
3h
= [(y0 + yn ) + 3(y1 + y2 + · · · + yn−1 ) + 2(y3 + y6 + y9 + · · · + yn )]
TU
8
C
= 1.35708188
LE
Page 11 of 13 https://sites.google.com/site/lecturenotesofathithans/home
Numerical Methods S.ATHITHAN
6−0
Take the no. of intervals as 6, we have h = = 1.
6
x −3 −2 −1 0 1 2 3
y = x4 81 16 1 0 1 16 81
Z xn Z x0 +nh
f (x)dx = f (x)dx
S
x0 x0
h
[(y0 + yn ) + 2(y1 + y2 + · · · + yn−1 )]
N
=
2
A
h
= [(Sum of the first and the ordinates) + 2(Sum of the remaining ordinates)]
H
2
IT
= 115
H
3.4 Simpson’s one-third rule
AT
F
Z xn Z x0 +nh
O
f (x)dx = f (x)dx
x0 x0
S
h
= [(y0 + yn ) + 2(y2 + y4 + . . . ) + 4(y1 + y3 + . . . )]
TE
3
h
O
= [(Sum of the first and the ordinates) + 2(Sum of the remaining odd ordinates)
3
N
Z xn Z x0 +nh
f (x)dx = f (x)dx
x0 x0
3h
= [(y0 + yn ) + 3(y1 + y2 + · · · + yn−1 ) + 2(y3 + y6 + y9 + · · · + yn )]
8
= 99
Page 12 of 13 https://sites.google.com/site/lecturenotesofathithans/home
Numerical Methods S.ATHITHAN
4 Exercise/Practice/Assignment Problems
Take more problems in the textbooks for Numerical Methods for your practice.
1. The population of a certain area is given below. Find the rate of growth of the population
in the years 1931, 1941, 1961 and 1971.
Year x 1921 1931 1941 1951 1961
Population y (in thousands) 19.96 38.65 58.81 77.21 132.65
2. The following data shows the specific volume of the superheated steam and corresponding
values of pressure. Find the rate of change of pressure when the volumes are 2,3,5 and 9.
Volume v 2 4 6 8 10
S
Pressure p 105 42.7 25.3 16.7 13.0
N
3. From the following data find the three derivatives of f(x) at 30,31 and 35.
A
x 30 31 32 33 34 35 36
H
f(x) 85.90 86.85 87.73 88.64 89.52 90.37 91.1
IT
4. Evaluate the following integrals using Trapezoidal rule and Sympson’s rule(both one-
H
third and three-eighth). Compare the result with exact solution.
AT
Z 1
x2
(a) 3
dx
0 1+x
F
Z 1
1
O
(b) 3
dx
0 1+x+x
S
Z π
TE
Z 5.2
(d) ln xdx
N
Visit: https://sites.google.com/site/lecturenotesofathithans/home
R
TU
C
LE
Page 13 of 13 https://sites.google.com/site/lecturenotesofathithans/home