eciv 301 programming & graphics numerical methods for engineers lecture 6 roots of equations...
Post on 20-Dec-2015
217 views
TRANSCRIPT
ECIV 301
Programming & Graphics
Numerical Methods for Engineers
Lecture 6
Roots of Equations
Bracketing Methods
Last Time - 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
Last Time - Error Definition
Et=true value - approximation
True Error
t= (Et/True Value)100%
Relative True Error
Last Time - Error Definition
%100ionapproximat
erroreapproximata
Approximate Relative Error
Iteration Relative Error
%100ionapproximatcurrent
ionapproximatpreviousionapproximatcurrent a
Last Time - 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
Last Time - Taylor’s Theorem
nn
i1ii
n
3i1i
i
2i1i
ii1iii1i
Rxx!n
xf
xx!3
xf
xx!2
xfxxxfxfxf
Error of Order (xi+1 – xi)n+1
Last Time - Numerical Differentiation
ii
iii
ffxf
xx
xx
1
1
Forward Difference
1
1
xx
xx
ii
iii
ffxfBackward Difference
11
11
xx
xx
ii
iii
ffxfCentral Difference
The Problem
To design the parachute:
v=10 m/st=3 secm=64 kgg=9.81
c=?
tm
c
ec
gmv 1
CANNOT rearrange to solve for c
Objectives
• Master methods to compute roots of equations
• Assess reliability of each method
• Choose best method for a specific problem
ClassificationMethods
Bracketing Open
• Graphical• Bisection Method• False Position
• Fixed Point Iteration• Newton-Raphson• Secand
Graphical Methods)(1)( tve
c
gmcf
tm
c
f(c)
-10
-5
0
5
10
15
20
25
0 50 100 150 200
f(c)
c
f(c)
v=10 m/st=3 secm=65 kgg=9.81
Graphical Methods
No Roots Even Number of Roots
Lower and Upper Bounds of interval yield values of same sign
Graphical MethodsLower and Upper Bounds of interval yield values of opposite sign
Odd number of Roots
Bisection Method
Choose Lower, xl and Upper xu guesses that bracket the root
f(c)
-10
-5
0
5
10
15
20
25
0 50 100 150 200
f(c)
xl xu
Bisection Method
Calculate New Estimate xr and f(xr)
f(c)
-10
-5
0
5
10
15
20
25
0 50 100 150 200
f(c)
xl xu
xr=0.5(xl+xu)
Bisection MethodDefine New Interval that Brackets the RootCheck sign of
f(xl)*f(xr) and f(xu)*f(xr)
f(c)
-10
-5
0
5
10
15
20
25
0 50 100 150 200
f(c)
xl xu
Previous Guess
xu
Bisection MethodRepeat until convergence
f(c)
-10
-5
0
5
10
15
20
25
0 50 100 150 200
f(c)
xl xu
Previous Guess
xr=0.5(xl+xu)
Bisection - FlowchartLoop
xold=x
x=(xl+xu)/2
Error=100*abs(x-xold)/x
Sign=f(xl)*f(xr)
Sign
xu=x xl=xError=0
Error<Eall ROOT=xFALSE
<0 >0