You are on page 1of 44

ID-302 Engineering Numerical

Analysis

Engr. Abdul Khaliq

Department of Irrigation and Drainage


Faculty of Agricultural Engineering & Technology
University of Agriculture Faisalabad

10/23/16

Engr Abdul Khaliq

Objectives:
In

this course, students will be able to


demonstrate programming proficiency using
structured programming techniques to implement
numerical methods for solutions using computerbased programming techniques.

10/23/16

Engr Abdul Khaliq

Course Outline

Theory:
Mathematical preliminaries,
Solution of equations in one variable,
Interpolation and polynomial Approximation,
Numerical differentiation and integration,
Initial value problems for ordinary differential equations,
Direct methods for solving linear systems,
Iterative techniques in Matrix algebra,
Solution of non-linear equations.
Approximation theory;
Eigen values and vector;
Practical: Programming of different numerical techniques, direct methods, iterative
techniques, Eigen values and vectors.
Suggested Readings:
1.

Burden, R. L. and J. D. Faires, 2011. Numerical Analysis. PW Publishing Company, Boston, USA.

2.
3.

Chapra, S. C., and Canal, R.P., 2 010.,Numerical Methods for Engineers, 6th Edition, McGraw Hill Inc.
Mumtaz Khan 2008 Numerical Methods for Engineering Science and Mathematics, 2 nd Edition..
10/23/16

Engr Abdul Khaliq

NUMERICAL APPROXIMATIONS
Numerical methods is an area of
study in mathematics that
discusses the solutions to various
mathematical problems involving
differential equations, curve
fittings, integrals, eigenvalues,
and root findings through
approximations rather than exact
solutions.
10/23/16

Engr Abdul Khaliq

Mathematical Preliminaries
and Error Analysis
In beginning chemistry courses, the ideal gas law,
PV = NRT,
Suppose two experiments are conducted to test this law, using the same gas
in each case. In the first experiment,
P = 1.00 atm, V = 0.100 m3,
N = 0.00420 mol, R = 0.08206.
The ideal gas law predicts the temperature of the gas to be
PV
T
RT
(1.00)(0.100)
T
291.15 K 17C
(0.00420)(0.082460)

When we measure the temperature of the gas however, we find that the true temperature is

15C.
10/23/16

Engr Abdul Khaliq

Mathematical Preliminaries
and Error Analysis (continued)
We then repeat the experiment using the same values
of R and N, but increase the pressure by a factor of
two and reduce the volume by the same factor. The
product PV remains the same, so the predicted
temperature is still 17C. But now we find that the
actual temperature of the gas is 19 C.

10/23/16

Engr Abdul Khaliq

Review of Calculus
To solve problems that cannot be solved

exactly

1
2

10/23/16

u2

du

Engr Abdul Khaliq

Review of Calculus
Differentiability

10/23/16

Engr Abdul Khaliq

Review of Calculus

10/23/16

Engr Abdul Khaliq

Propagation of Errors
In numerical methods, the calculations are
not made with exact numbers. How do these
inaccuracies propagate through the
calculations?

10/23/16

Engr Abdul Khaliq

10

Example 1:
Find the bounds for the propagation in adding two numbers. For
example if one is calculating X +Y where
X = 1.5 0.05
Y = 3.4 0.04
Solution
Maximum possible value of X = 1.55 and Y = 3.44
Maximum possible value of X + Y = 1.55 + 3.44 = 4.99
Minimum possible value of X = 1.45 and Y = 3.36.
Minimum possible value of X + Y = 1.45 + 3.36 = 4.81
Hence
4.81 X + Y 4.99.

10/23/16

Engr Abdul Khaliq

11

Propagation of Errors In
Formulas
X 1 , X 2 , X 3 ,......., X n 1 , X n
If f is a function of several variables
then the maximum possible value of the error
in is
f

f
f
f
f
f
X 1
X 2 .......
X n 1
X n
X 1
X 2
X n 1
X n

10/23/16

Engr Abdul Khaliq

12

Example 2:

