sc lecture 0 2014

22
An introduction of Scientific Computing Chin-Tien Wu Institute of Mathematics Modelling and Scientific Computing 2014

Upload: phsieh007

Post on 12-Jan-2016

229 views

Category:

Documents


0 download

DESCRIPTION

SC Lecture 0 2014

TRANSCRIPT

Page 1: SC Lecture 0 2014

An introduction of Scientific Computing

Chin-Tien Wu Institute of Mathematics Modelling and

Scientific Computing

2014

Page 2: SC Lecture 0 2014

Why scientific computing?

• Simulation of natural phenomena • Virtual prototyping of engineering designs • More insights from unknown phenomenon • Much more

Page 3: SC Lecture 0 2014
Page 4: SC Lecture 0 2014
Page 5: SC Lecture 0 2014
Page 6: SC Lecture 0 2014
Page 7: SC Lecture 0 2014

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

Page 8: SC Lecture 0 2014

What should be cared in scientific computing?

Page 9: SC Lecture 0 2014

Sources of approximation

Page 10: SC Lecture 0 2014

Example 1

Page 11: SC Lecture 0 2014

Error measurement

Page 12: SC Lecture 0 2014

Where numerical errors come from?

Page 13: SC Lecture 0 2014

More about error (I)

Page 14: SC Lecture 0 2014

More about the error (II)

Page 15: SC Lecture 0 2014

( ) ( ) ( )ˆ

ˆ( ) sup

ˆxx

f x f x f xcond f

x x x−

=−

( ) ( ) ( )relative input error

ˆ ˆ( )xf x f x f x cond f x x x− ≤ ⋅ −

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

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

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

( ) ( ) ( ) ( ) ( ) ( )

( )( )

relative backward error

ˆ ˆ ˆˆ ˆ ˆ

ˆ ˆˆ ˆ ˆ( )x

f x f x f x f x f x f x

f xcond f x x x

f x

− = −

≤ ⋅ ⋅ −

Page 16: SC Lecture 0 2014

Evaluate the forward error, backward error and the condition number:

( ) ( ) ( )( ) ( )

( )( )( )

( ) ( ) ( )

ˆEvaluate function for approximate input instead ofthe true input , we have

Absolute forward error =

Relative forward error =

Condition number supx

f x x xx

f x x f x f x x

f x x f x f xx

f xf x

f x x f x f xx∆

= + ∆

′+ ∆ − ≈ ∆

+ ∆ − ′≈ ∆

+ ∆ −=

∆( )( )

f xx

x f x′

Page 17: SC Lecture 0 2014

In what condition the backward error can be controlled?

( )( )

''Clearly, when , and ,cond f

ff x

< ∞ < ∞ < ∞ˆ 0

x xf f

x−

→ ⇔ →

( ) ( ) ( ) ( )

( )( ) ( )( )

( ) ( ) ( ) ( )

2

ˆ

12

ˆ when ~ .

f x f x f x f x

f x x x f x x x

x xf x f x f x cond f x x

x

− = −

′ ′′= − + −

−⇒ − ≈ ⋅

Consider:

Moreover, the backward error can be estimated by

Relative forward errorRelative backward Condition number

Page 18: SC Lecture 0 2014

An algorithm is said to be well-posed if or well-conditioned if f̂

ˆ( ) for all xcond f x<< ∞

Relative error in the solution (output) is insensitive to the relative small change in the input.

A problem f is said to be well-posed if or well-conditioned if ( ) for all xcond f x<< ∞

A problem f or an algorithm is said to be stable if the

relative backward error is small f̂

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

Page 19: SC Lecture 0 2014

example2

Page 20: SC Lecture 0 2014
Page 21: SC Lecture 0 2014

( ) 2

2

tan sec tan2 2 22

condπ ε

π π π πε ε ε ε ε−

≈ − − − ≈ −

The reason is as following:

example3

Page 22: SC Lecture 0 2014

example 4 ( ) ( )( ) ( ) ( )

( )

2-x 2

0

ˆConsider approximating =e by 1 ˆ ˆ ˆFor 1 , we have , this implies ln .

1 lnClearly, the backward error at x=1 is lim

1

ˆThe approximation to is unstable near x=1.

f x f x x

x f x f x x

f f

ε

ε ε ε

ε ε

ε→

= −

= − = = = −

− − −= ∞

Exercise: Could you explain why the estimation is nothing close to the real error? Could you give an upper bound for the relative error , where and the input error is less than 0.0001.

( )ˆ ˆ( )

( )f x f x

f x− ( )0.5,1x∈