0% found this document useful (0 votes)
5 views22 pages

Numerical Methods in Computational Math

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views22 pages

Numerical Methods in Computational Math

Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MAS1002 – Computational Mathematics

Module – 2: Numerical Methods - II


MA1002 – COMPUTATIONAL MATHEMATICS
2
Module 2: Numerical Methods II

Module 2
Numerical Methods II: Numerical differentiation (order one and two),
Numerical Integration (Trapezoidal rule, Simpson’s 1/3 and 3/8 rule),
Solution of algebraic and transcendental equations (Bisection method,
Regula Falsi Method, Newton Raphson Method).
MA1002 – COMPUTATIONAL MATHEMATICS
3
Module 2: Numerical Methods II

Learning Objectives

At the end of this topic, you will be able to:

Describe the concept of numerical Differentiation and


Numerical Integration.

Apply the numerical methods to solve Algebraic and


Transcendental equations.
MA1002 - COMPUTATIONAL MATHEMATICS
4
Module 2: Numerical Methods II
Numerical Differentiation
• Numerical Differentiation is the process by which we can find the derivative of
a function at some values of independent variable, when the set of values of
function is given.
• The problem of differentiation is solved by first approximating the function by
an interpolation formula and then differentiating this formula as many times as
required.
• Interpolation methods that we have discussed earlier are in two forms. Either
in terms of independent variable ‘𝑥’ or in terms of ‘𝑢’.
• ‘u’ is defined in two ways as –
1. 𝑢 = [𝑥 − 𝑥0]/ℎ 2. 𝑢 = [𝑥 – (𝑥0 + 𝑛ℎ)]/ℎ
So, in either of the case 𝑑𝑢/𝑑𝑥 = 1/ℎ
MA1002 - COMPUTATIONAL MATHEMATICS
5
Module 2: Numerical Methods II

• If we would like to find the first derivative of 𝑦 = 𝑓(𝑥) with respect to ‘𝑥’
then –
𝑑𝑦/𝑑𝑥 = 𝑓´(𝑥) simply, if 𝑓 is a function of ‘𝑥’ explicitly.
• But if y is a function of ‘x’ and ‘x’ is a function of ‘u’ then –
𝑑𝑦/𝑑𝑥 = (𝑑𝑓/𝑑𝑢)(𝑑𝑢/𝑑𝑥) = (𝑑𝑓/𝑑𝑢)/ℎ
Similarly, 𝑑2𝑦/𝑑𝑥2 = (𝑑2𝑓/𝑑𝑢2)/ℎ2
𝑑3𝑦/𝑑𝑥3 = (𝑑3𝑓/𝑑𝑢3)/ℎ3
………
MA1002 - COMPUTATIONAL MATHEMATICS
6
Module 2: Numerical Methods II
Ex. Find 𝑓´(0) and 𝑓´´(0) from the following data –
𝑥 0 1 2 3 4 5
𝑦 = 𝑓(𝑥) 4 8 15 7 6 2

Sol. As the desired value be obtained at x = 0, which is in the beginning of


the data, so it is convenient to use the Newton Gregory Forward Difference
formula.
For the purpose let us construct the difference table as –
MA1002 - COMPUTATIONAL MATHEMATICS
7
Module 2: Numerical Methods II
𝒙 𝒇(𝒙) ∆[𝒇(𝒙)] ∆𝟐[𝒇(𝒙)] ∆𝟑[𝒇(𝒙)] ∆𝟒[𝒇(𝒙)] ∆𝟓[𝒇(𝒙)]
0 4
4
1 8 3
7 -18
2 15 -15 40
-8 22 -72
3 7 7 -32
-1 10
4 6 -3
-4
5 2
MA1002 - COMPUTATIONAL MATHEMATICS
8
Module 2: Numerical Methods II
The Newton Gregory forward difference formula is –
𝑓 𝑥 = 𝑓 𝑥0 + ℎ𝑢
𝑢 𝑢−1 2 𝑢 𝑢−1 𝑢−2 3
= 𝑓 𝑥0 + 𝑢∆𝑓 𝑥0 + ∆ 𝑓 𝑥0 + ∆ 𝑓 𝑥0
2! 3!
𝑢 𝑢−1 𝑢−2 𝑢−3 4
+ ∆ 𝑓 𝑥0
4!
𝑢 𝑢 − 1 𝑢 − 2 …. 𝑢 − 𝑛 − 1 𝑛
+ ⋯……..+ ∆ 𝑓(𝑥0 )
𝑛!
…(1)
Where 𝑢 = (𝑥 − 𝑥0 )/ℎ = (0 − 0)/1 = 0
Differentiating (1) w.r.t. ‘x’ we have -
MA1002 - COMPUTATIONAL MATHEMATICS
9
Module 2: Numerical Methods II

