Upload
azmihafifi
View
241
Download
0
Embed Size (px)
Citation preview
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
1/35
Numerical Methodsfor Engineers
Chapter 1
Modeling, Computers and
Error Analysis
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
2/35
1.1 Introduction
1.2 Mathematical Modeling andEngineering Problem Solving
1.3 Programming and Software
1.4 Errors
Chapter Outline
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
3/35
Mathematical Modeling and
Engineering Problem Solving
What is the relationshipbetween mathematic
modelingand engineering
problem-solving?
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
4/35
What is mathematic model?
Equation that expresses the features of system
or process in mathematical terms.
Dependent
independent forcingvariable = f variables,parameters,functions{
A mathematical model is a functional relationshipof the form:
{
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
5/35
Simple example: Newtons 2ndlaw of motion
F = m a
F= net force (kgm/s2)
m
= mass of the object (kg)a= acceleration (m/s2)
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
6/35
Some mathematical models more complex.
Complex example:Model for falling parachute,
vm
c
gdt
dv
t = time (s)
g= gravitational constant (9.8 m/s2)
m= mass of the object (kg)
v= terminal velocity (m/s)
c = drag coefficient (kg/s)
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
7/35
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
8/35
ConservationLaws and Engineering
Conservation laws: fundamental laws that
are used in engineering.
Change = increasesdecreases
If the no change or steady-state, the
increases and decreases must be balance.Increases =Decreases
(Steady-sate)
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
9/35
For steady-statefluid flow in pipe,
Flow in = Flow out
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
10/35
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
11/35
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
12/35
What have you learned
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
13/35
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
14/35
Familiar yourself with MATLAB!!
1) Install MATLABsoftware
in your notebook.
How to do it??
2) Explore yourself the
Appendix Bin Chapra
and Canale (2006).3) Print out your work as
Assignment 1.
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
15/35
Errors
Why errors are concerned??For many engineering problems, we
cannot obtain exact solutions.
Numerical methods yield approximateresults, results that are close to the exact
solution.
The question is How much error is presentin our calculation and is it tolerable?
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
16/35
Accuracy?
Precision?
Inaccuracy?
Imprecision?
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
17/35
In numerical methods, we use approximation
to represent the exact mathematical operations.
Numerical errors rise
Numerical error equal to discrepancy betweenthe truth and approximation:
ionapproximatvaluetrueEt
True percent relative error,t
100%
valuetrue
errortruet
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
18/35
If we cannot solved the problem
analytically to get the true value,
how to calculate its true error?
We normalized the error to approximate value.
Numerical methods use iterative approachtocompute answers. A present approximation is
made on the basis of a previous approximation.
Percent relative error,
100%approx.current
approx.previous-approx.currenta
a
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
19/35
The may be in +veorvesigns. But
the most important is its absolute value.
a
The calculation should proceed until the
absolute value of lower thanpercenttolerancegiven, .a
s
sa
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
20/35
Result is correct/almost exact after theiteration to at least nsignificant figures.
n= 1,2,3.
%100.5 2 ns
(See Example 3.2)
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
21/35
What is significant figures?
Significant digits of a number are thosethat can be usedwith confidence, e.g.,
the number of certain digits plus one
estimated digit.
53,800 How many significant figures?
5.38 x 104 3
5.380 x 104 4
5.380 x 104 5
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
22/35
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
23/35
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
24/35
Types of errors- Truncation error
Truncation errorsare those that result from
using an approximation in place of an exact
mathematical procedure.
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
25/35
The Taylor series
A mathematical formulation that usedwidely in numerical methods to predict a
function value in approximate fashion.
Why it is called in series?
Its build term by term, started with zero-order
approximation. The higher the order ofapproximation applied, the lower the
truncation error.
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
26/35
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
27/35
)()( 1 ii xfxf
Zero-order approximation:
Additional terms of the Taylor series are
required to provide a better estimate.
First-order approximation:
))((')()( 11 iiiii xxxfxfxf
The additional term consist
of a slope multiply the distance
between and .i
x1
i
x
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
28/35
21111 )(
!2)(''))((')()( xxxfxxxfxfxf iiiiiii
Second-order approximation:
and so on
n
n
iii
n
iii
iii
iiiii
Rxxnxfxxxf
xxxf
xxxfxfxf
)(!
)(..........)(!3
)(
)(!2
)(''))((')()(
1
)(3
1
)3(
2
111
where is a remainder termnR
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
29/35
n
ni
n
i
i
iii
Rhn
xfh
xf
hxf
hxfxfxf
!
)(..........
!3
)(
!2
)('')(')()(
)(3
)3(
2
1
1
11
1
)()!1(
)(
n
i
n
n xxn
f
R
Remainder term:
where is a value lies between and ix 1ix
)( 1 ii xxh Simplifying , hence,
(See Example 4.2)
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
30/35
How to solve the derivatives of an
equation given using Taylor series?
We use an approximation using
numerical differentiation with:
a) Forward divided difference
b) Backward divided difference
c) Centered divided difference
They are developed from the Taylor series
to approximate derivatives numerically.
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
31/35
a) Forward divided difference (1stderivative)
)()()(
)('1
1 hOxx
xfxfxf
ii
iii
!2
))(()( 1
)2(iii xxxfhO
where
)(hO is an truncation error.
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
32/35
b) Backward divided difference (1stderivative)
)(
)()()('1
1
ii
iii
xx
xfxfxf
c) Centered divided difference (1stderivative)
)()(2
)()()(' 2
1
11 hOxx
xfxfxf
ii
iii
!3
))(()(
2
1
)3(2 iii xxxfhO
where
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
33/35
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
34/35
What have you learned
8/11/2019 Chapter 1- Modelling, Computers and Error Analysis
35/35
Tutorial 1
Chapra and Canale (2006):
Problem 4.1(a)(b)
Problem 4.2Problem 4.4
Problem 4.6