The strain in an axial member of a square


cross-section is given by
Given

F
2
h E

F 72 0.9 N

E 70 1.5 GPa

h 4 0.1 mm

Find the maximum possible error in the


measured strain.

10/23/16

Engr Abdul Khaliq

13

Solut
ion

72

3 2
9
(4 10 ) (70 10 )
6
64.286 10
64.286


F
h
E
F
h
E

10/23/16

Engr Abdul Khaliq

14


1
2
F h E

2F
3
h
hE

F
2 2
E
h E

Thus

1
2F
F
E 2 F 3 h 2 2 E
h E
hE
h E

1
2 72

0
.
9

0.0001
3 2
9
3 3
9
(4 10 ) (70 10 )
(4 10 ) (70 10 )

Hence

72
9

1
.
5

10
(4 10 3 ) 2 (70 109 ) 2

5.3955

(64.286 5.3955 )

10/23/16

Engr Abdul Khaliq

15

Example 3:

Subtraction of numbers that are nearly equal can create unwanted


inaccuracies. Using the formula for error propagation, show that this is true.
Solution
Let

z x y

Then

z
z
x
y
x
y

(1)x (1)y
x y
So the relative change is

x y
z

z
x y

10/23/16

Engr Abdul Khaliq

16

Example 3:
For example if

x 2 0.001
y 2.003 0.001

0.001 0.001
z

z
| 2 2.003 |
=
0.6667
=
66.67%

10/23/16

Engr Abdul Khaliq

17

Sources of Error

Two sources of numerical error


1) Round off error
2) Truncation error

The error that is produced when a calculator or


computer is used to perform real-number
calculations is called round-off error.

10/23/16

Engr Abdul Khaliq

18

Round off Error


Caused by representing a number

approximately

1
0.333333
3

2 1.4142...

10/23/16

19 Abdul Khaliq
Engr

Problems created by round off


error
Drown attack miss the target .Why?

10/23/16

20 Abdul Khaliq
Engr

Problem with Patriot


missile
Clock cycle of 1/10 seconds

was represented in 24-bit


fixed point register created an
error of 9.5 x 10-8 seconds.
The battery was on for 100
consecutive hours, thus
causing an inaccuracy of
s
3600s
9.5 10
100hr
0.1s
1hr
0.342s
8

10/23/16

21 Abdul Khaliq
Engr

Problem (cont.)
The shift calculated in the ranging system of

the missile was 687 meters.


The target was considered to be out of range
at a distance greater than 137 meters.

10/23/16

22 Abdul Khaliq
Engr

Effect of Carrying Significant


Digits in Calculations

10/23/16

23
Engr Abdul Khaliq

Truncation
error
Error caused by truncating or
approximating a mathematical procedure.

10/23/16

24 Abdul Khaliq
Engr

Example of Truncation
Error
Taking only a few terms of a Maclaurin
x
series
to
e
approximat
2
3
e
x
x
x

e 1 x

2!

3!

....................

If only 3 terms are used,

x
x
Truncation Error e 1 x
2!

10/23/16

25 Abdul Khaliq
Engr

Another Example of Truncation


