You are on page 1of 22

An introduction of Scientific

Computing
Chin-Tien Wu
Institute of Mathematics Modelling and
Scientific Computing

2014

Why scientific computing?

Simulation of natural phenomena


Virtual prototyping of engineering designs
More insights from unknown phenomenon
Much more

What is scientific computing?


Design and analysis of algorithms for numerically
solving mathematical problems in science and
engineering. Traditionally called numerical analysis
Distinguishing features of scientific computing
Approximate continuous quantities by discrete
quantities. Considers effects of approximations including
error and sensitivity

What should be cared in scientific computing?

Sources of approximation

Example 1

Error measurement

Where numerical errors come from?

More about error (I)

More about the error (II)

Condition number of a function f at variable value x is defined as:

cond x ( f ) = sup

f ( x ) f ( x )

f ( x)

x x x

Relative propogated error (rounding error) can be estimated by:

f ( x ) f ( x )

f ( x ) cond x ( f ) x x x

relative input error

Relative computational error (truncation error) can be estimated by:

f ( x ) f ( x )
cond x ( f )

f ( x) =
f ( x ) f ( x )
f ( x )
f ( x)

x x x

relative backward error

f ( x)

Evaluate the forward error, backward error and


the condition number:
Evaluate function f for approximate input x = x + x instead of
the true input x, we have
Absolute forward error = f ( x + x ) f ( x ) f ( x ) x
Relative forward error =
Condition number = sup
x

f ( x + x ) f ( x )
f ( x)

f ( x + x ) f ( x )
x x

f ( x)

x
f ( x)
f ( x)

f ( x)

x
f ( x)

In what condition the backward error can be controlled?


Consider:

f ( x ) f ( x ) = f ( x ) f ( x )
f ( x )( x x ) +

1
2
f ( x )( x x )
2

x x

when x ~ x.
f ( x ) f ( x ) f ( x ) cond ( f )
x

x x
cond ( f ) <
''

0
Clearly, when
, and f < , f f
x
f ( x ) <
Moreover, the backward error can be estimated by

Relative forward error


Relative backward
Condition number

A problem f is said to be well-posed if or well-conditioned if

cond x ( f ) << for all x


An algorithm

is said to be well-posed if or well-conditioned if

cond x ( f ) << for all x


Relative error in the solution (output) is insensitive to the
relative small change in the input.
A problem f or an algorithm

is said to be stable if the

relative backward error is small


Accurate numerical solution can be obtained only when
a problem and computational algorithm are
well-conditioned and stable

example2

example3

The reason is as following:

cond ( tan ) sec

2
2

2
2


tan
2
2

example 4
Consider approximating f ( x ) =e

-x 2

by f ( x ) = 1 x 2

ln ( ) .
=
For x =
1 , we have f ( x ) =
f ( x ) , this implies x =
Clearly, the backward error at x=1 is lim

1 ln ( )

The approximation f to f is unstable near x=1.


Exercise: Could you explain why the estimation is nothing close to
the real error? Could you give an upper bound for the
relative error

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

is less than 0.0001.

, where x ( 0.5,1) and the input error

You might also like