수치해석 (절단오차와 테일러급수)

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

CHAPTER 4

절단 오차와 Taylor 급수

Truncation Errors and the


Taylor Series
Numerical Errors
The difference between the true value and
the approximation
Approximation = true value + true error
Et = true value  approximation = x*  x
True Error x *  x
Relative Error  
True Value x*
x * x
or in percent t   100 %
x*
Approximate Error
 But the true value is not known
 If we knew it, we wouldn’t have a problem
 Use approximate error
approximat e error
a  100%
approximat ion
present approx.  previous approx.
 100 %
present approximat ion
x new  x old
Relative error   100 %
x new
Numerical Accuracy
Truncation error : Method dependent
 Errors which result from using an approximation
rather than an exact procedure
h2 h3
f ( x i  h )  f ( x i )  hf ( x i )  f ( x i )  f ( x i )  ....
2! 3!
Round-off error : Machine dependent
 Errors which result from not being able to
adequately represent the true value
 Result from using an approximate number to
represent exact number

  3.1416 , e  2.71828
Taylor Series Expansion
 Construction of finite-difference formula
 Numerical accuracy: discretization error
a x Base point x = a

 f ( x )  co  c1 ( x  a)  c 2 ( x  a) 2  c 3 ( x  a) 3    co  f (a)

 f ( x )  c 1  2 c 2 ( x  a )  3 c 3 ( x  a ) 2
  c 1  f ( a )
 f ( x )  2 c  6 c ( x  a )    c 2  f ( a ) / 2!
2 3

 f ( x )  6 c 3    c 3  f ( a ) / 3!
 
 (m)
 f ( x )  ( m! )c m  ( m  1) m ( m  1)  2 c m  1 ( x  x o )    c m  f ( m ) ( a ) / m!

 
f ( m ) (a)
 f ( x)  c
m 0
m ( x  a ) m
 
m 0 m!
( x  a) m
Taylor Series and Remainder
 Taylor series (base point x = a)

f ( m ) (a)
f ( x)  
m 0 m!
( x  a) m

f ( a ) f ( a ) f ( n) (a)


 f ( a )  f ( a )( x  a )  ( x  a) 
2
( x  a )  ... 
3
( x  a ) n  Rn
2! 3! n!

 Remainder

f ( )
( n 1 )
n1
Rn  ( x  a)
( n  1)!
Taylor Series and Remainder
f ( xi )
f ( xi 1 )  f ( xi )  f ( xi )( xi 1  xi )  ( xi 1  xi ) 2
2!
f (3) ( xi ) f ( n ) ( xi )
 ( xi 1  xi )  ... 
3
( xi 1  xi ) n  Rn
3! n!
f ( xi ) 2
 f ( xi )  f ( xi )h  h
2!
f (3) ( xi ) 3 f ( n ) ( xi ) n
 h  ...  h  Rn
3! n!

f ( )
( n 1)
n 1 f ( ) n 1 n 1
( n 1)
Rn  ( xi 1  xi )  h  O(h )
(n  1)! (n  1)!
(예제) 0~4차 테일러 급수 전개를 이용하여 𝑥𝑖 = 0(ℎ = 1)로부터 𝑥𝑖+1 = 1
에서 다음 함수 값을 구하라.

f ( x)  0.1x 4  0.15 x3  0.5 x 2  0.25 x  1.2


(예제) 𝑥𝑖 = 𝜋/4에서 𝑓 𝑥 = cos 𝑥의 함수 값과 미분에 근거하여 0~6차 테일
러 급수 전개를 이용하여 𝑥𝑖+1 = 𝜋/3에서 𝑓 𝑥 = cos 𝑥 의 함수 값을 근사화
하라.
Order n f(n)(x) f(π/3) εt(%)
0 cos x 0.707106781 -41.4
1 -sin x 0.521986659 -4.4
2 -cos x 0.497754491 0.449
3 sin x 0.499869147 2.62×10-2
4 cos x 0.500007551 -1.51×10-3
5 -sin x 0.500000304 -6.08×10-5
6 -cos x 0.499999988 2.44×10-6
The Remainder for the Taylor Series
Expansion
f ( xi ) 2 f ( 3) ( xi ) 3 f ( n 1) ( ) n 1
f ( xi 1 )  f ( xi )  f ( xi )h  h  h  ... Rn  h
2! 3! (n  1)!

Truncating the Taylor series


expansion after the zero-order
term,
f ( xi 1 )  f ( xi )

f ( xi ) 2 f (3) ( xi ) 3
R0  f ( xi )h  h  h  ...
2! 3!
 f ( xi )h
Graphical depiction of the derivative mean-value theorem

R0 f ( ) 2
f ( )  R0  f ( )h R1  h
h 2!
Using the Taylor Series to Estimate
Truncation Errors
Expanding velocity as a function of time in a Taylor series,
v" (ti )
v (ti 1 )  v(ti )  v' (ti )(ti 1  ti )  (ti 1  ti ) 2  ...  Rn
2!
Truncating the series after the first derivative term,
v (ti 1 )  v (ti ) R1
v ' (t i )  
ti 1  ti ti 1  ti
    
First order Truncation
approximat ion error

R1 v" ( )
 (ti 1  ti )  O(ti 1  ti )  O(h)
ti 1  ti 2!

The error of the derivative approximation should be proportional


to the step size.
Truncation Error
 Taylor series expansion
