an introduction of scientific computingctw/scientific... · an introduction of scientific computing...
TRANSCRIPT
![Page 1: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/1.jpg)
An introduction of Scientific Computing
Institute of Mathematics Modelling and Scientific Computing
National Chiao-Tung University
Chin-Tien Wu
![Page 2: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/2.jpg)
Why scientific computing?
• Simulation of natural phenomena• Virtual prototyping of engineering designs• More insights from unknown phenomenon• Much more
![Page 3: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/3.jpg)
![Page 4: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/4.jpg)
![Page 5: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/5.jpg)
![Page 6: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/6.jpg)
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 7: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/7.jpg)
What should be cared in scientific computing?
![Page 8: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/8.jpg)
Sources of approximation
![Page 9: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/9.jpg)
Example 1
![Page 10: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/10.jpg)
Error measurement
![Page 11: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/11.jpg)
Where numerical errors come from?
![Page 12: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/12.jpg)
More about error (I)
![Page 13: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/13.jpg)
More about the error (II)
• Condition number of a problem f at value x:
![Page 14: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/14.jpg)
( ) ( ) ( )ˆ
ˆ( ) 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 15: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/15.jpg)
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 16: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/16.jpg)
In what condition the backward error can be controlled?
( )( )Clearly, when ,
cond ff x
< ∞⎧⎪⎨ < ∞⎪⎩
ˆ 0x x
f fx−
→ ⇔ →
( ) ( ) ( ) ( )
( )( ) ( )( )
( ) ( ) ( ) ( )
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 17: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/17.jpg)
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 smallf̂
Accurate numerical solution can be obtained only when a problem and computational algorithm are well-conditioned and stable
![Page 18: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/18.jpg)
example2
![Page 19: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/19.jpg)
![Page 20: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/20.jpg)
( ) 2
2
tan sec tan2 2 22
condπ ε
π π π πε ε ε ε ε−
⎛ ⎞ ⎛ ⎞≈ − − − ≈ −⎜ ⎟ ⎜ ⎟⎝ ⎠ ⎝ ⎠
The reason is as following:
example3
![Page 21: An introduction of Scientific Computingctw/Scientific... · An introduction of Scientific Computing Institute of Mathematics Modelling and Scientific Computing National Chiao-Tung](https://reader034.vdocuments.mx/reader034/viewer/2022042620/5f406a3f59df29741c38d3c7/html5/thumbnails/21.jpg)
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: Estimate the backward error by the formula given at p.11.Could you explain why the estimation is nothing close to the real error?