Sie sind auf Seite 1von 35

Numerical Methods

for Engineers
Chapter 1
Modeling, Computers and
Error Analysis
1.1 Introduction
1.2 Mathematical Modeling and
Engineering Problem Solving
1.3 Programming and Software
1.4 Errors
Chapter Outline
Mathematical Modeling and
Engineering Problem Solving

What is the relationship
between mathematic
modeling and engineering
problem-solving?
What is mathematic model?
Equation that expresses the features of system
or process in mathematical terms.
Dependent independent forcing
variable = f variables,parameters,functions
{
A mathematical model is a functional relationship
of the form:
{
Simple example: Newtons 2
nd
law of motion
F = m a
F = net force (kgm/s
2
)
m = mass of the object (kg)
a = acceleration (m/s
2
)
Some mathematical models more complex.

Complex example:
Model for falling parachute,
v
m
c
g
dt
dv
=
t = time (s)
g = gravitational constant (9.8 m/s
2
)
m = mass of the object (kg)
v = terminal velocity (m/s)
c = drag coefficient (kg/s)
The exact solution for differential equation
can be solved using calculus or by
approximation using numerical methods.
Solution for differential equation cannot
be solved analytically using simple algebraic
solution.
(See Example 1.2)
Conservation Laws and Engineering
Conservation laws: fundamental laws that
are used in engineering.
Change = increases decreases
If the no change or steady-state, the
increases and decreases must be balance.
Increases =Decreases
(Steady-sate)
For steady-state fluid flow in pipe,
Flow in = Flow out
For steady-state condition in falling parachute,
0 =
dt
dv
c
mg
v =
thus,
Warming you up
Body
urine
skin
feces
food
drink
metabolism
air
sweat
Figure shows various ways of an average man
gains and losses water in one day. 1L is ingested
as food and body metabolically produces 0.3L. In
breathing air, the exchange is 0.05L while inhaling
and 0.4L while exhaling. The body also lose 0.2, 0.4,
0.2 and 0.5L through sweat, urine, feces and skin,
respectively. In steady-state condition, how much
water must be drunk per day?
What have you learned
Programming and Software
We are going to use the computer as a
tool to obtain numerical solutions to a
given engineering model.
Selected software- MATLAB

MATLAB

is originally developed
as a matrix laboratory.
MATLAB

is closely related to programming.


Familiar yourself with MATLAB

!!
1) Install MATLAB

software
in your notebook.
How to do it??
2) Explore yourself the
Appendix B in Chapra
and Canale (2006).
3) Print out your work as
Assignment 1.
Errors
Why errors are concerned??
For many engineering problems, we
cannot obtain exact solutions.
Numerical methods yield approximate
results, results that are close to the exact
solution.
The question is How much error is present
in our calculation and is it tolerable?
Accuracy?
Precision?
Inaccuracy?
Imprecision?
In numerical methods, we use approximation
to represent the exact mathematical operations.
Numerical errors rise
Numerical error equal to discrepancy between
the truth and approximation:
ion approximat value true E
t
=
True percent relative error,
t

100% =
value true
error true

t
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 approach to
compute answers. A present approximation is
made on the basis of a previous approximation.
Percent relative error,
100% =
approx. current
approx. previous - approx. current

a
a

The may be in +ve or ve signs. But


the most important is its absolute value.
a

The calculation should proceed until the


absolute value of lower than percent
tolerance given, .
a

s a
<
Result is correct/almost exact after the
iteration to at least n significant figures.
n= 1,2,3.
( )% 10 0.5
2 n
s


=
(See Example 3.2)
What is significant figures?
Significant digits of a number are those
that can be used with confidence, e.g.,
the number of certain digits plus one
estimated digit.

53,800 How many significant figures?

5.38 x 10
4
3
5.380 x 10
4
4
5.380 x 10
4
5
Zeros are sometimes used to locate the
decimal point not significant figures.

0.00001753 4
0.0001753 4
0.001753 4

Number of significant figures indicates
precision.
Types of errors- Round-off error
Numbers such as , e, or cannot be
expressed by a fixed number of significant
figures.
7
The discrepancy introduced by error of
significant figures is called round-off error.
Types of errors- Truncation error
Truncation errors are those that result from
using an approximation in place of an exact
mathematical procedure.
The Taylor series
A mathematical formulation that used
widely 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 of
approximation applied, the lower the
truncation error.
) ( ) (
1 i i
x f x f ~
+
Zero-order approximation:
Additional terms of the Taylor series are
required to provide a better estimate.
First-order approximation:
) )( ( ' ) ( ) (
1 1 i i i i i
x x x f x f x f + ~
+ +
The additional term consist
of a slope multiply the distance
between and .
i
x
1 + i
x
2
1 1 1 1
) (
! 2
) ( ' '
) )( ( ' ) ( ) ( x x
x f
x x x f x f x f
i
i
i i i i i
+ + ~
+ + +
Second-order approximation:
and so on
n
n
i i
i
n
i i
i
i i
i
i i i i i
R x x
n
x f
x x
x f
x x
x f
x x x f x f x f
+ + + +
+ + ~
+ +
+ + +
) (
!
) (
.......... ) (
! 3
) (
) (
! 2
) ( ' '
) )( ( ' ) ( ) (
1
) (
3
1
) 3 (
2
1 1 1
where is a remainder term
n
R
n
n
i
n
i
i
i i i
R h
n
x f
h
x f
h
x f
h x f x f x f
+ + + +
+ + ~
+

!
) (
..........
! 3
) (
! 2
) ( ' '
) ( ' ) ( ) (
) (
3
) 3 (
2
1
1
1 1
1
) (
)! 1 (
) (
+
+
+

+
=
n
i
n
n
x x
n
f
R

Remainder term:
where is a value lies between and
i
x
1 + i
x
) (
1 i i
x x h =
+
Simplifying , hence,
(See Example 4.2)
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.
a) Forward divided difference (1
st
derivative)
) (
) ( ) (
) ( '
1
1
h O
x x
x f x f
x f
i i
i i
i
+

=
+
+
! 2
) )( (
) (
1
) 2 (
i i i
x x x f
h O

=
+
where
) (h O
is an truncation error.
b) Backward divided difference (1
st
derivative)
) (
) ( ) (
) ( '
1
1

=
i i
i i
i
x x
x f x f
x f
c) Centered divided difference (1
st
derivative)
) (
) ( 2
) ( ) (
) ( '
2
1
1 1
h O
x x
x f x f
x f
i i
i i
i
+

=
+
+
! 3
) )( (
) (
2
1
) 3 (
2
i i i
x x x f
h O

=
+ where
Try for yourself
a) Use forward, backward and centered difference
approximations to estimate the first derivative.
2 . 1 25 . 0 5 . 0 15 . 0 1 . 0 ) (
2 3 4
+ = x x x x x f
at x =0.25.
The derivative can be calculated directly as
25 . 0 0 . 1 14 . 0 4 . 0 ) ( '
2 3
= x x x x f
and can be used to compute the exact value as
=-0.9125.
b) Calculate the true percent relative error, .
t

Given
) ( ' x f
What have you learned
Tutorial 1
Chapra and Canale (2006):

Problem 4.1(a)(b)
Problem 4.2
Problem 4.4
Problem 4.6

Das könnte Ihnen auch gefallen