View
215
Download
1
Tags:
Embed Size (px)
Citation preview
ECIV 301
Programming & Graphics
Numerical Methods for Engineers
Lecture 5
Approximations, Errors and
The Taylor Series
Objectives
• Distinguish between algorithm errors and roundoff errors.
• Introduce Taylor Theorem
• Calculate the numerical error of a finite difference formula for derivatives
Significant Figures
Significant Figures
• Designate the reliability of a numerical value
• The significant digits of a number are those that can be used with confidence
Accuracy and PrecisionAccuracy
Pre
cisi
on
Truncation Errors
vi
ti ti+1
vi+1
True Slope
Approximate Slope
ii
ii
tt
tvtv
dt
dv
1
1
Truncation errors due to using approximation in place of exact solution
Roundoff Errors
14.3
141592654.3
A=d2
1415.3
Roundoff Errors
A1=d12 A2=d2
2
d1=1.0 d2=1.000001
A1=3.14
14.3
A2=3.14000628
Error DefinitionTrue Value = Approximation + Error
Numerical Error
0
15
30
45
60
0 5 10 15 20 25
Time (s)
Ve
loc
ity
(m
/s)
Analytic Solution
Numerica Solutionl
Et=true value - approximation
Does not account for order of magnitude
Error DefinitionTrue Value = Approximation + Error
Relative Error = True Error/True Value
t= (True Error/True Value)100%
Approximate Error
Numerical Methods: the true value is not known apriori
%100ionapproximat
erroreapproximata
Approximate ErrorNumerical Methods: approximate procedures
!621
32
n
xxxxe
nx Mclaurin Series
1xe
xex 1
21
2xxex
15.0 e
5.15.0 e
625.15.0 e
648721271.15.0 e Exact
Approximate Error
%100ionapproximatcurrent
ionapproximatpreviousionapproximatcurrenta
The Taylor Series
vi
ti ti+1
vi+1
vivi
tititi ti+1ti+1
vi+1vi+1
Predict value of a function at one point in terms of the function value and its
derivatives at another point
Taylor’s Theorem
nn
i1ii
n
3i1i
i
2i1i
ii1iii1i
Rxx!n
xf
xx!3
xf
xx!2
xfxxxfxfxf
Taylor’s Theorem
1n
i1i
1n
n xx!1n
fR
Error of Order (xi+1 – xi)n+1
Numerical Differentiation
nn
i1ii
n
3i1i
i
2i1i
ii1iii1i
Rxx!n
xf
xx!3
xf
xx!2
xfxxxfxfxf
Numerical Differentiation
ni1iii1i Rxxxfxfxf
i1i
i1i
i1ii xxO
xx
xfxfxf
First Divided Difference
Forward Difference
vi
ti ti+1
vi+1
True Slope
Approximate Slope
ii
ii
tt
tvtv
dt
dv
1
1
Backward Difference
n1iiii1i Rxxxfxfxf
1ii
1ii
1iii xxO
xx
xfxfxf
Central Difference
2
i1ii
i1iii1i xx!2
xfxxxfxfxf
Forward
2
1iii
1iiii1i xx!2
xfxxxfxfxf
Backward
2i1i1ii h
!3
xf
h2
xfxfxf
Central
Homework
• Problems 4.5 and 4.6
• Due Wednesday Sept 10