Error
x to
Using a
) f ( x)
finite f ( x) f ( x xapproximate
x

secant line

P
tangent line

Figure 1. Approximate derivative using finite


x
10/23/16

26 Abdul Khaliq
Engr

f (x)

Another Example of Truncation


Error
Using finite rectangles to approximate
an integral.

10/23/16

27 Abdul Khaliq
Engr

Example 1 Maclaurin
series
Calculate the value e1.2 with an absolute
of
relative approximate error of less than
1%. e1.2 1 1.2 1.2 2 1.2 3 ...................
2!

1.2

Ea

3!

a %

__

___

2.2

1.2

54.545

2.92

0.72

24.658

3.208

0.288

8.9776

3.2944

0.0864

2.6226

3.3151

0.020736

0.62550

6 terms are required. How many are required


to get at least 1 significant digit correct in your
answer?
10/23/16

28 Abdul Khaliq
Engr

Example 2
Differentiation
f (3)

f ( x) x 2

Find
for
an x 0.2
f (3 0.2) f (3)
'
d
f (3)

f ( x x) f ( x)
using f ( x)
x

0 .2
3.2 2 32
f (3.2) f (3)

0.2
0.2

1.24
10.24 9
6.2

0.2
0 .2

The actual value


is f ' ( x) 2 x, f ' (3) 2 3 6
6 6.2 0.2
Truncation error is
then,
Can you Engr
find the truncation error x 0.1
10/23/16
29 Abdul Khaliq

Example 3 Integration
Use two rectangles of equal width to
approximate the area under the curve
[3,9]
f ( x) x 2 over the
for
interval
9

x
dx

10/23/16

30 Abdul Khaliq
Engr

Integration example
(cont.)
Choosing a width of 3, we
9
havex 2 dx ( x 2 ) (6 3) ( x 2 ) (9 6)

x 3

x 6

(3 2 )3 (6 2 )3
27 108 135

Actual value is given by


9

x3
2
3 x dx 3

93 33

234
3

Truncation error is then


234 135 99

Can you findEngr


the truncation error with 4
31 Abdul Khaliq

10/23/16

Steps in Solving an
Engineering Problem

10/23/16

Engr Abdul Khaliq

32

How do we solve an engineering


problem?
Problem Description
Mathematical Model
Solution of Mathematical
Model
Using the Solution
10/23/16

Engr Abdul Khaliq

33

Mathematical Procedures
Nonlinear Equations
Differentiation
Simultaneous Linear Equations
Curve Fitting
Interpolation
Regression

Integration
Ordinary Differential Equations
Other Advanced Mathematical

Procedures:
Partial Differential Equations
Optimization
Fast Fourier Transforms
10/23/16

Engr Abdul Khaliq

34

Nonlinear Equations
How much of the floating ball is under water?

Diameter=0.11m
Specific Gravity=0.6

x 0.165 x 3.993 10 0
3

10/23/16

Engr Abdul Khaliq

35

Nonlinear Equations
How much of the floating ball is under the water?

f ( x ) x 3 0.165 x 2 3.993 104 0


10/23/16

Engr Abdul Khaliq

36

Differentiation
What is the
acceleration at t=7
seconds?

16 104
9.8t
v(t) 2200 ln
4
16 10 5000t
10/23/16

Engr Abdul Khaliq

dv
a
dt
37

Differentiation
What is the acceleration at t=7
seconds?
Time (s)
5
8
12
Vel (m/s)
106
177
600

dv
a
dt

10/23/16

Engr Abdul Khaliq

38

Simultaneous Linear
Equations
Find the velocity profile, given
Time (s)

12

Vel (m/s)

106

177

600

v (t ) at 2 bt c, 5 t 12
Three simultaneous linear
equations
25a 5b c 106

64a 8b c 177
144a 12b c 600
10/23/16

Engr Abdul Khaliq

39

Interpolation
What is the velocity of the rocket at t=7
seconds?
Time (s)
5
8
12
Vel (m/s)

10/23/16

106

177

Engr Abdul Khaliq

600

40

Regression
Thermal expansion coefficient data for cast
steel

10/23/16

Engr Abdul Khaliq

41

Regression (cont)

10/23/16

Engr Abdul Khaliq

42

Integration
Finding the diametric contraction in a steel shaft
when dipped in liquid nitrogen.

T fluid

D D dT
Troom

10/23/16

Engr Abdul Khaliq

43

Reading
1. Burden, R. L. and J. D. Faires, 2011. Numerical
Analysis. PW Publishing Company, Boston, USA.
2. Chapra, S. C., and Canal, R.P., 2 010.,Numerical
Methods for Engineers, 6th Edition, McGraw Hill Inc.
3. Mumtaz Khan 2008 Numerical Methods for
Engineering Science and Mathematics, 2nd Edition..

THE END
10/23/16

Engr Abdul Khaliq

44

You might also like