You are on page 1of 89

MANDALAY TECHNOLOGICAL UNIVERSITY

DEPARTMENT OF ENGINEERING MATHEMATICS


FOURTH YEAR,
FIRST SEMESTER
DISCRETE MATHEMATICS 1

By
Dr. Min Min Swe Zin
(DEPARTMENT OF ENGINEERING MATHEMATICS)
(5.12.2019)
1
Mandalay Technological University
2019-2020 Academic Year
Fourth Year, Semester 2, Discrete Mathematics 1
5.12.2019
Advanced Engineering Mathemaics, Erwin Kreyszig, 10th Edition
I. Numeric Analysis
Chapter 19, Numerics in General
19.1 Introduction
19.2 Solution of Equations by Iteration
19.5 Numeric Integration and Differentation
Chapter 20, Numeric Linear Algebra
20.1 Linear Systems: Gauss Elimination
20.3 Gauss- Seidel Iteration Method
20.3 Linear Systems: Solution by Iteration

2
Mathematical Methods of Science and Engineering ( Kanti B.Datta)
 Operation Research (Kanti Swarup+3)
• Linear Programming,
– Chapter 2, Linear Programming Problem-Mathematical Formulation
– Chapter 3, Linear Programming-Graphical Solution and Extension
– Chapter 4, Linear Programming-Simplex Method
Chapter 19

Numerics in General

4
19.1 Introduction
Floating Point form of Numbers
In a fixed-point System, all numbers are given with a fixed number
of decimals after the decimal point;
e.g., numbers given with 3 decimals are 62.358, 0.014, 1.000.

In a Floating-Point System, the number of significant digits is kept


fixed, where as the decimal point is floating.
e.g.,
Significant Digit
A significant digit of a number c is any given digit of c, except possibly
for zeros to the left of the first non-zero digits;
(These zeros serve only to fix the position of decimal point.)
Therefore any other zero is a significant digit of c.

e.g., 1360, 1.360, 0.001360


Each of the numbers has 4 significant digits. (4S)
Underflow and Overflow
Underflow: If a number outside that range occurs, in a
computation is called underflow, when the number is
smaller.
e.g., -308 < n < 308 ( double precision)
In the case of underflow, the result is usually set to zero and
computation continues.
Overflow: When the number is larger, is called overflow.
e.g., -1020 < n* <1020
It causes the computer to halts.
Standard codes are written to avoid overflow.
Error messages on overflow may indicate programming errors
(incorrect input data, etc. )
Roundoff : An error is caused by chopping or rounding. This error is called
round off error.
Roundoff Rule
Discard the (k+1)th- decimal and all subsequent decimals.

i) Rounding down: If the number discarded is less than half a unit in the kth- place,
leave the kth-decimal unchanged.
e.g., 3.44 3.4 ( less )
(ii) Rounding up: If the number discarded is greater than half a unit in the kth-place,
add 1 to the kth-decimal.
e.g., 3.46 3.5 (greater)
(iii) If it is exactly half a unit, round off to the nearest even decimal.
e.g., 3.45 3.4 (exactly half & even)
3.55 3.6 (exactly half & odd)

e.g., Roundoff 1.2535 to 3Decimals: 1.2535 1.254 (half & odd)


to 2Decimals: 1.2535 1.25 (less)
to 1Decimal: 1.2535 1.2 (half & even)
Algorithm : An algorithm is a step-by-step procedure that states
a numeric method in a form ( a “pseudocode”)
understandable to humans.
It is used to write a program in a programming language that
the computer can understand so that it can execute the numeric
method.
Stability: Small changes in the initial data should cause only
small changes in the final results.
An algorithm should be stable to be useful.
If small changes in the initial data can produce large changes in the
final results, this algorithm is unstable.
Solution of Equations
Solve f(x)=0 (Types of equations)

Analytical methods Numerical methods


(Iteration Methods)

Exact solutions Approximate solutions

errors
19.2 Solution of Equations by Iteration
 Fixed-Point Iteration
 Newton’s Method
 Secant Method
 Method of False Position
 Bisection Method
19.2 Solution of Equations by Iteration

Algebraic equation
If f is polynomial, eq (1) is called algebraic equation.
Eg,
 Transcendental equation
If f are transcendental functions (trigonometric functions), eq (1) is called
transcendental equation.
Eg,

12
To solve eq (1), when there is no formula for the exact solution,
We can use an approximation method, in particular, an iteration method.

Iteration Method:
a method in which we start from an initial guess (which may be poor) and
compute step by step (in general better and better) approximations
of an unknown solution of (1).

Fixed-Point Iteration for solving equation

