eciv 301 programming & graphics numerical methods for engineers lecture 5 approximations, errors...
Post on 21-Dec-2015
220 views
TRANSCRIPT
![Page 1: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/1.jpg)
ECIV 301
Programming & Graphics
Numerical Methods for Engineers
Lecture 5
Approximations, Errors and
The Taylor Series
![Page 2: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/2.jpg)
Objectives
• Distinguish between algorithm errors and roundoff errors.
• Introduce Taylor Theorem
• Calculate the numerical error of a finite difference formula for derivatives
![Page 3: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/3.jpg)
Significant Figures
![Page 4: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/4.jpg)
Significant Figures
• Designate the reliability of a numerical value
• The significant digits of a number are those that can be used with confidence
![Page 5: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/5.jpg)
Accuracy and PrecisionAccuracy
Pre
cisi
on
![Page 6: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/6.jpg)
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
![Page 7: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/7.jpg)
Roundoff Errors
14.3
141592654.3
A=d2
1415.3
![Page 8: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/8.jpg)
Roundoff Errors
A1=d12 A2=d2
2
d1=1.0 d2=1.000001
A1=3.14
14.3
A2=3.14000628
![Page 9: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/9.jpg)
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
![Page 10: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/10.jpg)
Error DefinitionTrue Value = Approximation + Error
Relative Error = True Error/True Value
t= (True Error/True Value)100%
![Page 11: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/11.jpg)
Approximate Error
Numerical Methods: the true value is not known apriori
%100ionapproximat
erroreapproximata
![Page 12: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/12.jpg)
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
![Page 13: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/13.jpg)
Approximate Error
%100ionapproximatcurrent
ionapproximatpreviousionapproximatcurrenta
![Page 14: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/14.jpg)
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
![Page 15: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/15.jpg)
Taylor’s Theorem
nn
i1ii
n
3i1i
i
2i1i
ii1iii1i
Rxx!n
xf
xx!3
xf
xx!2
xfxxxfxfxf
![Page 16: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/16.jpg)
Taylor’s Theorem
1n
i1i
1n
n xx!1n
fR
Error of Order (xi+1 – xi)n+1
![Page 17: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/17.jpg)
Numerical Differentiation
nn
i1ii
n
3i1i
i
2i1i
ii1iii1i
Rxx!n
xf
xx!3
xf
xx!2
xfxxxfxfxf
![Page 18: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/18.jpg)
Numerical Differentiation
ni1iii1i Rxxxfxfxf
i1i
i1i
i1ii xxO
xx
xfxfxf
First Divided Difference
![Page 19: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/19.jpg)
Forward Difference
vi
ti ti+1
vi+1
True Slope
Approximate Slope
ii
ii
tt
tvtv
dt
dv
1
1
![Page 20: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/20.jpg)
Backward Difference
n1iiii1i Rxxxfxfxf
1ii
1ii
1iii xxO
xx
xfxfxf
![Page 21: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/21.jpg)
Central Difference
2
i1ii
i1iii1i xx!2
xfxxxfxfxf
Forward
2
1iii
1iiii1i xx!2
xfxxxfxfxf
Backward
2i1i1ii h
!3
xf
h2
xfxfxf
Central
![Page 22: ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series](https://reader036.vdocuments.net/reader036/viewer/2022062516/56649d695503460f94a4744a/html5/thumbnails/22.jpg)
Homework
• Problems 4.5 and 4.6
• Due Wednesday Sept 10