Chaper 4. Truncaion Errors and he Taylor Series Truncaion Errors and he Taylor Series Non-elemenary funcions such as rigonomeric, eponenial, and ohers are epressed in an approimae fashion using Taylor series when heir values, derivaives, and inegrals are compued. Any smooh funcion can be approimaed as a polynomial. Taylor series provides a means o predic he value of a funcion a one poin in erms of he funcion value and is derivaives a anoher poin.
Figure 4. Eample To oge he cos() ( ) for small : cos If 0.5 2 4 + 2! 4! 6 6! +L cos(0.5)-0.25+0.002604-0.000027+ 0.877582 From he supporing heory, for his series, he error is no greaer han he firs omied erm. 8 8! for 0.5 0.000000
Any smooh funcion can be approimaed as a polynomial. f( i+ ) f( i ) i i zero order approimaion, only rue if i+ and i are very close o each oher. f( i+ ) f( i ) + f ( i ) ( i+ - i ) firs order approimaion, in form of a sraigh line n h order approimaion f ( f 2! + ( n) f n + ( i+ i ) + Rn n! 2 i+ ) f ( i ) + f ( i )( i+ i ) + ( i+ i ) K ( i+ - i ) h sep size (define firs) R n ( n+ ) f ( ε ) ( n + ) h ( n + )! Reminder erm, R n, accouns for all erms from (n+) o infiniy.
Fig 4.2 Fig 4.3
ε is no known eacly, lies somewhere beween i+ >ε > i. Need o deermine f n+ (), o do his you need df'( f'(). If we knew f(), here wouldn be any need o perform he Taylor series epansion. However, RO(h n+ ), (n+) h order, he order of runcaion error is h n+. O(h), halving he sep size will halve he error. O(h 2 ), halving he sep size will quarer he error. Truncaion error is decreased by addiion of erms o he Taylor series. If h is sufficienly small, only a few erms may be required o obain an approimaion close enough o he acual value for pracical purposes. Eample: Calculae series, correc o he 3 digis. + +K 2 3 4
Error Propagaion () refers o he oaing poin (or compuer) represenaion of he real number. Because a compuer can hold a finie number of significan figures for a given number, here may be an error (round-off error) associaed wih he oaing poin represenaion. The error is deermined by he precision of he compuer (ε).. Suppose ha we have a funcion f() ha is dependen on a single independen variable. () is an approimaion of and we would like o esimae he effec of discrepancy beween and () on he value of he funcion: Δf ( ) f ( ) f ( ) boh f() and are unknown Employ Taylor series o compue f() near f( he second and higher order erms f ( ) f ( ) f ( )( ) ), dropping
Figure 4.7 Also, le ε, he fracional relaive error, be he error associaed wih (). Then ( ) ε where ε ε Machine epsilon, upper boundary Rearranging, we ge ( ) ε ( ) ( ε + )
Case : Addiion of and 2 wih associaed errors ε and ε 2 yields he following resul: ( ) (+ε ) ( 2 ) 2 (+ε 2 ) ( )+( 2 )ε +ε 2 2 + + 2 ε ( ) + ( 2) ( + 2) ε 2 00% + + A large error could resul from addiion if and 2 are almos equal magniude bu opposie sign, herefore one should avoid subracing nearly equal numbers. 2 2 2 Generalizaion: Suppose he numbers ( ), ( 2 ), ( 3 ),, ( n ) are approimaions o, 2, 3,, n and ha in each case he maimum possible error is E. ( i )-E i ( i )+E E i E I follows by addiion ha ( i ) ne i ( i ) + So ha i ( i ) ne ) ne Therefore, he maimum possible error in he sum of ( i ) is ne. ne
Case 2: Muliplicaion of and 2 wih associaed errors e and e 2 resuls in: ( ) ( 2) ( ) 2( 2) ( ) ( 2) 2 ( ε ε 2 2 + ) ( ) ( 2) 2 ε ε 2 % 2 ε 00% 2 Since ε, ε 2 are boh small, he erm ε ε 2 should be small relaive o ε +ε 2. Thus he magniude of he error associaed wih one muliplicaion or division sep should be ε +ε 2. ε ε (upper bound) Alhough error of one calculaion may no be significan, if 00 calculaions were done, he error is hen approimaely 00ε. The magniude of error associaed wih a calculaion is direcly proporional o he number of muliplicaion seps. Refer o Table 4.3
Overow: Any number larger han he larges number ha can be epressed on a compuer will resul in an overow. Underow (Hole) : Any posiive number smaller han he smalles number ha can be represened on a compuer will resul an underow. Sable Algorihm: In eended calculaions, i is likely ha many round-offs will be made. Each of hese plays he role of an inpu error for he remainder of he compuaion, impacing he evenual en oupu. Algorihms for which he cumulaive effec of all such errors are limied, so ha a useful resul is generaed, are called sable algorihms. When accumulaion is devasaing and he soluion is overwhelmed by he error, such algorihms are called unsable. Figure 4.8