𝑑𝑦 ′ 1 2𝑢−1 2 3𝑢2 −6𝑢+2 3


= 𝑓 𝑥 = ℎቈ∆𝑓(𝑥0 )+ 2 ∆ 𝑓(𝑥0 )+ 6
∆ 𝑓 𝑥0
𝑑𝑥
4𝑢3 −18𝑢2 +22𝑢−6 4 5𝑢4 −40𝑢3 +105𝑢2 −100𝑢+24 5
+ 24
∆ 𝑓 𝑥0 + 120
∆ 𝑓 𝑥0 + ⋯ ቃ
∴ 𝑓 ′ 0 = −27.9

𝑑2 𝑦 ′′
1 2 6𝑢−6 3
2
= 𝑓 𝑥 = 2
ൣ∆ 𝑓(𝑥 0 ) + 6 ∆ 𝑓 𝑥0 +
𝑑𝑥 ℎ
12𝑢2 −36𝑢+22 4 20𝑢3 −120𝑢2 +210𝑢−100 5
24 ∆ 𝑓 𝑥0 + 120 ∆ 𝑓 𝑥0 + ⋯ ቃ
so 𝑓 ′′ 0 = 117.6667
MA1002 - COMPUTATIONAL MATHEMATICS
10
Module 2: Numerical Methods II
Ex. A slider in a machine moves along a fixed straight rod. Its distance ‘x’ cm.
along the rod is given below for various values of time ‘t’ sec. Find the velocity
and acceleration of the slider at 0.33 sec.
𝑡 0 0.1 0.2 0.3 0.4 0.5 0.6
𝑥 30.13 31.62 32.87 33.64 33.95 33.81 33.24

Sol. As the required result is near to the middle of the given data, so we use
the Stirling formula.
First, we construct the difference table
MA1002 - COMPUTATIONAL MATHEMATICS
11
Module 2: Numerical Methods II
u t 𝒙𝒕 ∆𝒙𝒕 ∆𝟐 𝒙𝒕 ∆𝟑 𝒙𝒕 ∆𝟒 𝒙𝒕 ∆𝟓 𝒙𝒕 ∆𝟔 𝒙𝒕
-3 0 30.13
1.49
-2 0.1 31.62 -0.24
1.25 -0.24
-1 0.2 32.87 -0.48 0.26
0.77 0.02 -0.27
0 0.3 33.64 -0.46 -0.01 0.29
0.31 0.01 0.02
1 0.4 33.95 -0.45 0.01
-0.14 0.02
2 0.5 33.81 -0.43
-0.57
3 0.6 33.24
MA1002 - COMPUTATIONAL MATHEMATICS
12
Module 2: Numerical Methods II
If we represent 𝑥𝑡 = 𝑦𝑡 then the Stirling formula is-
∆𝑦−1 + ∆𝑦0 𝑢2 2 𝑢 𝑢2 − 12 ∆3 𝑦−2 + ∆3 𝑦−1
𝑥 𝑡 = 𝑦𝑡 = 𝑦0 + 𝑢 + ∆ 𝑦−1 + +
2 2! 3! 2
𝑢2 (𝑢2 − 12 ) 4 𝑢(𝑢2 − 12 )(𝑢2 − 22 ) ∆5 𝑦−3 + ∆5 𝑦−2
∆ 𝑦−2 + +
4! 5! 2
𝑢2 (𝑢2 − 12 )(𝑢2 − 22 ) 6 𝑢(𝑢2 − 12 )(𝑢2 − 22 )(𝑢2 − 32 ) ∆7 𝑦−4 + ∆7 𝑦−3
∆ 𝑦−3 +
6! 7! 2
+…
Where,
0.33 − 0.3
𝑢 = (𝑡 − 𝑡0)/ℎ = = 0.3
0.1
MA1002 - COMPUTATIONAL MATHEMATICS
13
Module 2: Numerical Methods II

