numerical-analysis-for-engineer
numerical-analysis-for-engineer
CH APT E R O N E
BASI C CO N CE PT S I N E RRO R E ST I M AT I O N
I ntroduction
N umerical technique is widely used by scientists and engineers to solve their problems. A major
advantage for numerical technique is that a numerical answer can be obtained even when a problem
has no analytical solution. H owever, result from numerical analysis is an approximation, in general,
which can be made as accurate as desired. The reliability of the numerical result will depend on an
error estimate or bound, therefore the analysis of error and the sources of error in numerical
methods is also a critically important part of the study of numerical technique.
1.1. E rrors and Approximations in Computation
A computer has a finite word length and so only a fixed number of digits are stored and used
during computation. This would mean that even in storing an exact decimal number in its
converted form in the computer memory, an error is introduced. This error is machine
dependent and is called machine epsilon. I n general, we can say that
= − .
Approximation of E rror numbers:
Exact number: number with which no uncertainly is associated to no approximation is taken.
E xample: 5, , . are exact numbers.
Page 1
11.685 to 11.68
1.2.3. T runcation E rror: These types of errors caused by using approximate formulae in
computation or on replace an infinite process by a finite one.
E xample: The Taylor’s series formula for finite terms
( )= ( )+ ( − ) ( )+ ( − ) ( )+⋯
1.2.4. Absolute error: is the numerical difference between the true value of a quantity and its
approximate value. Thus if is the approximate value of quantity then | − | is called
the absolute error and denoted by . Therefore = | − | . The unit of exact or unit
of approximate values expresses the absolute error.
Page 2
1.2.6. Percentage error: The percentage error in which is the approximate value of is given
by = 100 ∗ = 100 ∗ | |
. The percentage error is also independent of units.
E xample: Find the absolute, relative and percentage errors if is rounded-off to three
= = ∗ 100 = 0.33344.
E xample: I f = 0.51 and correct to two decimal places then ∆ = 0.005 and the relative
∆ .
accuracy is given by = × 100 = × 100 ≅ 0.98%
.
E xercise:
i. − +
ii. −
Page 3
+∆ = ( , ,…, )+ ∆ +∆ + ⋯+ ∆ +
(∆ ) + (∆ ) + ⋯ + (∆ ) + ⋯ ---------------------------------------- (1.3)
∆
Assuming the errors ∆ , ∆ ,…., ∆ in all are small and that ≪ 1 so that the terms containing
Equation (5) represents the general formula for E rrors. I f equation (5) divided by we get relative
∆ ∆ 1 ∆ 2 ∆
error = = + + ⋯+ ------------------------------------------------------------ (1.6)
1 2
Also from equation (5), by taking modulus we get maximum absolute error,
|∆ | ≤ ∆ 1 + ∆ 2 + ⋯+ ∆ --------------------------------------------------------- (1.7)
1 2
Page 4
that when the given numbers are added then the magnitude of absolute error is the sum of
the magnitudes of the + ∆ = ( + ∆ ) −( +∆ )
or +∆ = ( − ) + (∆ −∆ )
∆ ∆ 1 ∆ 2
∴ Absolute error is given by ∆ = ∆ −∆ and Relative error is = − .
Therefore, on taking modulus of relative errors and absolute errors to get its maximum
value, we have | ∆ | ≤ | ∆ 1 | + | ∆ 2 | which is the maximum absolute error and
∆ ∆ 1 ∆ 2
≤ + which gives the maximum relative error in subtraction of numbers.
1 … 1 1 … 1 1 … 1
N ow, = = , = = ,… , = =
1 … 1 2 … 2 …
∆ ∆ 1 ∆ 2 ∆
Therefore, = + + ⋯+
1 2
∆ ∆ ∆ ∆
⇒ = ≤ + + ⋯+ and
∆ ∆
= = ×( … )
1.3.4. E rror in D ivision of N umbers
∆ = ∆ 1 + ∆ 2 + ⋯+ ∆
1 2
∆ ∆ 1 ∆ 2 ∆ 1 1 ∆ 2 ∆ 1 ∆ 2
We have = + = 1 × + 1 × − 1
= −
1 2 2 2 1 2
2 2
∆ ∆ ∆
Therefore, the relative maximum error is ( ) = ≤ + and absolute error is
∆
= |∆ | ≤
Page 5
∆ = ∆ +∆ +∆
I n general, the errors ∆ , ∆ , ∆ may be negative or positive and hence we take the absolute
values of the terms of the right side.
This gives, ( ∆ ) = ∆ + ∆ + ∆
E xample 2: Evaluate the sum = √3 + √5 + √7 to four significant digits and find its absolute
and relative errors.
∆ ∆ ∆ ∆
∆ = ∆ or ∆ = . Similarly we get ∆ = , ∆ = ,… , ∆ = and so on.
E xample: The percentage error in which is given by = + , is not allowed to exceed 0.2%, find
∆
Solution: The percentage error in = × 100 = 0.2
. . . . . × .
Therefore ∆ = × = × + =
× .
Page 6
E xercise:
a. I f = 3 − 6 find the in at = 1, if the error in is 0.05.
i. + + +
ii. + 5 −
iii.
c. Find the product of the numbers 56.54 and 12.4 which both correct to the significant digits
given.
d. Find the quotient = , where = 4.536 and = 1.32 both and being correct to the
Page 7
CH APT E R T WO
N U M E RI CAL SO L U T I O N S O F N O N -L I N E AR E Q U AT I O N S
M ethod for finding the root of an equation can be classif ied as direct and I terative methods.
i. D irect method: in some cases, roots can be found by using direct/ analytical methods.
formula also available for cubic and bi-quadratic polynomial equations but we rarely
remember them. For higher order polynomial equations and non-polynomials it is
difficult and in many cases impossible to get closed form solutions.
ii. I terative method: those methods also known as trial and error methods are based on
the idea of successive approximation starting with one or more initial approximation to
the value of the root to obtain the accurate solution. The above quadratic equation can
be found by iterative method in the following manner.
a. = , = 0,1,2, …
b. = , = 0,1,2,…
c. = , = 0,1,2,…
Step3: I f ( )∗ ( ) < 0 then set = else = then apply the formula of step2.
Page 8
Step4: stop evaluation when the difference of two successive values of obtained from step2, is numerically less
( )
I f an error tolerance has been prescribed in advance, it is possible to determine the number of steps
required in the bisection method. Let be a root in ( , ) and | − |< implies < by
( ) ( )
taking logarithms (with any convenient base), we obtain > ----------------------- (2.1)
= ( ); = ( )
+
= ; = ( )
2
No
Is
. < 0
Yes No
Is
− Yes Stop
= ; = = ; = <
2
Page 9
E xample:
a. Using Bisection method find the real root of the equation ( ) = 3 − √1 + with the
1st approximation = = 0.5, ( 0.5) = 0.2837 > 0 so the root lies between 0 and 0.5.
.
2nd approximation = = 0.25, ( 0.25) = −0.3669 < 0 so the root lies between 0.25
and 0.5.
. .
3rd approximation = = 0.375, ( 0.375) = −0.0439 < 0 so the root lies between
( ) ( )
> = 16.6096, this implies that the minimum number of iteration is 17.
( = , ( ))
( = , ( ))
Page 10
The secant line over the interval [ , ] is the chord between ( , ( )) and ( , ( )) . The two right
angles in the figure are similar, which mean that = .
( ) ( )
( ) ( ) ( )( )
This implies that = ( )
= − ( )
------------------------------------------------------ (2.2)
( ) ( )
then we can compute ( ) and repeat the process with the interval [ , ] , if ( ) . ( ) < 0 or to
the interval [ , ] , if ( ) . ( ) < 0.
Step1: Choose two initial guess values (approx imations) and (where < ) such that
( )∗ ( ) < 0.
( ) ( )
Step2: F ind the nex t approx imation = ; and also evaluate ( ).
( ) ( )
Step3: I f ( )∗ ( ) < 0 set = then go to the nex t step if not, rename = and then go to the
nex t step.
( ) ( )
Step4: E valuate the successive approx imation using the formula = ( )
, = 2,3,…
( )
But before applying the formula for , ensure that whether ( ). ( ) < 0, if not rename as
and proceed.
Step5: stop the evaluation when | − |< , where is the prescribed accuracy.
E xample: Find a real root of the equation ( ) = − 3 using Regula-falsi method correct to
three decimal places.
( )= ( 1.0352) = −0.0852 thus, the root lies between = 1.0352 and = 1.5.
= 1.0498. H ence the approximate root is 1.0498 correct to three decimal places.
Page 11
= ( )
= ( )
= ( )
= ( )
Step3: F ollow the above procedure to find the successive approx imation
= ( ), = 1,2,3,…
Step4: Stop evaluation where relative error less than the prescribed accuracy .
When | ( )| > 1 ⟹ ( ) > 1 or ( ) < −1, then it is divergent, and then the iteration
Page 12
E xample1: Find the root of the equation = 3 − 1 correct to three decimal places
= ( )= ( 0 + 1) = 0.667
= ( )= [cos(0.667) + 1] = 0.5953
= 0.6072 → = 0.6071
N ow, & being almost the same. H ence the required root is given by 0.6071.
method.
We get = ( )= = 0.81649
√ .
= ( )= = 0.7419, … , = ( ) = 0.75487
√ .
Page 13
Tangent line
( )=
= ( )
( ) ( ) ( )
Form the figure = ( )= , ∴ − = , ⇒ = −
( ) ( )
( ) ( )
Still better approximation value = − ( )
in general, = − ( )
, = 0,1,2,….
The other way of interpreting N ewton’s method is the Taylor series at . Thus, we could write
( )
⇒ℎ= −
( )
( )
⇒ − = −
( )
( )
⇒ = −
( )
Page 14
step3: F ollow the above procedure to find the successive approx imation using the formula
( )
= − , = 1,2,3,….
( )
step4: Stop the process when | − |< where is the prescribed accuracy.
∗ ∗
( )= − = 0 such that | ( ) | < 10 , where is the initial approximation to the
root.
( )
= − ( )
= 0.53134337 , ( ) = −0.4180 × 10
( )
= − ( )
= 0.51790991 , ( ) = −0.4641 × 10
( )
= − ( )
= 0.51775738 , ( ) = −0.5926 × 10
( )
= − ( )
= 0.51775736 , ( ) = −0.2910 × 10
⇒ | −0.2910 × 10 | < 10
Page 15
Secant line
= ( )
= − ( )
( ) ( )
---------------------------------- (2.7)
, , ,…
This method is also called the modification of Regula-Falsi method.
Given function ( ) and two initial points , the formula is the same with Regula-Falsi
( ) ( )
method can be written as = − ( ) ( )
( ) ( )
This implies that the Secant formula is, = − ( ) ( )
, = 1,2,3,…
Page 16
, , =
( − ) ( )
= −
( )− ( )
= +
Page 17
E xample: Find a real root of the equation ( ) = − 3 using Secant method correct to
three decimal places.
Solution: We have ( ) = − 3 = 0 assume = 1 and = 1.5 as initial guess
values then ( 1) = −0.2817 and ( 1.5) = 3.7225 therefore the root lies b/ n 1 and 1.5.
( ) ( ) ( . ) .
= − ( ) ( )
= 1.5 − = 1.0352 ,
. ( . )
( )= ( 1.0352) = −0.0852
( ) ( ) ( . . )( . )
= − ( ) ( )
= 1.0352 −
(
= 1.0456,
. ) .
( )= ( 1.0456) = −0.0252
( ) ( ) ( . . )( . )
= − ( ) ( )
= 1.0456 − ( ) (
= 1.0500,
. . )
( )= ( 1.0500) = 0.0005
( ) ( ) ( . . )( . )
= − ( ) ( )
= 1.0500 − ( . ) ( . )
= 1.0499,
( )= ( 1.0499) = 0.0000
Therefore, the approximate real root of the equation ( ) = − 3 is 1.0499.
E xercise
1. Find the root of log = cos correct to two decimal places using Bisection method.
2. Use the Bisection method to find a root of the equation − 4 − 9 in the interval (2,3) ,
accurate to four decimal places.
3. H ow many number of iteration is needed is to find the solution of the equation
cos( )− + 2 = 0 on the interval [ 0,1] having with an accuracy less than = 0.0001
4. Given these three equations
i. − − 10 = 0
ii. − = 0
iii. +4 = 0
D etermine the initial approximation and use those to find the roots correct to three
decimal places with the following methods
a. Regula-Falsi method
b. Secant method
c. N ewton Raphson method
5. Find the approximate value of ( 17) Using N ewton Raphson method, correct to six decimal
places starting with = 2.
6. Find the root of the equations
i. − = 1
ii. −3 − + 2= 0
Page 18
CH APT E R T H RE E
SO L VI N G SYST E M O F L I N E AR AN D N O N -L I N E AR E Q U AT I O N S
3.1. D irect M ethods
Consider a system of linear equations in unknowns.
+ + ⋯+ =
+ + ⋯+ =
------------------------------------------------------------------- (3.1)
⋮
+ + ⋯+ =
Where ( , , = 1,2,3,…, ) , are the known coefficients.
( , = 1,2,3,…, ) , are the known values
( , = 1,2,3,…, ) , are unknown to be determined
I n the matrix notation, the system (3.1) can be written as
= ------------------------------------------------------------------------------------------------------ (3.2)
The matrix [ | ] is called the augmented matrix. Where is the column matrix and is the
× matrix. Therefore, the system of equation = can be directly solved in the following
cases.
i. = , the equation (3.2) become
=
=
----------------------------------------------------------------- (3.3)
⋱ ⋮
=
The solution is given by = , ≠0
, , ,…,
ii. = , the equation (3.2) become
=
+ =
+ + = --------------------------------------------------- (3.4)
⋮ ⋱ ⋮
+ + … + =
Solving the first equation and then successively solving the 2nd, 3rd and so on.
We obtain
( − ) ( − − )
= , = , = , …,
∑
= where ≠ 0, = 1,2,3,…,
This method of solving equation is called forward substitution method.
iii. = , the equation (3.2) become
Page 19
+ + … + =
+ … + =
+ … + =
----------------------------------------- (3.5)
⋱ ⋮
, + , =
=
Solving for the unknowns in the in the order , , …, , we get
− ,
−∑
= , = ,
, …, =
Page 20
Page 21
Partial pivoting
I n the 1st stage elimination: Search an element from the first column which is largest element
in magnitude and brought as the first pivot by interchanging the first equation with the
equation having largest element in magnitude, and the same for the 2nd stage elimination
among the − 1 elements leaving the first equation and the same for the 3rd stage
elimination among the − 2 elements leaving the first and second equations … and so on.
Additionally, to reduce round-off error; it is often necessarily to perform row interchanges
even when the pivot elements are not zero.
E xample: Using the four decimal places computer, solve
0.729 + 0.81 + 0.9 = 0.6867
+ + = 0.8338
1.331 + 1.21 + 1.1 = 1.0000
I ts exact solution rounded to four decimal places, is
= 0.2245 , = 0.2814 & = 0.3279
Solution without pivoting
0.729 0.81 0.9 0.6867
1 1 1 0.8338
1.331 1.21 1.1 1.0000
= = 1.372 and ← −
= = 1.826 & ← −
( )
= ( ) = 2.423 and ← −
Page 22
↔ , = = 0.7513 and ← −
= = 0.5477 ← −
( )
↔ , = ( ) = 0.6171 and ← −
2 0.33 34
3 0.333 4
4 0.3333 1
5 0.33333 0.7
6 0.333333 0.67
7 0.3333333 0.667
8 0.33333333 0.6667
The exact solution of this problem is = and = .
Round-off errors can never be completely eliminated. H owever, they can be minimized
by using high precision arithmetic and pivoting.
Page 23
b. System Condition
A system of equations = is said to be ill-conditioned or unstable if it is highly sensitive to
small changes in and i.e., small change in or causes a large change in the solution of
the system. On the other hand if small changes in and give small changes in the solution,
the system is said to be stable, or, well conditioned. Thus in an ill-conditioned system, even the
small round off errors effect the solutions very badly. Unfortunately it is quite difficult to
recognize an ill-conditioned system.
E xample: Consider the following two almost identical systems
− = 1 − = 1
and
− 1.00001 = 0 − 0.99999 = 0
The respective solutions are: (100001,100000) and (– 99999,– 100000)
Obviously the two solutions differ very widely as the result of small change in the value of .
Therefore, the system is ill conditioned.
+ + = 1
4 +3 − = 6
3 + 5 + 3 = 4
1 1 1 0 0 1
4 3 −1 = 0 0 1
3 5 3 0 0 1
= + +
+ + +
Page 24
= 1, = 4, = 3, = −1 , = 2, = −1 and
= 1, = 1, = 5
Page 25
× + × = −5 ⇒ 4 = −12 ⇒ = −3
× + × + × = 83 ⇒ ( ) = 25 ⇒ = 5
N ow we have to solve = , that is,
2 0 0 14
1 4 0 = −101
7 −3 5 155
7
Solving the system, then the solution is = −27
5
At the second step, we have to solve = = , that is,
2 1 7 7
0 4 −3 = −27
0 0 5 5
3
Solving the system using backward substitution, then the solution is = −6
1
Page 26
4 + + = 2
+ 5 +2 = −6 Using Jacobi iteration method
+ 2 +3 = −4
Page 27
Page 28
Page 29
Solution:
Step 1: Compute the characteristic polynomial
1− 2 3
det ( − )= 0 5− 6 = (1 − ) [ (5 − ) − 36]
0 6 5−
= (1 − )( −1 − )(11 − )
Step 2: The Eigen-values are = 11, = 1, = −1.
Step 3: Compute corresponding eigenvectors
For = 11, we have
1− 2 3 −10 2 3
( − ) = 0 5− 6 = 0 −6 6 = 0
0 6 5− 0 6 −6
1
⇒ = = 2
2
For = 1, we have
1− 2 3 0 2 3
( − ) = 0 5− 6 = 0 4 6 = 0
0 6 5− 0 6 4
1
⇒ = = 0
0
For = −1, we have
1− 2 3 2 2 3
( − ) = 0 5− 6 = 0 6 6 = 0
0 6 5− 0 6 6
1
⇒ = = 2
−2
Page 30
The results of the first two iterations presented above and subsequent iterations are
presented in Table. These results were obtained on a 13-digit precision computer. The
iterations were continued until changed by less than 0.000001 between iterations. The
final solution for the largest eigenvalue, denoted as , and the corresponding
eigenvector is
Page 31
Page 32
( )
Solution: Assume = [ 1.0 1.0 1.0] . Scale the first component of to
unity. The first step is to solve for and by the D oolittle method. The results are
1 0 0 8 −2 −2
= 1 0 and = 0
1 0 0
( )
Solve for by forward substitution using =
1 0 0
⎡−1 ⎤
1.0
⎢ 1 0⎥
⎢4 ⎥ = 1.0
⎢−1 −5 ⎥ 1.0
⎣4 1⎦
7
= 1.0
−1 5
= 1.0 − ( 1.0) =
4 4
−1 −5 5 15
= 1.0 − ( 1.0) − =
4 7 4 7
( ) ( )
Solve for =
by back substitution using
8 −2 −2 1.0
⎡ 7 − 5⎤ ⎡5⎤
⎢0 ⎥ ⎢ ⎥
⎢ 2 2 ⎥ = ⎢4⎥
⎢ 75 ⎥ ⎢ 15 ⎥
⎣0 0 7 ⎦ ⎣7 ⎦
= [ 1.0 − ( −2.0)( 0.5) − ( −2) (0.2) ] ⁄8 = 0.30
5 5
= − − (0.2) (7⁄2) = 0.50
4 2
15 75
= ( ) ( ) = 0.20
7 7
( )
Scale so that the unity component is unity.
0.30 1.00000
( ) ( ) ( )
= 0.50 = 0.300000 = 1.66667
0.20 0.66667
The results of the first iteration presented above and subsequent iterations are presented
in the Table below. These results were obtained on a 13-digit precision computer. The
iterations were continued until changed by less than 0.000001 between
iterations. The final solution for the smallest eigenvalue and the corresponding
eigenvector is = = = 2.508981 and
.
= [ 1.000000 2.145797 0.599712] Therefore, to generalize in table
Page 33
⋮ ⋮ ⋮ ⋮ ⋮
12 0.398568 1.000000 2.145796 0.599712
13 0.398568 1.000000 2.145796 0.599712
Page 34
Or ( )
= ( )
− ( )
----------------------------------------------------------------------- (3.32)
( ) ( ) ( ) ( )
where ( )
= ( )
, ( )
, = , , , ( )
The method given by (3.32) is called N ewton’s method to the system of 2 × 2 equations.
This method can be easily generalized for solving a system of equations in unknowns.
(
, ,…, ) = 0
(
, ,…, ) = 0
--------------------------------------------------------------------------------------- (3.33)
……………
( , ,…, ) = 0
Or ( ) = 0 where = [ , ,…, ] and = [ , ,…, ]
( ) ( ) ( ) ( )
If = , ,…, is an initial approximation to the solution vector then we can write
the method as ( )
= ( )
− ( )
, = 0,1,2,…------------------------------------------ (3.34)
⁄ ⁄ ,…, ⁄
⁄ ⁄ ,…, ⁄
where = is the Jacobian matrix of the functions
⋮ ,⋯ , ⋮
⁄ ⁄ ,…, ⁄ ( ( ))
( )
, ,…, evaluated at .I f the method converges, then its rate of convergence is two.
The iterations are stopped when ( )
− ( )
< , where is the error tolerance.
E xample1: Perform three iterations of the N ewton-Raphson method to solve the system of
+ + = 7
equations Take initial approximation as = 1.5 & = 0.5
+ = 9
Solution:
( )= + + −7= 0
( )= + −9= 0
( , ) ( , ) 2 + + 2
= =
( , ) ( , ) 3 3
3 −( +2 )
= where = | |= 3 (2 + ) −3 ( + 2 )
−3 2 +
We can write now the method as
3 −( + 2 ) + + −7
1
⇒ = − , = 0,1,2,…
−3 2 + + −9
Using ( , ) = (1.5,0.5) , we get
1.5 1 0.75 −2.5 −3.75 2.2675
= − =
0.5 −14.25 −6.75 3.5 −5.50 0.9254
2.2675 1 2.5691 −4.1183 1.0963 2.0373
= − =
0.9254 −49.4951 −15.4247 5.4604 3.4510 0.9645
2.0013
=
0.9987
E xample2: Solve the system by N ewton’s method
10 + sin( + ) = 1
8 − ( − )= 1
12 + = 1
Take one step form a suitable starting point. To obtain a suitable starting point, we use the
approximation sin( + ) ≈ 0 ,cos( − ) ≈ 1 & ≈ 0 for the system of equations
Page 35
Page 36
Page 37
E xercise
1. Solve the following system of equations using Gauss-Elimination method
− + = 1 + 3 +6 = 2
(a) −3 + 2 − 3 = −6 (b) −4 + 2 = 7
2 −5 + 4 = 5 3 − +4 = 9
5 + + + = 1
+ 7 + + = 12
c)
+ + 6 + = −5
+ + + = −6
2. Solve the following set of simultaneous linear equations by the matrix inverse method
2 + 3 − = 1
a. − +2 + = 8
− 3 − 2 = −13
− +3 − = 1
−3 + 5 = 2
b.
− + = 0
+ 2 − = −5
3. Solve the following set of simultaneous linear equations using the LU decomposition method
+ + = 9
i. 2 −3 + 4 = 13
3 + + 5 = 40
2 + − = 6
ii. −3 + 5 = 11
− +5 + 4 = 13
4. Solve the following set of simultaneous linear equations using Jacobi and Gauss-Seidal iteration
method
2 − + 5 = 15
a. 2 + + = 7
+ 3 + = 10
5 + 2 + = 12
b. + 4 + 2 = 15
+ 2 + 5 = 20
4 + 2 = 4
2 +8 +2 = 0
c.
2 + 8 + 2 = 0
3 + 4 = 14
5. Solve the following systems of non-linear equations by any suitable method
+ = 11
a.
+ = 7
= 3 −7
b.
= 2( + 1)
+ + =
c. + = 1
+ =
Page 38
CH APT E R FO U R
I N T E RPO L AT I O N
The word interpolation denotes the method of computing the intermediate
(approximate) values of the function = ( ) for an between different - values
, ,…, at which the values of ( ) are given.
Or, given( , ) , ( , ) , ( , ) , …,( , ) , find the values of ‘ ’ at a values of ‘ ’
in ( , ) is called interpolation.
The process of computing the value of the function outside the given range is called
ex trapolation.
Polynomials are most common choice of interpolation because they are easy to
evaluate, differentiate and integrate.
I nterpolation is required in many engineering and science applications that use tabular
data as input.
The polynomial through a specific set of points may take many different forms, but all forms are
equivalent. Any form can be manipulated into any other form by simple algebraic rearrangement
The Taylor series is a polynomial of infinite order. Thus,
( )= ( )+ ( )( − )+ ( )( − ) + ( )( − ) + ⋯----------- (4.1)
! !
I t is of course, impossible to evaluate an infinite number of terms. The Taylor polynomial of degree
is defined by
( )= ( )+ ( ) ------------------------------------------------------------------------------------- (4.2)
where the Taylor polynomial ( ) , and the remainder term ( ) are given by
( )= ( )+ ( )( − )+ ( )( − ) + ⋯+ ( )( )( − ) --------- (4.3)
! !
( )= ( )( )( − ) ≤ ≤ ----------------------------------------------- (4.4)
( )!
Page 39
∆
∆
∆ ∆
∆ ∆
∆ ∆ ∆
∆ ∆
∆ ∆
∆
∆
The above table is called a diagonal difference table. The first difference term in the table
,∆ ,∆ ,∆ …, ∆ are called the leading differences.
Alternative N otation of forward difference operator is ∆ ( ) = ( + ℎ) − ( )
This follows that ∆ ( + ℎ) = ( + ℎ + ℎ) − ( + ℎ) = ( + 2ℎ) − ( + ℎ)
Similarly, ∆ ( ) = ∆[ ∆ ( ) ]
= ∆[ ( + ℎ) − ( )]
= ∆ ( + ℎ) − ∆ ( )
Page 40
= ( + 2ℎ) − ( + ℎ) − [ ( + ℎ) − ( )]
= ( + 2ℎ) − 2 ( + ℎ) + ( )
∆ is called the second difference of ( ) and ℎ is the step size.
∇
∇
∇ ∇
∇ ⋮
∇ ⋮ ∇ ∇
⋮ … ∇
⋮ ∇ …
⋮ ⋮ ∇ ∇
∇ ∇
∇
The last difference terms in the table , ∇ , ∇ ,∇ ,…. ∇ y can be considered as the
leading differences of the backward difference.
Alternative N otation of backward difference operator is ∇ ( ) = ( ) − ( − ℎ)
We can observe that ∇ ( + ℎ) = ( + ℎ) − ( ) = ∆ ( )
∇ ( + 2ℎ) = ( + 2ℎ) − ( + ℎ) = ∆ ( + ℎ)
⋮
∇ ( + ℎ = ( +
) ℎ ) − ( + ( − 1) ℎ ) = ∆ ( + ( − 1) ℎ )
Similarly we get, ∇ ( + 2ℎ) = ∇[ ∇ ( + 2ℎ) ]
= ∇[ ∆ ( + ℎ) ]
= ∆[ ∇ ( + ℎ)]
= ∆[ ∆ ( )]
Page 41
= ∆ ( )
⋮
∇ ( + ℎ) = ∆ ( )
⁄ = − --------------------------------------------------------- (4.13)
…
= ⁄ − ⁄
⁄ ⁄
⁄ ⁄
The values
⁄ ⁄
…
⁄ ⁄
Page 42
b. T he D ifferential operator
Let = ( ) be function of and denotes the differential coefficient of with respect
to where = . we have = = ( ) . The derivative of with respect to is
( )
denoted by = = ( ).
c. T he M ean operator
I n addition to the operator ∆, ∇, , & we define the mean operator (averaging operator)
as ( )= + ℎ + ( − ℎ) .
4.1.5. Relationship of the operators
Relationship the operator and ∆: ∆ ( ) = ( + ℎ) − ( ) where ℎ is the interval of
differencing. Using the operator we can write
∆ ( )= ( )− ( )
⇒ ∆ ( ) = ( − 1) ( )
The above relation can be expressed as an identity.
∆= − 1
i.e. = ∆+ 1
Relationship the operator , and ∆: From the definition we have
( ) = ( + ℎ)
= ( )+ ( )+ ( )+ ⋯
! !
= ( )+ ( )+ ( )+ ⋯
! !
(Expanding by Taylor’s series method)
= 1+ + + ⋯ ( )
! !
( )=∴ ( )
H ence, the identity is = .
We have already proved that = ∆ + 1 and = . Apply the algorithm,
Page 43
We get
∆ ∆ ∆
⇒ℎ = = [ 1 + ∆] = ∆ − + − +⋯
∆ ∆ ∆
⇒ = ∆− + − + ⋯ .
Relation between & ∇: ∇ ( ) = ( ) − ( − ℎ ) = ( )− ( )
⇒ ∇= 1 −
∇=
Relation between the operators ∆ , , & : From the definition we know that
( )= + ℎ − − ℎ
i. ( )= + ℎ − − ℎ
⁄ ( )− ⁄ ( )
=
⁄ ⁄
= − ( )
⁄ ⁄
∴ = −
⁄ ( − 1) ( ) = ⁄
Further ( )= ∆ ( )
⁄
∴ = ∆
And from the mean operator result we get
⁄
= ∆
ii. ( )= + ℎ + − ℎ
⁄ ⁄ ( )
= +
1 ⁄ ⁄
∴ = +
2
iii. ∇ ( )= [ ( ) − ( − ℎ)]
= ( )− ( − ℎ)
= ( + ℎ) − ( ) = ∆ ( )
∴ ∇= ∆
and ∇ ( ) = ∇ ( + ℎ)
= ( + ℎ) − ( ) = ∆ ( )
⇒ ∇ = ∆
∴ ∇= ∇
Page 44
Page 45
Solution:
⁄ ⁄ ⁄
a. since 1 + ∆= therefore + = + 1= 1+ ∆+ 1= ∆+ 2
∆ ∇ ( )
b. − = − = − = − = ( − )
∇ ∆ ( )
= {( 1 + ∆) − ( 1 − ∇)} = ( ∆ + ∇)
∆ ∇
H ence, − = ∆ + ∇.
∇ ∆
Page 46
Assume =
(
)= =
When =
( )= = + ( − )= + ℎ
− ∆
= =
ℎ ℎ
When =
( )= = + ( − )+ ( − )( − )
−
= + ( 2ℎ) + ( 2ℎ)( ℎ) = + 2( − )+ ( 2ℎ )
ℎ
− 2( − )− −2 + ∆
⇒ = = =
2ℎ 2ℎ 2! ℎ
⋮
∆
⇒ = , = 3,4,5,…
!
Substitute the values in (4.14) we get
∆ ∆
( )= + ( − )+ ( − )( − ) + ⋯.
!
∆
+ ( − )( − ) …( − ) ------------------------------- (4.15)
!
Setting = then − = ℎ
− − + = − = − −( − )= ℎ − ℎ = ( − 1) ℎ
Similarly, − = ( − 2) ℎ
− = ( − 3) ℎ
⋮
− = ( − ( − 1) ) ℎ
Equation (4.15) reduces to
( )
( )= + ∆ + ∆ + ⋯.
! !
( )…( ( ))
+ ∆ ------------------------------------ (4.16)
!
The above formula is called N ewton’s forward interpolation formula.
I t is useful for interpolating near the beginning of the tabular values.
The error term for the N ewton forward-difference polynomial can be obtained from the
general error term equation (4.13)
( )= ( − )( − ) …( − ) ( )( )
( )!
We know that − = ℎ, − = ( − 1) ℎ,… , − = ( − ( − 1) ) ℎ
Therefore the error term can be written as
( )= ( − 1)( − 2) …( − ) ℎ ( )( ) ---------------------- (4.17)
( )!
Page 47
Page 48
Page 49
The above formula (4.20) is called N ewton’s back ward interpolation formula.
I t is useful for interpolating near the end of the tabular values.
The error term of backward interpolation is also can be written as
( )= ( + 1)( + 2) …( + )ℎ ( )( ) ---------------------- (4.21)
( )!
E xample: The area of a circle of diameter is given for the following values.
80 85 90 95 100
5026 5674 6362 7088 7854
Page 50
10 11 12 13 14
10 23967 28060 31788 35209 38368
= 10 23967
4093
= 11 28060 −365
3728 58
= 12 31788 −307 −13
3421 45
= 13 35209 −262
3159
= 14 38368
= 12.2 − 12 = 0.2 ≤ 0.5
( )
0.2 1 ( 1 1.2 0.2 ( −307)
= 31788 + 3421 + 3728) + +
1 2 2 2 2
1
1.2 ( 1 2.2 1.2 (
+ 45 + 58) + + −13)
3 2 2 4 4
Page 51
( )
= 31788 + ( 0.1)( 7149) + ( 0.02)( −307) + ( −0.016)( 103)
+ ( −0.0016)( −13)
1, =
( )= ∏ and ( )=
0, ≠
I n general,
( )( )…( )
⎧ ( ) +
( )( )…( )
⎪ ( )( )…( )
( )= ( ) + ⋯ + ------------------------------------------------ (4.23)
⎨ ( )( )…( )
⎪ ( )
( )( )…( )
⎩ ( )( )…( )
I n short this one can be written as
( )= ( ) ( )+ ( ) ( ) + ⋯+ ( ) ( ) ------------------------------------ (4.24)
Page 52
E xample1: Construct the linear Lagrange interpolation polynomial that pass through the
points (2,4) and (5,1) .
Solution: ( )= = ( − 5) and ( )= = ( − 2)
So that ( )= ( ) ( )+ ( ) ( )
= ( − 5)( 4) + ( − 2)( 1)
= − +6
(2,4)
(5,1)
Page 53
E xample2:
a. Use the number (called nodes) = 2.75 & = 2, = 4 to find the second
Lagrange interpolating polynomial for ( ) = 1⁄ .
b. Use this polynomial to approximate ( 3) = 1⁄3.
Solution:
a. We first determine the coefficient polynomials ( ), ( )& ( ) . I n nested form
( . )( )
they are ( )= = ( − 2.75)( − 4)
( . )( )
( )( )
( )= = ( − 2)( − 4)
( . )( . )
( )( . )
and ( )= = ( − 2)( − 2.75)
( )( . )
Also, ( ) = ( 2) = 1⁄2 , ( )= ( 2.75) = 4⁄11 ( )= ( 4) = 1⁄4,
So, ( )= ∑ ( ) ( )
= ( − 2.75)( − 4) − ( − 2)( − 4) + ( − 2)( − 2.75)
= − +
b. An approximate to ( 3) = 1⁄3 is
9 105 49
( 3) ≈ ( 3) = − + ≈ 0.32955
22 88 44
Page 54
The advantage of the above method is that there is no need to start all over again if their
additional pairs of data are added. We simply need to compute additional divided
differences.
Since order polynomial interpolation of a given ( + 1) pairs of datais unique, thus the
above polynomial and Lagrangian polynomial are exactly the same.
E xample: Use N ewton’s D ivided D ifference formula and evaluate (3.0) , given
3.2 2.7 1.0 4.8 5.6
22.0 17.8 14.2 38.3 51.7
Solution:
( ) [ , ] [ , , ] [ , , , ] [ , , , , ]
3.2 .
.
2.7 17.8 .
2.118 − .
1.0 14.2 2.012 .
6.342 0.0865
4.8 38.3 2..63
16.750
5.6 51.7
The third degree polynomial fitting all points from = 3.2 to = 4.8 is given by
( )= + ( − )+ ( − )( − ) + ( − )( − )( − )
Page 55
( , )
( , )
( , )
( , )
( , )
Page 56
E xample: The upward velocity of a rocket is given as a function of time in the table
below.
Find the velocity at = 16 seconds.
, , / , , /
0 0 0 0
10 227.4 rewrite in to 10 227.4
20 517.35 15 362.78
15 362.78 ascending 20 517.35
22.5 602.97 22.5 602.97
30 901.67 30 901.67
Solution:
−
( )= + ( − ) , ≤ ≤
−
. .
= 362.78 + ( − 15) , 15 ≤ ≤ 20
= 362.78 + 30.913( − 15) , 15 ≤ ≤ 20
( 16) ≈ 362.78 + 30.913( 16 − 15)
= 393.7 ⁄
The most common piecewise polynomial approximation uses cubic polynomials between
each successive pair of nodes is called cubic spline interpolation.
( )
…
N ow we have
+ 1 grid points , ( = 0,1,…, )
intervals ≤ ≤ , ( = 0,1,…, − 1)
cubic spline ( ) , ( = 0,1,…, − 1)
− 1 interior grid points , ( = 0,1,…, − 1)
4 coefficient to be determined
Page 57
Page 58
⇒ ( )= --------------------------------------------------------------------------------------- (4.35)
( ) ( )
= ( )= − ( +2 ) ----------------------------------------------- (4.36)
But ( ) the slope for the last subinterval is
( )= 3 ℎ +2 ℎ + ---------------------------------------------------- (4.37)
After using , and
( )= 3 ( − )ℎ +2 ℎ .
( ) ( )
+ − ( +2 )
( ) ( )
⇒ ( )= + ℎ -------------------------------------------- (4.38)
+ ( − ) ( )−
Equation (4.41) gives the cubic spline interpolation while equation (4.40) gives the condition
for .
Remark: ( )= ( ) = 0 (Free or N atural spline) and this one is the most common
boundary condition.
E xample: Find the natural spline interpolating for the given data
0 1 2 3
( ) 1 2 33 244
Page 59
+ 4 + = [ 33 − 2(2) + 1]
Solution: We have ℎ = 1,
+ 4 + = [ 244 − 2(33) + 2]
4 + = 180
⇒
+4 = 1056
Solving this system and then = −24 and = 276
1
( )= [( − ) + ( − ) ]
6
+( − ) ( )−
+( − ) ( )−
1
( )= [( 1 − ) (0) + ( − 0) ( −24) ]
6
+ ( 1 − ) 1 − (0)
+ ( − 0) 2 − ( −24)
= 4 + 5 + 1, 0≤ ≤1
1
( ) = [( − ) + ( − ) ]
6
+( − ) ( ) −
+( − ) ( )−
1
( )= [( 2 − ) ( −24) + ( − 1) (276) ]
6
+ ( 2 − ) 2 − ( −24)
+ ( − 1) 33 − ( 276)
= 50 − 162 + 167 − 53, 1≤ ≤2
1
( ) = [( − ) + ( − ) ]
6
+( − ) ( )−
+( − ) ( )−
1
( )= [( 3 − ) (276) + ( − 2) (0) ]
6
+ ( 3 − ) 33 − (276)
+ ( − 2) 244 − ( 0)
= −46 + 414 − 985 + 715, 2≤ ≤3
( 2.5) = −46(2.5) + 414(2.5) − 985( 2.5) + 715
( 2.5) = . ≈ (2.5)
Page 60
E xercise
∆
1. Evaluate
2. Show that = +∆ + ∆ + ∆
3. I f ( ) = 2 − + 3 + 1 then show that ∆ ( ) = 12 + 10
4. Find the missing figures in the following table
0 5 10 15 20 25
7 11 18 32
9. Use the following table to evaluate 16° and compare with the exact value.
° 0° 5° 10° 15° 20° 25° 30°
° 0 0.0875 0.1763 0.2679 0.3640 0.4663 0.5774
10. Construct the natural cubic spline for the following data.
( )
0.1 −0.62049958
0.2 −0.28398668
0.3 0.00660095
0.4 0.24842440
11. Use the divided-difference method to obtain a polynomial of least degree that fits the
values shown.
a. 0 1 2 −1 3 b. 1 3 −2 4 5
( ) −1 −1 −1 −7 5 ( ) 2 6 −1 −4 2
Page 61
12. The following table gives the normal weights of babies during the first 12 months of life:
Age in months 0 2 5 8 10 12
Weight in lbs. 7.5 10.25 16 18 18 21
Find the weight of babies during 6.1 month of life.
13. A natural cubic spline is defined by
( ) = 1+ ( − 1) − ( − 1) 1≤ ≤2
( )= 3
( ) = 1 + ( − 2) + ( − 2) + ( − 2) 2≤ ≤3
4
If is interpolates the data(1,1),(2,1) , and (3,0) , find , , , and .
Page 62
CH APT E R FI VE
L E AST SQ U ARE M E T H O D
= +
To answer this question, suppose that a guess is made about the correct values of
and . This is equivalent to deciding on a specific line to represent the data. I n general,
the data points will not fall on the line = + . I f by chance the datum falls on
the line, then
+ − = 0
I f it does not, then there is a discrepancy or error of magnitude
| + − |≠0
The total absolute error for all ( + 1) points is therefore
( , )= ∑ | + − |
I n practice, it is common to minimize a different error function of and :
( , )= ∑ ( + − ) ------------------------------------------------------------- (5.3)
Page 63
E xample1: Find the linear least-squares solution for the following table for the values
4 7 11 13 17
2 0 2 6 7
Plot the original data points and the line using a finer set of grid points.
Solution: To find the values of the normal equations using table
N umber of data
0 4 2 8 16
1 7 0 0 49
2 11 2 22 121
3 13 6 78 169
4 17 7 119 289
+ 1= 5
= 52 = 17 = 227 = 644
644 + 52 = 227
52 + 5 = 17
Solving the system of equations, we get = 0.4864 and = 1.6589
Therefore, the linear line that fit the given data points is = 0.4864 − 1.6589
The sum of the total error squares will be obtained as
( , ) = ∑ ( 0.4864 − 1.6589 − )
= 2.9354 + 3.0482 + 2.8612 + 1.7841 + 0.1522 = 10.7813
Page 64
E xample2: Find the best fit values of and so that = + fits the data given in
the table
0 1 2 3 4
1 1.8 3.3 4.5 6.3
E xample: Fit the data below with the discrete least squares polynomial of degree at
most 2.
1 0 1.0000
2 0.25 1.2840
3 0.50 1.6487
4 0.75 2.1170
5 1.00 2.7183
Page 65
Solution: For this problem, = 2, = 5, and the three normal equations are
∑ + ∑ + ∑ = ∑
∑ + ∑ + ∑ = ∑
∑ + ∑ + ∑ = ∑
5 + 2.5 + 1.875 = 8.7680
2.5 + 1.875 + 1.5625 = 5.4515
1.875 + 1.5625 + 1.3828 = 4.4015
Solving the system of equations gives
{ = 0.9268, = 0.6401}
= 1.1383,
Thus the least squares polynomial of degree 2 fitting the data in the above table is
( ) = 0.9268 + 1.1383 + 0.6401
The total error use this table
1 2 3 4 5
0 0.25 0.50 0.75 1.00
1.0000 1.2840 1.6487 2.1170 2.7183
( ) 0.9268 1.2514 1.6560 2.1406 2.7052
− ( ) 0.0732 0.0326 −0.0073 −0.0236 0.0131
b. E xponential
Suppose an exponential curve of the form =
Taking logarithm on both the sides,
We get log = log + log --------------------------------------------------------- (5.6)
That is, = + where = log , = log , = log
The normal equation for (5.6) is,
∑ = + ∑
---------------------------------------------------- (5.7)
∑ = ∑ + ∑
On solving the above two equations, we get and .
Page 66
Then = log , =
E xample: Fit a curve = to the following data:
x 2 3 4 5 6
y 144 172.8 207.4 248.8 298.5
⇒ ∑ = ∑ + ∑ ---------------------------------------------------- (5.8)
and = 0 ⟹∑ 2 − − (− )= 0
⇒ ∑ = ∑ + ∑ ----------------------------------------------- (5.9)
D ropping the suffix in (5.8) and (5.9) then the normal equations are,
Page 67
∑ = ∑ + ∑
√
--------------------------------------------------------------- (5.10)
∑ √ = ∑ + ∑
√
E xample: Use the method of least squares to fit the curve = + √ to the
following table of values:
0.1 0.2 0.4 0.5 1 2
21 11 7 6 5 6
Solution:
√ 1 1 √
√
0.1 21 0.3162 3.1623 100 210 6.6402
0.2 11 0.4472 2.2361 25 55 4.9192
0.4 7 0.6324 1.5811 6.25 17.5 4.4268
0.5 6 0.7071 1.4142 4 12 4.2426
1 5 1 1 1 5 5
2 6 1.4142 0.7071 0.25 3 8.4852
1 1
√ √
√
= 4.2 = 4.5171 = 10.1008 = 136.5 = 302.5 = 33.714
∑ = ∑ + ∑
√ 302.5 = 136.5 + 10.1008
⇒
∑ √ = ∑ + ∑ 33.714 = 10.1008 + 4.2
√
Solving the system of equations we get = 1.9733 and = 3.2815
.
H ence the required curve fit equation is = + 3.2815√ .
Page 68
Since = ∫ [ ( )] − 2∑ ∫ ( ) + ∫ (∑ )
We have, = −2 ∫ ( ) + 2∑ ∫
H ence to find ( ) , the ( + 1) normal equations
∑ ∫ = ∫ ( ) for each = 0,1,…, --------------------------- (5.12)
We will be solved for ( + 1) unknown . The difficulties in obtaining least squares
polynomial approximation ( + 1) × ( + 1) linear system for unknowns , ,. .,
must be solved and the coefficients in the linear system are of the form
⎡1 ⎤ ⎡ ⎤
⎢ ⎥ ⎢ ⎥
⎢ ⎥ = ⎢ ⎥
⎢ ⎥ ⎢ ⎥
⎣ ⎦ ⎣ ⎦
We get = ≈ −0.050465 = − = ≈ 4.12251
Consequently, the least square approximating polynomial of degree 2 for the function
( )= on the interval [0,1] is
( ) = −0.050465 + 4.12251 − 4.12251
Page 69
N ow however, assume that we have five times the confidence in the accuracy of the
final two data points, relative to the other points.
D efine a square weighting matrix :
1 0 0 0 0
⎛0 1 0 0 0⎞
= ⎜0 0 1 0 0⎟
0 0 0 5 0
⎝0 0 0 0 5⎠
N ow we perform the following operations:
∗ =
∗ ∗ = ∗
( ∗ ) ∗( ∗ ) ∗ = ( ∗ ) ∗ ∗
= [( ∗ ) ∗ ( ∗ )] ∗ ( . ) ∗ ( ∗ )
= [ ∗ ] ∗ ∗ ----------------------------------- (5.13)
0.1365
=
1.5105
Then the best fit estimate is = 0.1365 + 1.5105
b. Weighted L east Square for continuous functions
D efinition: An integrable function ( ) is called a weight function on the interval if
( ) ≥ 0 for allin , but ( ) ≠ 0 on any subinterval of .
The purpose of a weighted function is to assign varying degrees of important to
approximations on a certain portions of the interval.
The function which are continuous on [ , ] and are given explicitly, we have
= ∫ ( )[ ( ) − ( )]
Where ( )= + + ⋯+ + = ∑
⇒ = ∫ ( ) ( )−∑ = minimum
The necessarily condition is to have a minimum value is that = 0, = 0,1,. .,
This gives a system of ( + 1) unknown , ,…, . These equations are called
normal equations. The normal equation become
Page 70
= −2 ∫ [( 1 + 2 ) −( + + )] = 0
= −2 ∫ [( 1 + 2 ) −( + + )] = 0
This gives
⎧ + + =
⎪ 2 3
⎪
−
+ + =
⎨ 2 3 4 2
⎪
⎪ 2 −3
⎩3 + + =
4 5 6
Solving the system of equations
= 1.9549, = −0.6079, = 0.0000
( ) = 0.0000 − 0.6079 + 1.9549
For = 2 and ( ) =
We have = ∫ [( 1 + 2 )−( + + )]
The normal equations are
= −2 ∫ [( 1 + 2 ) −( + + )] = 0
= −2 ∫ [( 1 + 2 ) −( + + )] = 0
= −2 ∫ [( 1 + 2 ) −( + + )] = 0
This gives
⎧ + + =
⎪
+ + =
⎨
⎪
⎩ + + =
Solving the system of equations
= 3.4441, = −2.5040, = 0.5029
( ) = 0.5029 − 2.5040 + 3.4441
Page 71
E xercise:
1. Fit a straight line = + to the following data by method of least square
0 1 3 6 8
1 3 2 5 4
2. Fit the second degree parabola to the following data by the least square method
1 2 3 4 5
1090 1220 1390 1625 1915
4. A pressure and volume of gas are related by the equation = ( and are
constants). Fit this equation to for the data given below
0.5 1.0 1.5 2.0 2.5 3.0
1.62 1.0 0.75 0.62 0.52 0.46
5. Find the normal equations that arise from filling by the least squares method, an
equation of the form = sin , to set of points ( 0,0) , , 1 , ( , 3) and
( ,2) solve for and .
6. Find the linear least squares polynomial approximation to ( ) on the indicated
interval if
a. ( )= + 3 + 2, [0,1] ;
b. ( )= , [0,2] ;
c. ( )= ln , [1,3] ;
7. Find the least squares polynomial approximation of degree two to the functions and
intervals in exercise 6.
8. Compute the error for the approximations in exercise 6 and 7.
Page 72
CH APT E R SI X
N U M E RI CAL D I FFE RE N T I AT I O N AN D I N T E GRAT I O N
6.1. N umerical D ifferentiation
The method of obtaining the derivatives of a function using a numerical technique is
known as N umerical D ifferentiation. N umerical D ifferentiation is required for these two
situations
1. The function values are known but the function is unknown, such functions are
called tabular functions.
2. The function to be differentiating is complicated and therefore it is difficult to
differentiate. The choice of formula
a. N ewton forward/ backward formula – if the derivative at a point near the
beginning/ end of a set of values respectively.
b. N ewton divided difference/ Lagrange I nterpolation formula – if the values of
are not equally spaced.
6.1.1. D erivative using N ewton’s forward interpolation formula:
Consider N ewton’s forward interpolation formula
( ) ( )( )
= + ∆ + ∆ + ∆ + ⋯------------------- (6.1)
! !
= ----------------------------------------------------------------------------- (6.2)
D ifferentiation (6.1) with respect to we get
= ∆ + ∆ + ∆ + ⋯------------------------------- (6.3)
D ifferentiation (6.2) with respect to we get
= -------------------------------------------------------------------------------- (6.4)
⇒ = ∆ + ∆ + ∆ + ⋯ --------------------- (6.5)
Expression (6.5) becomes the value of at any either tabulated or not.
The formula (6.5) becomes simple for tabulated values of , in particular
when = and = 0.
Putting = 0 in (6.5) we get
= ∆ − ∆ + ∆ − ∆ + ⋯ ---------------------- (6.6)
= ∆ + ( − 1) ∆ + ∆ + ⋯ ----------- (6.7)
Putting = 0 in (6.7) we have
= ∆ −∆ + ∆ − ⋯ ------------------------------- (6.8)
Page 73
⇒ = ∇ + ∇ + ∇ + ⋯ -------------------- (6.13)
Expression (6.13) becomes the value of at any either tabulated or not.
The formula (6.13) becomes simple for tabulated values of , in particular
when = and = 0.
Putting = 0 in (6.13) we get
= = ∇ + ∇ + ∇ + ∇ + ⋯ --------------- (6.14)
D ifferentiation (6.13) with respect to
=
= ∇ + ( + 1) ∇ + ∇ + ⋯ --------------- (6.15)
Putting = 0 in (6.15) we get
= ∇ + ∇ + ∇ + ⋯ --------------------------- (6.16)
Page 74
= 7 − ( 12) + ( 6) = 3
= ∆ −∆ + ∆ −⋯
= [ 12 − 6] = 6
We have = 1, ℎ = 1, and = 1.5 ⇒ = 0.5
= ∆ + ∆ + ∆ +⋯
( . ) ( . ) ( . )
= 7+ (12) + (6)
= [ 7 − 0.25] = 6.75
= ∆ − ∆ + ∆ − ∆ +⋯
= 19 − ( 18) + ( 6) = 12
= ∆ −∆ + ∆ −⋯
= [ 18 − 6] = 12
E xample 2: A rod is rotating in a plane about one of its ends. I f the
following table gives the angle radians through which the rod has turned
for different values of time seconds, find its angular velocity at = 0.7 .
, sec 0 0.2 0.4 0.6 0.8 1
Page 75
.
= = 1, ℎ = 0.2 and = = 0.7 where = = −1.5
.
From N ewton’s interpolation formula, we have
= ∇ + ∇ + ∇ +⋯
.
( . ) ( . ) ( . )
= 1.2 + ( 0.3) + ( 0.02) + ⋯
.
= [ 1.2 − 0.3 − 0.0008]
.
= 4.496 / This represents the angular velocity.
= [∇ + ( + 1) ∇ ]
.
= [ 0.3 + ( −1.5 + 1)( 0.02)]
( . )
= 7.25 / This represents the angular acceleration.
Page 76
Page 77
= ∫ ( ) = [ + ]
= ∫ ( ) = [ + ]
⋮
= ∫ ( )
( ) = [ + ]
N ow adding , ,…, we get
+ + ⋯+ =
∫ ( ) +∫ ( ) + ⋯+ ∫ ( )
( )
= [ + ]+ [ + ] + ⋯+ [ + ]
⇒ ∫ ( ) = [( + )+ ( + ) + ⋯+ ( + )]
= [( + ) + 2( + + ⋯+ )] -------------------------- (6.20)
The formula (6.20) is called T rapezoidal rule for numerical integration.
The error committed in this formula is given by
( )
≈− ( )= − ( ) .
b. Simpson’s ⁄ rule
Substituting = 2 in the General quadrature formula given by (6.19) and
neglecting the third and other higher order differences
We get
∆
= ∫ ( ) = ℎ 2 + 2∆ + −2
= ℎ 2 + 2( − )+ ( −2 + )
= [ +4 + ]
Similarly,
= ∫ ( ) = [ + 4 + ]
= ∫ ( ) = [ + 4 + ]
⋮
⁄ = ∫ ( )
( ) = [ + 4 + ]
Adding , , …, ⁄ we get,
= + + ⋯+ ⁄ =
∫ ( ) + ∫ ( ) + ⋯+ ∫ ( )
( )
= [ +4 + ]+ [ + 4 + ]+⋯
+ [ + 4 + ]
Page 78
( + )
= + 4( + + ⋯+ ) -------------------------------------- (6.21)
+ 2( + + ⋯+ )
The above rule is known as Simpson’s one-third rule. The error
committed in Simpson’s one-third rule is given by
( )
≈− ( )( )= − ( )( ) .
c. Simpson’s ⁄ rule
We assume that within any three consecutive sub-intervals of width ℎ,
the interpolating polynomial ( ) approximating ( ) is of degree 3.
H ence substituting = 3, i.e., the General quadrature formula and
neglecting all the differences above ∆ , we get
= ∫ ( )
∆
= ℎ 3 + ∆ + 9− ∆ + − 27 + 9
3 + 9( − )+ ( −2 + )
= ℎ
+ ( −3 + 3 + )
= [ +3 +3 + ]
Similarly
= ∫ ( ) = [ + 3 +3 + ]
⋮
⁄ = ∫ ( )
( ) = [ + 3 +3 + ]
Adding , , …, ⁄ we get,
= + + ⋯+ ⁄ =
( + )+
= 3( + + + + ⋯+ + ) -------------- (6.22)
+ 2( + + ⋯+ )
Simpson’s three-eighths rule can be applied when the range [ , ]
is divided into a number of subintervals, which must be a
multiple of 3.
The error in Simpson’s three-eighths rule is
≈− ( )( ) .
Page 79
∫ ( + ) = + = ( − )+ - (6.26)
( )= [ + ]= + ( ) ------------------------- (6.27)
From (6.26) and (6.27) = − and =
( )( )
⇒ = ( − ) = = ⇒ =
⇒ ∫ ( ) ≈ ( )= ( − ) ( )
If ∫ ( ) ≈ ( 1 − ( −1) ) ( ) = 2 (0) ------------------------ (6.28)
.
E xample: Find the integral ∫ . 5
. . .
Solution: ∫ . 5 = ( 1.3 − 0.1)
= 1.2 ( 0.7)
( . )
= 1.2 5(0.7) = 1.0357
Page 80
+ + + ( )
( )+ ( )=
+ ( + + + )
( + )+ ( + )
= ----------- (6.30)
+ ( + )+ ( + )
We have the four equations
+ = 2
⎫
+ = 0⎪
and can be determine the four
+ = ⎬
⎪
+ = 0⎭
unknowns , , , .
Solving simultaneously, we get = = 1 and
= ± and = ∓ .
√ √
Therefore, the two point Gauss quadrature is given by
∫ ( ) ≈ − + ---------------------------------------- (6.31)
√ √
.
E xample1: Evaluate the integral = ∫. 5 using Gauss
quadrature two point formula.
Solution: first transfer the interval [0.1,1.3] to [ −1,1] .
Let = +
1.3 = (1) +
⇒ ⇒ = 0.6 and = 0.7
0.1 = ( −1) +
= 0.6 + 0.7
( . . ) . .
Then 5 = 5(0.6 + 0.7) = (3 + 3.5) and
= 0.6
.
Therefore, ∫ . 5 = ∫ (0.6)(3 + 3.5) . .
= ∫ (1.8 + 2.1) . .
.
≈ − +
√ √
. . . .
= (1.8( − ) + 2.1) √ + (1.8( ) + 2.1) √ ,
√ √
= 0.52299 + 0.38719 = 0.91018
.
The exact solution of the integral ∫ . 5 is 0.8939.
Page 81
Therefore, ∫ = ∫ = ∫
≈ − + = +
√ √
√ √
Page 82
= , = , = and = ± , = 0, = ∓ .
∫ ( ) ≈ ( )+ ( 0) + (− ) ----------------------- (6.34)
To evaluate = ∫ ≈ 5 ( ) + 8 ( 0) + 5 (− )
= ( 5) + ( 8) + (5) = 0.693122
Page 83
Page 84
Then,
2 2.3 2.6
( ) 0.0698 0.0608 0.0538
E xercise
1. find and at = 1, = 2
1 3 2 4 5 6
1 27 8 64 125 216
2. Find the first and second derivative for = 15, = 23
15 17 19 21 23 25
= √ 3.873 4.123 4.359 4.583 4.796 5.000
3. The table given below reveals the velocity ‘ ’ of a body during the time ‘ ’ specified. Find its
acceleration at = 1.1.
1.0 1.1 1.2 1.3 1.4
43.1 47.7 52.1 56.4 60.8
4. A rod is rotating a place the following table given the angle (radian) through with the rod has
turned for various values of the time seconds find
a. the angular velocity of the rod
b. its angular acceleration when = 1.0
0 0.2 0.4 0.6 0.8 1.0 1.2
0 0.122 0.493 1.123 2.022 3.200 4.666
5. Evaluate using Trapezoidal rule
i. ∫ ( )
⁄
ii. ∫ (
√
)
6. Evaluate the integral using Simpson’s rule dividing the range in to eight equal parts
log(1 + )
1+
7. Evaluate the problem #6 using two point and three point Gauss quadrature formula.
. .
8. Find the value of the double integral = ∫ ∫ (1 − )
a. using Simpson’s rule ℎ = 0.4, = 0.5
b. using Simpson 3⁄8 rule
Page 85
CH APT E R SE VE N
N U M E RI CAL SO L U T I O N S O F D I FFE RE N T I AL E Q U AT I O N S
Page 86
= + + + +⋯
! ! !
N ow = ( , ) = 1+ = 1 + ( 0.1) 1103 = 1.21103
= ( , )= + = 2.1103 + ( 0.1) 21103 = 2.2314
= ( , )= 2 + = 2( 2.21103) + ( 0.1) 2.2314 = 2.6452
. ( . ) ( . )
Therefore, = 2.1103 + ( 1.21103) + ( 2.2314) + ( 2.6452) = 2.2430
! ! !
( 0.2) = 2.2430
c. The Taylor’s algorithm for the third approximation is
= + + + +⋯
! ! !
N ow = ( , ) = 1+ = 1.4486
= ( , )= + = 2.53272
= ( , )= 2 + = 3.4037
. ( . ) ( . )
Therefore, = 2.2430 + ( 1.4486) + ( 2.53272) + ( 3.4037) = 2.4011
! ! !
( 0.3) = 2.4011
2. E uler’s M ethod
The Taylor’s series method that we have discussed in the previous section yields solution of
differential equations in the form of a power series.
We now proceed to describe methods which give the solution in the form of table values at equally
spaced points.
Consider the first order differential equation
= ( , ) with initial condition ( )= ---------------------------------------------------------- (7.5)
Suppose that we want to solve (7.5) for at the points = + ℎ( , , ,…)
I ntegrating (7.5) between the points and we get
∫ = ∫ ( , )
H ence = + ∫ ( , ) ---------------------------------------------------------------------------- (7.6)
Assume that ( , ) = ( , ) in ≤ ≤ , we get
= +( − ) ( , )
∴ = + ℎ ( , ) -------------------------------------------------------------------------------------- (7.7)
Similarly if ≤ ≤ , we have
= + ( , )
Page 87
Page 88
= + ( +4 + ) where = ℎ ( , ), = ℎ + ℎ 2, + 2
= ℎ ( + ℎ, + ,)[ ,
= ℎ ( + ℎ, + )]
Page 89
E xercise:
Page 90
Page 91