Professional Documents
Culture Documents
Numerical Method: One Error Estimation
Numerical Method: One Error Estimation
Chapter one
Error estimation
1.1 Introduction to Error
Numerical analysis is the branch of mathematics that is used to find approximations to difficult
problems.
There are two kinds of numbers—exact and approximate numbers.
1. Exact numbers𝑥 : A Number with which no uncertainly is associated to no
approximation is taken, are known as exact numbers.
2. Approximate number 𝒙𝒂 : is a number that differs, but slightly, from an exact number.
Example: The numbers 1, 2, 3, … , , π, √2, e, …, etc., are all exact (𝑥 ), but 1.41, 1.414, 1.4142,
1.41421, …, are some approximate value of √2, Similarly 3.14, 3.141, 3.14159, …, etc., are
some approximate values of π.
Significant Digits/Figures
The digits that are used to express a number are called significant digits/figures.
The given digit in the given number is significant if one of the following is satisfied.
1. All non-zero digits are significant.
2. A zero digit, which lie between significant digits are significant.
3. Final (trailing) zeros in the decimal portion ONLY are significant digits.
Note: The significant figure in a number written in scientific notation ( M × 10 ) consists of all
the digits explicitly in M. Significant figures are counted from left to right starting with the left
most non zero digit.
Numbers Significant digits(figures) No. of Significant digits(figures)
3.78 3, 7, 8 3
3080 3, 0 , 8 3
3.7080 3,7,0,8,0 5
0.378 3,7,8 3
0.0378 3,7,8 3
3.00 3 3
8.23x10 8,2,3 3
Decimal places:
The numbers after the decimal point (to the right) are called numbers in the decimal places.
Or the significant digit after the decimal point (to the right) is called the decimal places.
Errors
one of the most important aspects of numerical analysis is the error analysis. Errors may occur at
any stage of the process of solving a problem. By the error we mean the difference between the
true value and the approximate value.
Accuracy and Precision: Accuracy refers to how closely a computed or measured value agrees
with the true value. Precision refers to how closely individual computed or measured values
agree with each other. Inaccuracy (also known as bias) is the systematic deviation from the truth.
Imprecision (uncertainty) refers to the magnitude of the scatter.
Accuracy is a qualitative term that describes how close the measurements are to the
actual (true) value. Precision describes the spread of these measurements when
repeated.
𝐸 = 1 3 − 0.33 = 1 300
𝐸 = 1 3 − 0.34 = 1 150
Truncation error is = 𝑒 − (1 + 𝑥 + )= + +⋯
! ! !
Then, we bisect the interval and continue the process till the root is found to be desired accuracy.
In the above figure, 𝑓(𝑥 )𝑓(𝑎) < 0; therefore, the root lies in between 𝑎 and 𝑥 . The second
approximation to the root now is 𝑥 = (𝑎 + 𝑥 ). If 𝑓(𝑥 ) is negative as shown in the figure
then the root lies in between 𝑥 and𝑥 , and the third approximation to the root is
𝑥 = (𝑥 + 𝑥 ) and so on. This method is simple but slowly convergent. It is also called as
Bolzano method.
Procedure for the Bisection Method to Find the Root of the Equation 𝑓(𝑥 ) = 0
Step 1: Choose two initial guess values (approximation) 𝑎 and 𝑏 such that 𝑓(𝑎)𝑓 (𝑏) < 0.
Step 2: Evaluate the mid-point 𝑥 of 𝑎 and 𝑏 given by 𝑥 = (𝑎 + 𝑏) and also evaluate 𝑓(𝑥 ).
Step 3: If 𝑓 (𝑎)𝑓 (𝑥 ) < 0, then set 𝑏 = 𝑥 else set 𝑎 = 𝑥 . Then apply the formula of step 2.
Example 2:- Solve the equation 𝑥 − 5𝑥 + 3 = 0 using the Bisection method in the interval
[0,1] with error 𝜀 = 0.001.
Solution: Here 𝑓 (𝑥) = 𝑥 − 5𝑥 + 3, 𝑎 = 0 and 𝑏 = 1
𝑓 is continuous in the given interval [0,1] and 𝑓(0) = 3 > 0, 𝑓(1) = −1 < 0. Hence, there is a
root of the equation in the given interval.
Then, the root lies in the interval [0.5,1] and 𝑒 = |0.5 − 1| = 0.5 > 0.001
.
𝑥 = = 0.75 and 𝑓(0.75) = −0.328125 < 0
Then, the root lies in the interval [0.5,0.75] and 𝑒 = |0.5 − 0.75| = 0.25 > 0.001
. .
𝑥 = = 0.625 and 𝑓(0.625) = 0.11914 > 0
Then, the root lies in the interval [0.625,0.75] and 𝑒 = |0.625 − 0.75| = 0.125 > 0.001
. .
𝑥 = = 0.6875 and 𝑓(0.6875) = −0.112548 < 0
Then, the root is in the interval [0.625,0.6875] & 𝑒 = |0.625 − 0.6875| = 0.0.0625 > 0.001
. .
𝑥 = = 0.65625 and 𝑓(0.65625) = 0.001373 > 0
Example 3:- Approximate √2 using bisection method correct to two decimal places.
Thus, by intermediate value theorem there exist at least one root in [1,2].
.
𝑥 = = = 1.25 ⟹ 𝑓(𝑥 ) = 𝑓(1.25) = −0.4375 ≤ 0 𝑎𝑛𝑑 𝑓(𝑥 )𝑓(𝑥 ) ≤ 0
. .
𝑥 = = = 1.375 ⟹ 𝑓(𝑥 ) = 𝑓(1.375) = −0.109375 ≤ 0 ,
𝑥 +𝑥 1.375 + 1.5
𝑥 = = = 1.4375 ⟹ 𝑓(𝑥 ) = 𝑓(1.4375) = 0.0664 ≥ 0
2 2
Exercises 2: Use the bisection method find the drag coefficient 𝑐 needed for a parachutist of
mass 𝑚 = 68.1 kg to have a velocity of 𝑣 = 40 𝑚/𝑠 after free-falling for time 𝑡 = 10 𝑠. Note:
The acceleration due to gravity is 𝑔 = 9.8 𝑚/𝑠 and 𝑓 (𝑐) = 1 − 𝑒 ( ⁄ ) − 𝑣.
Example 2: Find the real root of equation 𝑓(𝑥) = 𝑥 + 𝑥 – 1 = 0 by using iteration method.
Solution: Here, 𝑓(0) =– 1 and 𝑓 (1) = 1 so a root lies between 0 and 1. Now, 𝑥 = so that,
√
𝑔(𝑥 ) = ⟹ 𝑔 (𝑥) = − ⟹ |𝑔 (𝑥)| < 1 for 𝑥 < 1
√ ( )
Hence iterative method can be applied.
Take, x = 0.5 we get x = g(x ) = = = 0.81649
√ .
1 1
x = g(x ) = = = 0.74196
1+ x √1.81649
Algorithm for Newton-Raphson Method to Find the Root of the Equation 𝑓(𝑥) = 0
Step 1: Take a trial solution (initial approximation) as 𝑥0 . Find 𝑓 (𝑥0 ) and 𝑓 ′ (𝑥0 )
Step 2: Follow the above procedure to find the successive approximations 𝑥 1 using the
( )
formula 𝑥 1 =𝑥 − ′( )
, where 𝑛 = 0, 1, 2, 3, …
Step 3: Stop the process when |𝑥 1 − 𝑥 | ≤ 𝜀, where 𝜀 is the prescribed accuracy.
Note: the order of convergence of Newton-Raphson method is 2 i.e., Newton Raphson method
is quadratic convergent. This also shows that subsequent error at each step is proportional to
the square of the previous error and as such the convergence is quadratic.
Example 1: Find the real root of the equation log 𝑥 – cos 𝑥 = 0 correct to three places of
decimal by Newton-Raphson’s method.
Solution: Let log 𝑥 – cos 𝑥 = 0
So that 𝑓(1) = −0.5403 and 𝑓(2) = 1.1092.
∴ The root lies between 1 and 2.
Also, 𝑓(1.1) = 𝑙𝑜𝑔1.1 − 𝑐𝑜𝑠1.1 = 0.0953 − 0.4535 = −0.3582
𝑓(1.2) = 𝑙𝑜𝑔1.2 − 𝑐𝑜𝑠1.2 = −0.18
𝑓(1.3) = 𝑙𝑜𝑔1.3 − 𝑐𝑜𝑠1.3 = −0.0051
𝑓(1.4) = 𝑙𝑜𝑔1.4 − 𝑐𝑜𝑠1.4 = 0.1665
Thus the root lies between 1.3 and 1.4 .
Since 𝑓 (𝑥) = 𝑙𝑛𝑥 − 𝑐𝑜𝑠𝑥 and 𝑓 (𝑥) = + 𝑠𝑖𝑛𝑥
Then by Newton’s-Rapton method, we get
𝑓(𝑥) 𝑙𝑛𝑥 − 𝑐𝑜𝑠𝑥
𝑥 =𝑥 − =𝑥 −
𝑓 (𝑥) 1
+ 𝑠𝑖𝑛𝑥
𝑥
10𝑥 + 𝑦 + 𝑧 = 12
c) 2𝑥 + 10𝑦 + 𝑧 = 13
2𝑥 + 2𝑦 + 10𝑧 = 14
2𝑥 – 6𝑦 + 8𝑧 = 24
d) 5𝑥 + 4𝑦 – 3𝑧 = 23
𝑥 + 𝑦 + 2𝑧 = 16
18
Numerical method
Solution: To begin, write the system in the form
( )
1 2 3
𝑥 =− + 𝑥 ( )− 𝑥 ( )
5 5 5
2 3 1
𝑥 ( )= + 𝑥 ( )− 𝑥 ( )
9 9 9
3 2 1
𝑥 ( )=− + 𝑥 ( )− 𝑥 ( )
7 7 7
𝟏𝒔𝒕 Iteration: By taking 𝑘 = 1 with initial approximations (𝑥 , 𝑥 , 𝑥 ) = (0,0,0)
( )
1 2 3
𝑥 = − + (0) − (0) = −0.200
5 5 5
Now that we have a new value for 𝑥 , however, use it to compute a new value for 𝑥 . That is,
( )
2 3 1
𝑥 = + (−0.200) − (0) ≈ 0.156
9 9 9
( ) ( )
Similarly, use 𝑥 = −0.200 and 𝑥 = 0.156 to copmute a new value for 𝑥 . That is,
( )
𝑥 = − + (−0.200) − (0.156) ≈ −0.508.
( ) ( ) ( )
So the first approximation is 𝑥 = −0.200, 𝑥 = 0.156, 𝑎𝑛𝑑 𝑥 = −0.508.
𝟐𝒏𝒅 Iteration: By taking 𝑘 = 2 with second approximations (x , x , x ) = (−0.200,0.156, −0.508)
( )
1 2 3
𝑥 = − + (0.156) − (−0.508) = 0.167
5 5 5
2 3 1
𝑥 ( ) = + (0.167) − (−0.508) ≈ 0.334
9 9 9
3 2 1
𝑥 ( ) = − + (0.167) − (0.334) ≈ −0.429
7 7 7
Continued iterations produce the sequence of approximations shown in below Table
𝑛 0 1 2 3 4 5
𝑥 0.000 −0.200 0.167 0.191 0.186 0.186
𝑥 0.000 0.156 0.334 0.333 0.331 0.331
𝑥 0.000 −0.508 −0.429 −0.422 −0.423 −0.423
Because the last two columns in Table are identical, we can conclude that to three significant
digits the solution is 𝑥 = 0.186, 𝑥 = 0.331, 𝑎𝑛𝑑 𝑥 = −0.423.
Note 1: Iterative methods are generally less efficient than direct methods due to the large number
of operations or iterations required.
Note 4: The initial guess affects only the number of iterations that are required for convergence.
19
Numerical method
Chapter four
Interpolation and curve fitting
20
Numerical method
The forward difference table for the arguments 𝑥 , 𝑥 , … . , 𝑥 are shown in below.
𝑥 𝑦 ∆ ∆ ∆ ∆ ∆
𝑥 𝑦
∆𝑦
𝑥 𝑦 ∆ 𝑦
∆𝑦 ∆ 𝑦
𝑥 𝑦 ∆ 𝑦 ∆ 𝑦
∆𝑦 ∆ 𝑦 ∆ 𝑦
𝑥 𝑦 ∆ 𝑦 ∆ 𝑦
∆𝑦 ∆ 𝑦
𝑥 𝑦 ∆ 𝑦
∆𝑦
𝑥 𝑦
where x = x + h, x = x + 2h, … . , x = x + nh.
The first term in the above Table is y and is called the leading term. The differences ∆y , ∆ y , … , ∆ y
are called the leading differences.
4.2 Interpolation
Introduction
21
Numerical method
Interpolation is the technique of estimating the value of a function for any intermediate value of
the independent variable 𝑥 when a set of values of 𝑦 = 𝑓(𝑥) for certain value of 𝑥 are known or
given. That is, 𝑖𝑓 (𝑥 , 𝑦 ), 𝑖 = 0, 1, 2, … , 𝑛 are the set of (𝑛 + 1) given data points of the function
𝑦 = 𝑓(𝑥), then the process of finding the value of y corresponding to any value of 𝑥 = 𝑥
between 𝑥 and 𝑥 , is called interpolation. The process of computing or finding the value of a
function for any value of the independent variable outside the given range is called
extrapolation.
If 𝑝(𝑥) is a polynomial, then 𝑝(𝑥) is called the interpolating polynomial and the process of
computing the intermediate values of 𝑦 = 𝑓 (𝑥) is called the polynomial interpolation.
To construct this polynomial we follow two different approaches which are interpolation
with equal intervals and interpolation with unequal intervals.
4.2.1. Interpolation with equal intervals
Newton forward interpolation formula
Let 𝑦 = 𝑓(𝑥) be a given function of 𝑥 which takes the value 𝑓(𝑥 ), 𝑓(𝑥 + ℎ), 𝑓 (𝑥 + 2ℎ),
. . ., 𝑓(𝑥 + 𝑛ℎ) for(𝑛 + 1) equally spaced values 𝑥 , 𝑥 + ℎ, 𝑥 + 2ℎ, … , 𝑥 + 𝑛ℎ of the
independent variable 𝑥. Assume that 𝑓(𝑥) be a polynomial of 𝑛 degree, given by 𝑓(𝑥 ) = 𝑎 +
𝑎 (𝑥 − 𝑥 ) + 𝑎 (𝑥 − 𝑥 )(𝑥 − 𝑥 ) + ⋯ + 𝑎 (𝑥 − 𝑥 )(𝑥 − 𝑥 ) … (𝑥 − 𝑥 )……… (*)
and 𝑓(𝑥 ) = 𝑦 for 𝑖 = 0, 1, … , 𝑛. where 𝑎 , 𝑎 , … , 𝑎 are to be determined.
Now to find the values of 𝑎 , 𝑎 , … , 𝑎 :put 𝑥 = 𝑥 , 𝑥 + ℎ, 𝑥 + 2ℎ, … , 𝑥 + 𝑛ℎ in equation (*)
successively.
Therefore for 𝑥 = 𝑥 , 𝑓 (𝑥 ) = 𝑎
( ) ( ) ( ) ∆ ( )
for 𝑥 = 𝑥 + ℎ, ⇒ 𝑎 = = =
∆ ( ) ∆ ( )
for 𝑥 = 𝑥 + 2ℎ,⇒ 𝑎 = =
!
∆ ( ) ∆ ( )
Similarly,⇒ 𝑎 = ,…,𝑎 =
! !
Put the values of 𝑎 , 𝑎 , … , 𝑎 , in the equation (*), we get
∆𝑓( 𝑥 ) ∆ 𝑓 (𝑥 )
𝑓(𝑥 ) = 𝑓 (𝑥 ) + (𝑥 − 𝑥 ) + (𝑥 − 𝑥 )(𝑥 − 𝑥 ) + ⋯
ℎ 2! ℎ
∆ 𝑓 (𝑥 )
+ (𝑥 − 𝑥 )(𝑥 − 𝑥 ) … (𝑥 − 𝑥 )
𝑛! ℎ
Again, put 𝑥 = 𝑥 + ℎ𝑢 ⇒ 𝑢 = , we have
∆ 𝑓 (𝑥 ) ∆ 𝑓 (𝑥 )
𝑓(𝑥 ) = 𝑓(𝑥 ) + 𝑢∆𝑓( 𝑥 ) + 𝑢 (𝑢 − 1) + ⋯ + 𝑢 (𝑢 − 1) … (𝑢 − (𝑛 − 1))
2! 𝑛!
which is required formula for Newton’s forward interpolation.
22
Numerical method
This formula is used to interpolate the values of 𝑓(𝑥) near the beginning of the set of values and
is applicable for equally spaced argument only.
Example:
1. Find the second degree polynomial passes through (1, −1), (2, −2), (3, −1) 𝑎𝑛𝑑 (4, 2).
2. Find cubic polynomial which takes the following data
X 0 1 2 3
Y 1 0 1 10
3. Find the number of students from the ff data who scored marks not more than 45.
Marks range 30-40 40-50 50-60 60-70 70-80
No. of students 35 48 70 40 22
4. Find e for x = 0.05 using the following table
x 0 0.1 0.2 0.3 0.4
e 1 1.3499 1.8221 2.4596 3.3201
23
Numerical method
Or 𝑦 = 𝑓(𝑥) = 𝑙 (𝑥)𝑓 (𝑥 ) + 𝑙 (𝑥)𝑓(𝑥 ) + ⋯ + 𝑙 (𝑥)𝑓 (𝑥 ),⟹ 𝑓(𝑥 ) = ∑ 𝐿 (𝑥)𝑓 where the
Lagrange basis functions are defined by
𝐿 (𝑥) = ∏ , 𝑖 = 0,1,2, … , 𝑛.
Therefore,
= 𝑥 − 7𝑥 + 18𝑥 − 12
Hence, the polynomial is 𝑃 (𝑥) = 𝑥 − 7𝑥 + 19𝑥 − 12 and
𝑓(2) = 𝑃 (2) = (2) − 7(2) + 18(2) − 12 = 4.
Example2: Let 𝑃 (𝑥) is the interpolating polynomial for the data (0,0), (0.5, 𝑦), (1,3) and(2,2).
Then find 𝑦 if the coefficient of 𝑥 in 𝑃 (𝑥) is 6.
Solution: The polynomial is given by:
𝑃 (𝑥) = 𝐿 (𝑥)𝑓 + 𝐿 (𝑥 )𝑓 + 𝐿 (𝑥 )𝑓 + 𝐿 (𝑥)𝑓 =𝑦𝐿 (𝑥 ) + 3𝐿 (𝑥 ) + 2𝐿 (𝑥 ), where
( )( )( ) ( )( )( )
𝐿 (𝑥) = ( )( )( )
=( . )( . )( . )
= (𝑥 − 3𝑥 + 2𝑥)
( )( )( ) ( )( . )( )
𝐿 (𝑥) = ( )( )( )
= ( )(
= −2𝑥 + 5𝑥 − 2𝑥
. )( )
( )( )( ) ( )( . )( )
𝐿 (𝑥) = ( )( )( )
= ( )(
= (𝑥 − 1.5𝑥 + 0.5𝑥)
. )( )
Therefore,
𝑃 (𝑥) = 𝑦 (𝑥 − 3𝑥 + 2𝑥) + 3(−2𝑥 + 5𝑥 − 2𝑥) + 2 (𝑥 − 1.5𝑥 + 0.5𝑥)
= 𝑦− 𝑥 + (−8𝑦 + 14)𝑥 + 𝑦−
24
Numerical method
Now, the coefficient of 𝑥 in the polynomial 𝑃 (𝑥) is 𝑦− .⟹ 𝑦− =6⟹𝑦=
Exercise:
1. Using the Lagrange interpolation formula find the polynomial with 𝑥 = 2, 𝑥 = 2.5 and 𝑥 = 4 and 𝑓(𝑥) = .
2. Apply Lagrange’s interpolation formula to find a polynomial which passes through the points
(0, – 20), (1, – 12), (3, – 20) 𝑎𝑛𝑑 (4, – 24).
3. Using Lagrange’s interpolation formula, find the value of 𝑦 corresponding to 𝑥 = 10 from the following data.
x 5 6 9 11
Y 380 -2 196 509
The aim is to minimize the squares of the errors. In order to do this, suppose the set of data
points satisfying the theoretical solution 𝑦 = 𝑓(𝑥) are (𝑥 , 𝑦 ), 𝑖 = 1,2, … , 𝑛 .
The curve P(x) fitted to the observation 𝑦 , 𝑦 , . . . , 𝑦 will be regarded as the best fit to f(x), if the
difference between 𝑃(𝑥 ) and f(x ), i = 1, 2, . . . , n, is least. That is, the sum of the differences
e = f(x )– P(x ), i = 1, 2, . . . , n should be the minimum. The differences obtained from e
could be negative or positive and when all these e are summed up, the sum may add up to zero.
This will not give the true error of the approximating polynomial. Thus to estimate the exact
error sum, the square of these differences are more appropriate.
Linear least square approximation
The general form of a linear equation can be written as 𝑦 = 𝑎 + 𝑏𝑥 which is fitted to the data
points (𝑥 , 𝑦 ), 𝑖 = 1,2, … , 𝑛.
Now we have 𝑠 = ∑ 𝑒 = ∑ (𝑦 − (𝑎 + 𝑏𝑥 ))
By the principle of least squares, the value of S is minimum therefore = 0 and = 0.
Then the normal equations becomes
25
Numerical method
∑ 𝑦 = 𝑛𝑎 + 𝑏 ∑ 𝑥
∑ 𝑦 𝑥 = 𝑎∑ 𝑥 +𝑏∑ 𝑥
On solving these equations, we get the values of a and b. Putting the value of a and b in the
linear equation 𝑦 = 𝑎 + 𝑏𝑥, we get the equation of the line of best fit.
Example: By using the Least Squares Approximation, fit
a. a straight line
X 1 2 3 4 5 6
Y 120 90 60 70 35 11
Solution a: In order to fit s line to the set of data point, we assume the equation of the form
𝑦 = 𝑎 + 𝑏𝑥 where the unknowns a and b are to be determined.
The normal equations becomes
∑ 𝑦 = 𝑛𝑎 + 𝑏 ∑ 𝑥
∑ 𝑥 𝑦 = 𝑎∑ 𝑥 +𝑏∑ 𝑥
Here we shall need to construct column for values of 𝑥 , 𝑦 , 𝑥 𝑦 and 𝑥 given as
𝑥 𝑦 𝑥𝑦 𝑥
1 120 120 1
2 90 180 4
3 60 180 9
4 70 280 16
5 35 175 25
6 11 66 36
∑ 𝑥=21 ∑ 𝑦 =386 ∑ 𝑥𝑦 = 1001 ∑ 𝑥 = 91
386 = 6𝑎 + 21𝑏
1001 = 21𝑎 + 91𝑏 solving these, we get 𝑎 = 134.33 and 𝑏 = −20
Therefore a straight line fitted with a given data point is 𝑦 = 134.33 − 20𝑥
4.5.2 Continuous-linear least square approximations
Let 𝑦 = 𝑓(𝑥 ) be continuous on [a, b] and p(x) be its approximated polynomial of degree one
𝑝(𝑥 ) = 𝑎 + 𝑎 𝑥, then 𝑆 = ∫ [𝑦 − (𝑎 + 𝑎 𝑥)] 𝑑𝑥
The necessary condition for minimum S are given by
= = 0 and this gives
−2 ∫ [𝑦 − (𝑎 + 𝑎 𝑥)] 𝑑𝑥 = 0
−2 ∫ [𝑦 − (𝑎 + 𝑎 𝑥 +)] 𝑥𝑑𝑥 = 0
Hence the normal equations are as follows
∫ 𝑦𝑑𝑥 = 𝑎 ∫ 𝑑𝑥 + 𝑎 ∫ 𝑥𝑑𝑥
∫ 𝑥𝑦𝑑𝑥 = 𝑎 ∫ 𝑥𝑑𝑥 + 𝑎 ∫ 𝑥 𝑑𝑥
Example: Find a least square approximation to fit straight line
i. 𝑦 = √𝑥 for [0, 1] ii. 𝑦 = sin 𝜋𝑥 for [0, 1]
Solution: i. a. linear approximation
26
Numerical method
For 𝑦 = √𝑥, we can write the linear polynomial as 𝑝(𝑥) = 𝑎 + 𝑎 𝑥 and the normal equation
becomes ∫ √𝑥𝑑𝑥 = 𝑎 ∫ 𝑑𝑥 + 𝑎 ∫ 𝑥𝑑𝑥 ⟹ = 𝑎 +
∫ 𝑥√𝑥𝑑𝑥 = 𝑎 ∫ 𝑥𝑑𝑥 + 𝑎 ∫ 𝑥 𝑑𝑥 ⟹ = +
6a + 3a = 4
The simultaneous equation yields a = and a =
15a + 10a = 12
Therefore the linear polynomial approximation is (𝑥) = + x.
4.6. Application of interpolation
Introduction
The differentiation and integration are closely linked processes which are actually inversely
related. For example, if the given function 𝑦(𝑡) represents an objects position as a function of
time, its differentiation provides its velocity,
𝑑
𝑣 (𝑡) = 𝑦(𝑡)
𝑑𝑡
On the other hand, if we are provided with velocity 𝑣(𝑡) as a function of time, its integration
denotes its position.
𝑦(𝑡) = 𝑣(𝑡) 𝑑𝑡
There are so many methods available to find the derivative and definite integration of a
function. But when we have a complicated function or a function given in tabular form, then we
use numerical methods. In the present chapter, we shall be concerned with the problem of
numerical differentiation and integration.
4.6.1. Numerical Differentiation
The method of obtaining the derivatives of a function using a numerical technique is known as
numerical differentiation.
1. If the values of x are equi-spaced and is required
i. near the beginning of the table, we employ Newton's forward formula.
ii. near the end of the table, we use Newton's backward formula
2. If the values of 𝑥 are not equally spaced, we use Newton’s divided difference interpolation
formula or Lagrange’s interpolation formula to get the required value of the derivative.
1. Derivatives using Newton’s forward interpolation formula
Suppose the function 𝑦 = 𝑓(𝑥) is known at (𝑛 + 1) equispaced points 𝑥 , 𝑥 , … , 𝑥 and they are 𝑦 , 𝑦 , … , 𝑦 resp.
i.e., 𝑦 = 𝑓(𝑥 ), 𝑖 = 0, 1, … , 𝑛. Let 𝑥 = 𝑥 + 𝑖ℎ and 𝑢 = , where ℎ is the spacing.
Then, the Newton’s forward interpolation formula is given by
( ) ( )( )
𝑦 = 𝑦 + 𝑢∆𝑦 + ∆ 𝑦 + ∆ 𝑦 + ⋯ ……………………………….…. (*)
! !
Differentiating equation (*) with respect to 𝑢, we get
= ∆𝑦 + ∆ 𝑦 + ∆ 𝑦 +⋯ but, = =
! !
Therfore, = ∆𝑦 + !
∆ 𝑦 + !
∆ 𝑦 +⋯ …………..… (**)
Differentiating equation (**) again with respect to 𝑥, we get
27
Numerical method
𝑑 𝑦 𝑑 𝑑𝑦 𝑑𝑢 1 𝑑 𝑑𝑦
= =
𝑑𝑥 𝑑𝑢 𝑑𝑥 𝑑𝑥 ℎ 𝑑𝑢 𝑑𝑥
= ∆ 𝑦 + (𝑢 − 1)∆ 𝑦 + ∆ 𝑦 −⋯ …….. (***)
Equations (**) and (***) give the approximate derivatives of f(x) at arbitrary point x = x0 + uh.
When 𝑥 = 𝑥 , 𝑢 = 0, Eqs.(**) and (***) becomes
𝑑𝑦 1 1 1 1
= ∆𝑦 − ∆ 𝑦 + ∆ 𝑦 − ∆ 𝑦 + ⋯
𝑑𝑥 ℎ 2 3 4
𝑑 𝑦 1 11 5
= ∆ 𝑦 −∆ 𝑦 + ∆ 𝑦 − ∆ 𝑦 +⋯
𝑑𝑥 ℎ 12 6
Example: From the following table find the value of 𝑎𝑛𝑑 at the point x = 1.0
x 1 1.1 1.2 1.3 1.4 1.5
28
Numerical method
0.128
1.2 0.128 0.288
0.416 0.05
1.4 0.544 0.338 0
0.754 0.05 0
1.6 1.298 0.388 0
1.142 0.05
1.8 2.440 0.438
1.580
2.0 4.020
Since x = 1.1 is a non-tabulated point near the beginning of the table, we take
𝑥 = 1.0 and compute 𝑢 = .
.
.
= 0.5
Hence, = [∆𝑦 + ∆ 𝑦 + ∆ 𝑦 ]
( . ) ( . ) ( . )
= [0.128 + (0.288) + (0.05)] = 0.62958
.
𝑑 𝑦 1
= [∆ 𝑦 + (𝑢 − 1)∆ 𝑦 ] = ( [0.288 + (0.5 − 1)(0.05) = 6.575
𝑑𝑥 ℎ . )
29
Numerical method
= (−2 − − 2 − + + )=−
∆ ∆ ∆
𝑓 (5) = ∆𝑦 − + − ,ℎ = 2
𝑓 (3) = ∆ 𝑦 −∆ 𝑦 + ∆ 𝑦 − ∆ 𝑦 ,ℎ = 2
Exercise: From the following table of values, estimate 𝑦′(1.0) 𝑎𝑛𝑑 𝑦′′(1.0):
𝑥 1 2 3 4 5 6
𝑦 −4 3 22 59 120 211
30
Numerical method
i. Trapezoidal Rule
Putting 𝑛 = 1 in equation (**) and taking the curve 𝑦 = 𝑓(𝑥) through (𝑥 , 𝑦 ) and (𝑥 , 𝑦 ) as a
polynomial of degree one so that differences of order higher than one vanish, we get
1 ℎ ℎ
𝑓(𝑥) 𝑑𝑥 = ℎ 𝑦 + ∆𝑦 = [2𝑦 + (𝑦 − 𝑦 )] = (𝑦 + 𝑦 )
2 2 2
Similarly, ∫ 𝑓(𝑥) 𝑑𝑥 = (𝑦 + 4𝑦 + 𝑦 ), … , ∫ ( )
𝑓(𝑥) 𝑑𝑥 = (𝑦 + 4𝑦 +𝑦 )
Adding the above integrals, we get
ℎ
𝑓(𝑥) 𝑑𝑥 = [(𝑦 + 𝑦 ) + 2(𝑦 + 𝑦 + ⋯ + 𝑦 ) + 4(𝑦 + 𝑦 + ⋯ + 𝑦 )]
3
31
Numerical method
3ℎ
𝑓(𝑥) 𝑑𝑥 = [(𝑦 + 𝑦 ) + 3(𝑦 + 𝑦 + 𝑦 + ⋯ + 𝑦 ) + 2(𝑦 + 𝑦 + ⋯ + 𝑦 )]
8
which is known as Simpson’s three-eighth rule.
Note: To use this formula, the given interval must be divided into sub-intervals whose number 𝑛 is a multiple of 3.
-The total error of the Simpson’s three-eighth rule is 𝐸 = 𝑓 ( ) (𝜉), where 𝜉 ∈ [𝑎, 𝑏] (for 𝑛 subintervals of length ℎ).
- Simpson’s three-eighth rule is not as accurate as Simpson’s one-third rule.
.
Example: Evaluate the integral ∫ 𝑒 𝑑𝑥, up to 3 sign. digit and taking six sub-intervals using
i. Trapezoidal rule ii. Simpson’s 1/3rd rule iii. Simpson’s 3/8th rule
Solution: Here, we have 𝑎 = 0, 𝑏 = 1.2, 𝑛 = 6
𝑏 − 𝑎 1.2 − 0
ℎ= = = 0.2
𝑛 6
𝑥 0 0.2 0.4 0.6 0.8 1.0 1.2
𝑦 𝑦 𝑦 𝑦 𝑦 𝑦 𝑦
32