𝑑𝑥 1 ∆𝑦−1 + ∆𝑦0 3𝑢 2 − 1 ∆3 𝑦 + ∆ 3𝑦
2 −2 −1
= ቊ + 𝑢∆ 𝑦−1 +
𝑑𝑡 ℎ 2 3! 2
(4𝑢3 − 2𝑢) 4 5𝑢4 − 15𝑢2 + 4 ∆5 𝑦−3 + ∆5 𝑦−2
+ ∆ 𝑦−2 +
4! 5! 2
6𝑢5 − 20𝑢3 + 10𝑢 6
+ ∆ 𝑦−3 + ⋯ ቋ
6!
Putting value of 𝑢 and required values from the difference table, we get velocity
𝑑𝑥
𝑣= = −1.5153 𝑐𝑚/sec
𝑑𝑡
MA1002 - COMPUTATIONAL MATHEMATICS
14
Module 2: Numerical Methods II

𝑑2 𝑥 1 2 ∆3 𝑦−2 + ∆3 𝑦−1 (12𝑢2 − 2) 4


2
= 2 ൝∆ 𝑦−1 + 𝑢 + ∆ 𝑦−2
𝑑𝑡 ℎ 2 4!
20𝑢3 − 30𝑢 ∆5 𝑦−3 + ∆5 𝑦−2 30𝑢4 − 60𝑢2 + 10 6
+ + ∆ 𝑦−3 + ⋯ ቋ
5! 2 6!
By putting the value of 𝑢 and required table values, we get the acceleration
𝑑2 𝑥
𝑎 = 2 = −45.46221 𝑐𝑚/sec 2
𝑑𝑡
MA1002 - COMPUTATIONAL MATHEMATICS
15
Module 2: Numerical Methods II
Ex. Find the maximum or minimum value of the function from the following values-
x 0 1 2 3
f(x) 1 0 1 10
Sol. Let us construct the difference table as
x f(x) ∆[f(x)] ∆2[f(x)] ∆3[f(x)]
0 1
-1
1 0 2
1 6
2 1 8
9
3 10
MA1002 - COMPUTATIONAL MATHEMATICS
16
Module 2: Numerical Methods II
For NGFDF – 4
𝑢 = (𝑥 − 𝑥0)/ℎ = (𝑥 – 0)/1 = 𝑥 ⇒ 𝑥(3𝑥 − 4) = 0 ⇒ 𝑥 = 0,
3
So, from the NGFDF, putting the table values For sufficient condition
and value of 𝑢 we get - 𝑓 ′′ 𝑥 = 6𝑥 − 4
𝑓 𝑥 As, 𝑓 ′′ 0 = −4, so, 𝑥 = 0 is the point of
𝑥 𝑥−1 maxima and
= 1 + 𝑥 −1 + 2
2! 𝑓𝑚𝑎𝑥 = 𝑓 0 = 1
𝑥 𝑥−1 𝑥−2 As, 𝑓 ′′ 4/3 = 4, so, 𝑥 = 4/3 is the point of
+ 6
3! minima and
= 1 − 𝑥 + 𝑥 2 − 𝑥 + 𝑥 3 − 3𝑥 2 + 2𝑥 3 2
= 𝑥3 − 2𝑥2 + 1 4 4
𝑓𝑚𝑖𝑛 = 𝑓 4/3 = −2 +1
For maxima and minima, the necessary 3 3
condition is 64 32 64 − 96 + 27 5
= − +1= =−
𝑓′ 𝑥 = 0 27 9 27 27
⇒ 3𝑥 2 − 4𝑥 = 0
MA1002 - COMPUTATIONAL MATHEMATICS
17
Module 2: Numerical Methods II
Ex. From the following data, find the value of 𝑥, for which the value of 𝑦(𝑥) is maximum.
Hence find the maximum value of 𝑦(𝑥).
𝒙 𝟏. 𝟐 𝟏. 𝟑 𝟏. 𝟒 𝟏. 𝟓 𝟏. 𝟔
𝑦(𝑥) 0.9320 0.9636 0.9855 0.9975 0.9996

Sol. To find the maximum value of the function 𝑦(𝑥), we first find the stationary point with the
𝑑𝑦
help of first derivative and then we check the maxima with the help of second derivative
𝑑𝑥
𝑑2 𝑦
.
𝑑𝑥 2
For the purpose, let us take the use of Newton Gregory Forward difference formula.
Let us construct the forward difference table as
MA1002 - COMPUTATIONAL MATHEMATICS
18
Module 2: Numerical Methods II

𝒙 𝒚(𝒙) ∆𝒚(𝒙) ∆𝟐 𝒚(𝒙) ∆𝟑 𝒚(𝒙) ∆𝟒 𝒚(𝒙)


