8/18/2019 C01.03 Truncation Errors & Taylor Series
1/17
Numerical Methods with Applications (MEC500)
Chapter 01
Truncation error & Taylor Series
r !al"it Sin#h$aculty o% Mechanical En#ineerin#ni'ersiti Tenolo#i MAA (iTM)*+ce, T1-A1.-1C
Adapted from : Ramlan Kasiran
8/18/2019 C01.03 Truncation Errors & Taylor Series
2/17
8/18/2019 C01.03 Truncation Errors & Taylor Series
3/17
8ce 2rain#
9ow con6dent we are in our approimate result:
The ;uestion is
8/18/2019 C01.03 Truncation Errors & Taylor Series
4/17
Truncation error
Truncation errors , error that result %rom usin# an approimation
in place o% an eact mathematical procedure3
Eample Math model,
Analytical solution,
Numerical Method solution,
Taylor Series #i'e insi#ht into the truncation errors %or the numericalmethod?
'm
c#
dt
d'−=
i1i
i1i
tt
)'(t)'(t
@t
@'
dt
d'
−
−=≅
+
+
( )(cAm)te1c
#m'(t) −−=
8/18/2019 C01.03 Truncation Errors & Taylor Series
5/17
Taylor theorem & series
Taylor theorem states that any smooth %unction (such astri#onometric eponential etc) can 2e approimated as apolynomial (i3e power series)3
Taylor series pro'ides a means to predict the 'alue o% a %unctionat one point in terms o% the %unction 'alue and its deri'ati'es atanother point3
•
E, %(0)B5 %(0)BD %(0)B %(0)B0
%(03D)B:
TS is a representations o% a %unction as an in6nite sums o% termscalculated %rom the 'alues o% its deri'ati'es at a sin#le point3
Taylor Series is widely used to epress %unctions (i3e3 math
models) in an approimate manner3
F9G:
8/18/2019 C01.03 Truncation Errors & Taylor Series
6/17
Taylor theorem & series
Fhy do we need to rewrite a %unction in the %orm o% an in6niteseries:
• Eample isnt 1(1- ) #ood enou#h as an epression: 8n %acta%ter the rewrite the epression 1H H D H 333H n H 333 ise'en lon#er and is in6nite in nature3
Can we inte#rate :
9ow a calculator calculate sine cosine tan#ent etc:
Archimedes
TS #i'es a way to 6nd the approimate 'alues o% a %unctions 2y2asic arithmetic operations o% H - and 3
8/18/2019 C01.03 Truncation Errors & Taylor Series
7/17
Taylor series
!uild Taylor series term 2y term?
ero order approimation only true i% iH1
and i are 'ery close to each other3
6rst order approimation in %orm o% astrai#ht line
nth order approimation (iH1- i)B h step
sie
emainder term n account$or all terms %orm (nH1) to ∞B Truncation Error
Xi Xi+1
)%()%( i1i ≅+
)h(% )%()%( iI
i1i +≅+
1)H(n1)H(n
n h1)?H(n
)(% B
ξ
nni
(n)Ji
(J)Di
II
iI
i1i Hhn?
)(% HHh
J?
)(% Hh
D?
)(% H)h(% )%()%( +≅
+
8/18/2019 C01.03 Truncation Errors & Taylor Series
8/17
Taylor series - Eample
se ero- throu#h %ourth-order Taylor Series Epansion (TSE) toapproimate the %ollowin# %unction %rom i B 0 with hB13
%() B -031K -0315J - 035D -03D5 H 13D LKth orderpolynomial
redict the %unction 'alue at iH1?
8/18/2019 C01.03 Truncation Errors & Taylor Series
9/17
Taylor series O 6nal remars
8n #eneral the nth order Taylor series epansion will 2e eact %oran nth order polynomial3
8n other %unctions (e#3 Eponential & sinusoids) 6nite num2er o%terms will not yield an eact estimate3 Thus the remainder termn is o% the order o% h
nH1 meanin#,
•
The more terms are used the smaller the error and• The smaller the spacin# the smaller the error %or a #i'en
num2er o% terms3
8n most cases inclusion o% only a %ew terms will #i'e anapproimation close enou#h %or practical purpose3
So how many terms are re;uired to #et Pclose enou#h:
8/18/2019 C01.03 Truncation Errors & Taylor Series
10/17
Taylor series O 6nal remars
So how many terms are re;uired to #et close enou#h: ⇒ epends on then?
• ξ is not nown eactly somewhere i
8/18/2019 C01.03 Truncation Errors & Taylor Series
11/17
emainder term o% TSE
Supposed TSE is truncated a%ter the ero-order term ⇒ %(iH1) Q %(i)
• Thus
Now truncate a%ter the 6rst order #i'es ⇒ 0 Q %(i)h
eri'ati'e mean-'alue theoremR
8/18/2019 C01.03 Truncation Errors & Taylor Series
12/17
sin# Taylor Series to estimate truncation errors
ecall the %allin# 2un#ee "umper:
Epand usin# TSE333
Truncate a%ter 6rst order term33
earran#e,
Truncation
error
1st order approimationo% deri'ati'e
i1i
i1i
t-t)'(t-)'(t
@t@'
dtd'
+
+=≈
nJii
ii1i 333hJ?
)(tII'Ih
D?
)(tI'I )h(t'I)'(t)'(t ++++=
+
1ii1i)h(t'I)'(t)'(t ++=
+
h
-
h
)'(t-)'(t )(t'I 1i1ii
+=
*(h)error Truncation
h(D)(h)
)(%
h
error5 Truncation
h(D)?
)(%
(D)(D)
1
(D)
(D)
1
=
=
=
ξ
ξ
8/18/2019 C01.03 Truncation Errors & Taylor Series
13/17
Numerical i7erentiation
The 6rst order Taylor series can 2e used to calculate approimations toderi'ati'es,
• i'en,
• Then,
This is termed a
8/18/2019 C01.03 Truncation Errors & Taylor Series
14/17
Numerical i7erentiation
Type o% 6nite di'ided di7erence approimationsLependin# the points used
orward!
"ac#ward!
$entered!
*(h)h
)%()%()(% i1ii
I+
−=
+
*(h)h
)%()%()(% 1iii
I+
−=
−
)*(h
Dh
)%()%()(% D1i1ii
I+
−=
−+
8/18/2019 C01.03 Truncation Errors & Taylor Series
15/17
Total numerical error
The total numerical error is the summation o% the truncation andround-o7 errors3
• The truncation error #enerally increases as the step sieincreases3
• ound o7 error decreases as the step sie increases
8/18/2019 C01.03 Truncation Errors & Taylor Series
16/17
Control o% numerical error
$or most practical cases eact numerical error is not nown3
There%ore we must settle %or estimate o% errors3
Error estimates are 2ased on the eperience and "ud#ment o%the en#ineers3
Error analysis is to a certain etent an art always o2ser'e the%ollowin# #uidesR
• Care%ul with arithmetic manipulations
• se etended-precision arithmetic
• Attempt to predict total numerical error usin# Taylor series
•
er%orm numerical eperiments O try di7erent step sies3
8/18/2019 C01.03 Truncation Errors & Taylor Series
17/17
Next lecture:
Solving non-linear equation
Endlass dismissed