Set …… (2) [A solution of (2) is called a fixed-point of g.]


Choose
Compute

……
,, …..(3)
13
Example 1 An Iteration Process ( Fixed-point Iteration)

Exact Solution:

App
Fixed Points

X1=1.66667
X2=1.25926
X3=0.861912
……….
x1=0.38196 x1=2.61803
6 4
Fixed-point
Example 1 An Iteration Process ( Fixed-point Iteration)

By Theorem 1:

 In the lower part of Fig.(a)

 In the upper part of Fig. (a)

X1=1.66667
X2=1.25926
X3=0.861912
……….
Example 1 An Iteration Process ( Fixed-point Iteration)

Exact Solution:

Approximate Solution:

(-/x),

X1=2 X1=2.667
X2=2.625
X2=2.5
X3=2.619
X3=2.6
X4=2.615
X4=2.615 ……….
……….
Example 1 An Iteration Process ( Fixed-point Iteration)

By Theorem 1:

X1=2 X1=2.667
X2=2.625
X2=2.5
X3=2.619
X3=2.6
X4=2.615
X4=2.615 ……….
………. ……….
 Sufficient condition for convergence
Example 2

Solution:

for any x

X1=0.5
X2=0.8
X3=0.61
X4=0.729
X5=0.653
X6=0.701
………. ……….
x=0.68232
8
Example 2

Solution:

X1=0 X1=-7
X2=1 X2=344
X3=0 X3=…
X4=1 X4=….
………. ……….
Old Question:
1(a) Find the negative solution of = −5 +3=0
by fixed-point iteration starting from approximate value of
x. Do 5 steps. Verify your solution by sketching the graphs
of = 0 and = .
(b) Set up Newton iteration for computing the cube root x
of a positive number c and apply it to = 7with = 2 for
5th approximation.
.
 Newton’s Method (also known as Newton-Raphson’s Method)
 Another iteration method for solving equation f(x)=0
 The idea is that we approximate the graph of f by suitable tangents.
 Using an approximate value x0 obtained from the graph of f,
 x1 be the point of intersection of the x-axis and the tangent to the curve of f at x0.
X1=1.500000
X2=1.416667
X3=1.414216
X4=1.414214
……….
X1=0.750000
X2=0.686047
X3=0.682340
X4=0.682328
……….
Example 2

Solution:

for any x

X1=0.5
X2=0.8
X3=0.61
X4=0.729
X5=0.653
X6=0.701
………. ……….
………… (*)

…………..(5)

Secant method
By Secant method
For different expression f ′,
f ( x n ) − f ( x n −1 )
f ′( x n ) =
x n − x n −1
f (x n )
∴ x n +1 = xn −
f ′( x n )
x n − x n −1
= x n − f (x n )
f ( x n ) − f ( x n −1 )
We need two starting values x0 and x1.
Passing through f(x0 ) and f(x1), the line passes x-axis at x2. Then we
get f(x2).
Passing through f(x1) and f(x2), the line passes x-axis at x3. Then we
get f(x3).
Similarly, we get the approximate value xn near exact value x.
 Use the Secant method to find the solution to = −
and compare the approximation with those given by
Newton’s method. Do 5 steps. Verify your solution by
sketching the graphs of = 0 and x = ( ).
 = −
 =
19.2 Solution of Equations by Iteration
 Fixed-Point Iteration
 Newton’s Method
 Secant Method
 Method of False Position
 Bisection Method
Method of False Position

....
Method of False Position
Determine an approximate value of the root of the equation
Example
by the Method of False Position. Perform 3 steps.

Solution:

By the Method of False Position,

After 3 steps, the required root is


Find the solutions of the equation
Example
by the Method of False Position. Perform 3 steps, for the 6D-values.
Bisection Method

Procedure
Example
 The methods for computing solutions s of with given continuous (or
differentiable) start with an initial approximation of s and generate a
sequence by iteration.
 Fixed-point methods solve written as , so that s is a fixed point
of g, that is, s=g(s).
 Newton’s Method: For this is Newton’s method, which for
good and simple zeros converges quadratically (and for multiple zeros
linearly).
 From Newton’s method, the secant method follows by replacing by a
different quotient.
 The bisection method and Method of False Position always converge, but often
slowly.
 Interpolation
Interpolation means to find (approximate values of a function ( ))
for an between different –values: , , , … . , " at which the
values of are given:
For example;
1 2 3 4

3 6 11 18
to find the value of 2.5 is using

the table is called interpolation.


 Lagrange Interpolation
"

≈ $" = % &' '