1.2 0.9320
0.0316
1.3 0.9636 −0.0097
0.0219 −0.0002
1.4 0.9855 −0.0099 0.0002
0.0120 0
1.5 0.9975 −0.0099
0.0021
1.6 0.9996
MA1002 - COMPUTATIONAL MATHEMATICS
19
Module 2: Numerical Methods II

The Newton Gregory forward difference formula is –


𝑦 𝑥 = 𝑓 𝑥 = 𝑓 𝑥0 + ℎ𝑢
𝑢 𝑢−1 2 𝑢 𝑢−1 𝑢−2 3
= 𝑓 𝑥0 + 𝑢∆𝑓 𝑥0 + ∆ 𝑓 𝑥0 + ∆ 𝑓 𝑥0
2! 3!
𝑢 𝑢−1 𝑢−2 𝑢−3 4 𝑢 𝑢 − 1 𝑢 − 2 …. 𝑢 −𝑛 −1 𝑛
+ ∆ 𝑓 𝑥0 + ⋯ … . . + ∆ 𝑓(𝑥0 )
4! 𝑛!
…(1)
Where 𝑢 = (𝑥 − 𝑥0 )/ℎ = (𝑥 − 1.2)/0.1
Differentiating (1) w.r.t. ‘x’ we have –
𝑑𝑦 ′ 1 2𝑢−1 2 3𝑢2 −6𝑢+2
= 𝑓 𝑥 = ℎቈ∆𝑓(𝑥0 )+ 2 ∆ 𝑓(𝑥0 )+ 6 ∆3 𝑓 𝑥0
𝑑𝑥
4𝑢3 −18𝑢2 +22𝑢−6 4𝑓 𝑥
+ 24 ∆ 0 + ⋯ቃ
MA1002 - COMPUTATIONAL MATHEMATICS
20
Module 2: Numerical Methods II

1 2𝑢−1 3𝑢2 −6𝑢+2


= ቂ0.0316 + 2
(−0.0097) + 6
(−0.0002)
0.1
4𝑢3 −18𝑢2 +22𝑢−6
+ 24 (0.00002) + ⋯ ቃ
For maxima/minima, we must have
𝑑𝑦
= 𝑓′ 𝑥 = 0
𝑑𝑥
2𝑢−1 3𝑢2 −6𝑢+2
⇒ 0.0316 + 2 −0.0097 + 6 −0.0002
4𝑢3 −18𝑢2 +22𝑢−6
+ 24
0.00002 = 0
As the third term and fourth term on the LHS have very small values (due to the product with
small values), we ignore these terms. So, we are with
2𝑢−1 1 0.0632
0.0316 + 2 −0.0097 = 0 ⇒ 𝑢 = 1+ = 3.7577
2 0.0097
MA1002 - COMPUTATIONAL MATHEMATICS
21
Module 2: Numerical Methods II

𝑑2 𝑦 ′′
1 2 6𝑢−6 3 12𝑢2 −36𝑢+22 4𝑓 𝑥 + ⋯
= 𝑓 𝑥 = ∆ 𝑓(𝑥 0 ) + 6 ∆ 𝑓 𝑥0 + 24 ∆ 0
𝑑𝑥 2 ℎ2
1 6𝑢−6 12𝑢2 −36𝑢+22
= 2
−0.0097 + 6 (−0.0002) + 24 (0.0002)
(0.1)
At 𝑢 = 3.7577, we have
𝑑2𝑦
2
= −0.009983 < 0
𝑑𝑥
So, the value of 𝑢 = 3.7577, may produce the maximum value of 𝑦(𝑥).
𝑥 − 𝑥0 𝑥 − 1.2
∵𝑢= ⇒ 3.7577 =
ℎ 0.1
⇒ 𝑥 = 1.2 + 0.37577 = 1.57577
So, corresponding to this value,
MA1002 - COMPUTATIONAL MATHEMATICS
22
Module 2: Numerical Methods II

From equation (1)


𝑦𝑚𝑎𝑥 = 𝑦 1.57577
3.7577 3.7577 − 1
= 0.9320 + 3.7577 0.0316 + −0.0097
2!
3.7577 3.7577 − 1 3.7577 − 2
+ −0.0002
3!
3.7577 3.7577 − 1 3.7577 − 2 3.7577 − 3
+ 0.0002 + ⋯ = 0.9999925
4!

You might also like