h2 h3
f ( x i 1 )  f ( x i  h)  f ( x i )  hf ( x i )  f ( x i )  f ( x i )  ....
2! 3!
 Example (higher-order terms truncated)
x x2 x3 x4 x5
e  1 x      ....
2! 3! 4! 5!
3 5 7 9
x x x x
sin x  x      ....
3! 5! 7 ! 9!

(xi = 0, h = x  xi+1 = x)
Euler’s Formula An amazing use for infinite series:

x 2 x3 x 4 Substitute xi for x.
e  1  x     
x

2! 3! 4!

 xi 2  xi 3  xi 4  xi 5  xi 6
e  1  xi 
xi
     
2! 3! 4! 5! 6!

x 2i 2 x3i 3 x 4i 4 x5i 5 x 6i 6
e  1  xi 
xi
     
2! 3! 4! 5! 6!

x 2 x3i x 4 x 5i x 6
e  1  xi  
xi
     Factor out the i terms.
2! 3! 4! 5! 6!

x2 x4 x6  x3 x5 
e  1       i  x     
xi

2! 4! 6!  3! 5! 

 
2 4 6
x x x x3 x5
e  1       i  x     
xi

2! 4! 6!  3! 5! 

This is the series for This is the series for


cosine. sine.

e xi  cos  x   i sin  x  Let x 


ei  cos    i sin  

ei  1  i  0
This amazing identity contains
i
e 1  0
the five most famous numbers in
mathematics, and shows that they
are interrelated.

수치 미분
(a) Forward finite-divided-difference approximation of the first
derivative

f ( xi ) 2
f ( xi 1 )  f ( xi  h)  f ( xi )  f ( xi )h  h  ....
2!
f ( xi 1 )  f ( xi ) f ( xi ) f i
f ( xi )   h  O ( h)
h 2! h
(b) Backward finite-divided-difference approximation of the
first derivative

f ( xi ) 2
f ( xi 1 )  f ( xi )  f ( xi ) h  h  ....
2!
f ( xi )  f ( xi 1 ) f ( xi ) f
f ( xi )   h  i  O ( h)
h 2! h
(c) centered finite-divided-difference approximation of the
first derivative
Centered difference Approximation of the first
derivative
f ( xi ) 2
f ( xi 1 )  f ( xi  h)  f ( xi )  f ( xi )h  h  ....
2!

-
f ( xi ) 2
f ( xi 1 )  f ( xi )  f ( xi ) h  h  ....
2!

2 f (3) ( xi ) 3
f ( xi 1 )  f ( xi 1 )  2 f ( xi )h  h  ....
3!

f ( xi 1 )  f ( xi 1 ) f (3) ( xi ) 2 f ( xi 1 )  f ( xi 1 )
f ( xi )   h  ....   O(h 2 )
2h 3! 2h
(예제) 미분의 전진, 후진, 중심 차분 근사를 이용하여 𝑥 = 2에서 계산간격이
ℎ = 0.2와 ℎ = 0.1인 두 경우에 𝑓 𝑥 = 25𝑥 3 − 6𝑥 2 + 7𝑥 − 88의 미분값과 백
분율 참오차을 계산하라.
Finite Difference Approximation of Higher
Derivative
f ( xi )
f ( xi  2 )  f ( xi  2h)  f ( xi )  f ( xi )(2h)  ( 2h) 2  ....
2!

-
 f ( xi ) 2 

2 f ( xi 1 )  2 f ( xi  h)  2  f ( xi )  f ( xi )h  h  ....
 2! 

f ( xi  2 )  2 f ( xi 1 )   f ( xi )  f ( xi )h 2  ....

f ( xi  2 )  2 f ( xi 1 )  f ( xi )
f " ( xi )  2
 O ( h)
h
The 2nd backward finite divided difference
f ( xi )  2 f ( xi 1 )  f ( xi  2 )
f " ( xi )  2
 O (h)
h

The 2nd centered finite divided difference


f ( xi 1 )  2 f ( xi )  f ( xi 1 )
f " ( xi )  2
 O ( h 2
)
h
Error Propagation
How errors in numbers can propagate through mathematical functions

 Functions of a Single Variable f x 


~
x 는 x의 근사값

오차  ~x  x  ~x 가 함수에 미치는 영향  f ( ~
x )  f ( x)  f ( ~
x)
~
x 가 x 에 매우 가깝고, f (x~ ) 가 연속적이며 미분가능 하다면

~ ~ ~ f ' ' ( ~x ) ~ f ' ' ' ( ~x )


f ( x)  f ( x )  f ' ( x ) ( x  x )  (x  x ) 
2
( x  ~x )  
3

2! 3!
f ( ~x )  f ( x )  f ( ~x )  f ' ( ~x ) ( x  ~x )
(예제) 𝑥෤ = 2.5, ∆𝑥෤ = 0.01일 때, 𝑓 𝑥 = 𝑥 3 인 함수의 오차와 참값의 범위를
구하라
Error Propagation
 Functions of More than one Variable
f f f
f ( x1 , x2 ,      xn )  x1  x2      xn
x1 x2 xn
𝑐𝑡
𝑚𝑔
(예제) 낙하산병의 속도는 다음과 같이 주어진다. 𝑣 𝑡 = 1−𝑒 −𝑚
. 𝑡=
𝑐
6 에서 1차 오차 해석으로 속도의 추정 오차를 구하라. 단, 𝑔 = 9.8, 𝑚 = 50,
𝑐 = 12.5 ± 1.5

You might also like