Upload
cornelia-lynch
View
213
Download
0
Embed Size (px)
Citation preview
Case Study #1Case Study #1Finding Roots of EquationsFinding Roots of Equations
~~CE402 Numerical Methods for CE402 Numerical Methods for
EngineersEngineers
Dr. Fritz FiedlerDr. Fritz Fiedler
~~
Andy AbramsAndy Abrams
David CrosbyDavid Crosby
Zack MunstermannZack Munstermann
IntroductionIntroduction
Why find roots of equations?Why find roots of equations? Equations are used to model physical Equations are used to model physical
systemssystems Knowing the roots of these equations Knowing the roots of these equations
helps us understand the physical system helps us understand the physical system How do we find the roots?How do we find the roots?
AnalyticallyAnalytically NumericallyNumerically
GraphingGraphing Graphing the equation over a useful Graphing the equation over a useful
range can identify several points of range can identify several points of interestinterest Rough estimate of the rootsRough estimate of the roots ContinuityContinuity Local minima and maximaLocal minima and maxima
Graphing is simple, yet roughGraphing is simple, yet rough It is often used to define functions for It is often used to define functions for
initial guesses in other methods.initial guesses in other methods.
Bisection MethodBisection Method The bisection method is a “bracketing The bisection method is a “bracketing
method”method” Initial guesses must surround the root.Initial guesses must surround the root. Function must be continuous near the rootFunction must be continuous near the root
Bracketing values Xu and Xl are chosenBracketing values Xu and Xl are chosen New root estimated by Xr = (Xl + Xu)/2New root estimated by Xr = (Xl + Xu)/2
If f(Xr)f(Xl) < 0 then Xr = Xu…continue…If f(Xr)f(Xl) < 0 then Xr = Xu…continue… If f(Xr)f(Xl) > 0 then Xr = Xl…continue…If f(Xr)f(Xl) > 0 then Xr = Xl…continue…
2ul
r
xxx
Bisection Method: continuedBisection Method: continued
Bracketing values Xu and Xl are chosenBracketing values Xu and Xl are chosen New root estimated by Xr = (Xl + Xu)/2New root estimated by Xr = (Xl + Xu)/2
If f(Xr)f(Xl) < 0 then Xr = Xu…continue…If f(Xr)f(Xl) < 0 then Xr = Xu…continue… If f(Xr)f(Xl) > 0 then Xr = Xl…continue…If f(Xr)f(Xl) > 0 then Xr = Xl…continue… If f(Xr)f(Xl) = 0 then Xr = root…stop.If f(Xr)f(Xl) = 0 then Xr = root…stop.
Limitations of the bisection methodLimitations of the bisection method Relatively inefficientRelatively inefficient Must know equation wellMust know equation well
2ul
r
xxx
Newton Raphson MethodNewton Raphson Method The Newton-Raphson method is an “open The Newton-Raphson method is an “open
method”method” Need only one initial guessNeed only one initial guess Must know derivative of functionMust know derivative of function
Initial guess of root Xi is chosenInitial guess of root Xi is chosen New root estimated by Xr = Xi – New root estimated by Xr = Xi –
f(Xi)/f’(Xi)f(Xi)/f’(Xi) If error of Xr is acceptable, stop.If error of Xr is acceptable, stop. If error is too large, Xi = Xr…continue…If error is too large, Xi = Xr…continue…
2ul
r
xxx
Newton-Raphson Method: continuedNewton-Raphson Method: continued
Constraints on N.R.Constraints on N.R. Good initial guess (convergence)Good initial guess (convergence) Derivative must be easily evaluatedDerivative must be easily evaluated Derivative must be continuous and non-Derivative must be continuous and non-
zero near rootzero near root Problems from inflection points and local Problems from inflection points and local
extremes near rootextremes near root
2ul
r
xxx
ExampleExample To compare these methods we will consider To compare these methods we will consider
water flowing in a rectangular open channelwater flowing in a rectangular open channel Flow governed by Manning’s equationFlow governed by Manning’s equation
Where: Where: QQ = volumetric flow rate (m3/s) = volumetric flow rate (m3/s) BB = channel width (m) = channel width (m)
H H = height of water in channel (m) = height of water in channel (m) nn = Manning’s coefficient of roughness = Manning’s coefficient of roughness RR = hydraulic radius (m) = hydraulic radius (m) SS = channel slope = channel slope
2ul
r
xxx
2/13/2 SRn
BHQ 2/13/2 SR
n
BHQ
Example: continuedExample: continued In the design of this channel, we wish In the design of this channel, we wish
to find depth of flow and flow velocity to find depth of flow and flow velocity for a range of channel widthsfor a range of channel widths
V = Q/(BH)V = Q/(BH)
First we graphed the equation for a given First we graphed the equation for a given set of parametersset of parameters
Used bisection and N.R. to solve for depth Used bisection and N.R. to solve for depth of flow for a range of channel widthsof flow for a range of channel widths
2ul
r
xxx
2/13/2 SRn
BHQ 2/13/2 SR
n
BHQ
Example: continuedExample: continued
2ul
r
xxx
2/13/2 SRn
BHQ
Manning's Equation
-30
-25
-20
-15
-10
-5
0
5
10
4 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5
depth of Flow (m)
f(H
)Graphing:Graphing:
S = 0.0002S = 0.0002B = 20 mB = 20 mn = 0.03n = 0.03Q = 100 m3/sQ = 100 m3/s
Range:Range:4< H < 54< H < 5
Root in this case (by inspection) is approximately 4.82 mRoot in this case (by inspection) is approximately 4.82 m
Example: continuedExample: continued
Bisection method:Bisection method:
S = 0.0002S = 0.0002n = 0.03n = 0.03Q = 100 m3/sQ = 100 m3/s
Range:Range:5m < B < 35m5m < B < 35m
2ul
r
xxx
2/13/2 SRn
BHQ 2/13/2 SR
n
BHQ
Channel Width vs. Depth
0
5
10
15
20
25
30
0 10 20 30 40
Width (m)D
ep
th (
m)
Channel Width vs. Velocity
0
0.2
0.4
0.6
0.8
1
1.2
0 10 20 30 40
Width (m)
Ve
locit
y (
m/s
)
Example: continuedExample: continued
Newton-Raphson:Newton-Raphson:
S = 0.0002S = 0.0002n = 0.03n = 0.03Q = 100 m3/sQ = 100 m3/s
Range:Range:5m < B < 35m5m < B < 35m
2ul
r
xxx
2/13/2 SRn
BHQ 2/13/2 SR
n
BHQ
Channel Width vs. Depth
0
5
10
15
20
25
30
0 10 20 30 40
Width (m)D
ep
th (
m)
Channel Width vs. Velocity
0
0.2
0.4
0.6
0.8
1
1.2
0 10 20 30 40
Width (m)
Ve
locit
y (
m/s
)
ConclusionsConclusions
Results of the two methods being Results of the two methods being relatively the same shows that they relatively the same shows that they are convergent on the real solutionare convergent on the real solution
Differences between the twoDifferences between the two N.R. much more efficient (4:1 iterations)N.R. much more efficient (4:1 iterations) N.R. more accurate in this caseN.R. more accurate in this case N.R. easier to programN.R. easier to program
2ul
r
xxx
2/13/2 SRn
BHQ