'(
(i)Lagrange Linear Interpolation

) )* () )+ )
≈$ = +
)+ )* ()* )+ )
) )* ) )+
, = ,, =
)+ )* )* )+
∴$ =, +, ( )
"

≈ $" = % &' '


'(
(ii)Lagrange Quadratic Interpolation
− − − −
≈$ = +
− − − −
( − )( − )
+
( − )( − )
) )* ) ).
, = ,
)+ )* )+ ).
− −
, = ,
− −
( − )( − )
, =
( − )( − )
∴$ =, +, ( ) +, ( )
Example 1: Compute a 4D-value of &/9.2 from &/9.0 = 2.1972 ,
&/9.5 = 2.2513, by linear Lagrange interpolation and determine
the error, using &/9.2 = 2.2192 (4D).

9.0 9.5
( ) ( ) ( )
2.1972 2.2513
− ( − )
≈$ = +
− ( − )
9.2 − 9.5 9.2 − 9.0
&/9.2 ≈ $ 9.2 = 2.1972 + 2.2513
9.0 − 9.5 9.5 − 9.0
= 2.2188
&/9.2 ≈ 2.2188 44
&/9.2 = 2.2192

56676 = 2.2192 − 2.2188 = 0.0004 44


Hence, linear interpolation is not sufficient here to get 4D accuracy;
it would suffice for 3D accuracy.
Example 2: Compute a 4D-value of &/9.2 from &/9.0 = 2.1972 ,
&/9.5 = 2.2513, &/11.0 = 2.3979, by linear Lagrange interpolation
and determine the error, using &/9.2 = 2.2192 (4D).

9.0 9.5 11.0

( ) ( ) ( ) ( )

2.1972 2.2513 2.3979

− − − −
≈$ = +
− − − −
( − )( − )
+
( − )( − )
8. 8.9 8. . 8. 8. 8. .
&/9.2 ≈ $ 9.2 =
8. 8.9 8. .
2.1972 +
8.9 8. 8.9 .
2.2513
(9.2 − 9.0)(9.2 − 9.5)
+ 2.3979 = 2.219154
(11.0 − 9.0)(11.0 − 9.5)
&/9.2 ≈ 2.2192
&/9.2 = 2.2192
56676 = 2.2192 − 2.2192 = 0
19.5 Numeric Integration and Differentiation
Rectangular Rule
Subdivide a ≤ x ≤ b into “n” subinterval of equal
length, .h = b − a
n

( ) ( )
J ≈ hf x + hf x + ... + hf x
*
1
*
2 ( )
*
n

≈ h [ f (x ) + hf (x ) + ... + f (x )]
*
1
*
2
*
n

x = mid point of x j
*
j
1
Compute  0
x 3 dx by Rectanglua r Rule with n = 5. Find error.
a = 0 , b = 1, f ( x ) = x 3 , n = 5
j xj xj* f(xj*)
b−a 1
h= = = 0 .2 0 0
n 5
b
0.1 0.001
J =  f (x )dx
a
1 0.2
0.3 0.027
By Rectangula r Rule,
[( ) ( )]
2 0.4
*
1 ( )
J ≈ h f x + hf x + ... + f x
*
2
*
n 0.5 0.125
= 0 .2[1 .225 ] 3 0.6
= 0.245 0.7 0.343
For exact valu e, 4 0.8
1
x4 1 0.9 0.729
0 x dx = 4 = 4 (1 − 0) = 0.25 .
3

5 1
Error = exact - approximat e Sum 1.225
= 0.25 - 0.245
= 0.005
Trapezoidal Rule
1  b−a
J ≈ h  ( f 0 + f n ) + ( f 1 + f 2 + ... + f n −1 )  , h =
2  n
Simpson’s Rule
J ≈
h
[( f 0 + f 2 m ) + 4 ( f 1 + f 3 + ... + f 2 m − 1 ) + 2 ( f 2 + f 4 + ... + f 2 m − 2 ) ],
3
b − a
h = , n = 2m
2m
Error Estimation by Halving
Error Bounds and Estimate for the Trapezoidal
Rule
Error bounds
KM 2 ≤ ε ≤ KM , K *
=−
(b − a)
3
=−
b−a 2
h
2
12 n 2 12
Error Estimation by halving
b−a 2
Error : ε = − h f ′′(tˆ ), tˆ = (suitable, unknown) value between x 0 and x 1
12
J = Jh + εh
h n h  1 
J h =  f j  + ( f 0 + f 10 ) 
2
2  j =1 2  2 
1 
εh =  J h − J h 
2
3 2 
Exact valu e = J h + ε h
2 2

You might also like