chapter 3 roots of equations. objectives understanding what roots problems are and where they occur...
TRANSCRIPT
![Page 1: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/1.jpg)
Chapter 3Chapter 3
Roots of EquationsRoots of Equations
![Page 2: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/2.jpg)
ObjectivesObjectives•Understanding what roots problems are and where they occur in engineering and science •Knowing how to determine a root graphically•Knowing how to solve a root problem with bracketing method•Understand the open method and recognize the difference between the open and bracketing methods•Knowing how to use MATLAB built-in function
![Page 3: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/3.jpg)
Content•Introduction•Graphical method•Bracketing method (Bisection and false position)•Open method (Newton Raphson and secant methods)•MATLAB built-in function•Conclusion
![Page 4: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/4.jpg)
IntroductionMany engineering and science problems
predict dependent variable(s) as a function of independent variables
Heat balance : time : time&space
Mass balance : mass concen. : time&space
Kirchoff’s law: current/voltage : time
![Page 5: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/5.jpg)
Introduction (cont’d)See the previous assignment you encountered
1 km
What is the ground velocity ?
tmcec
gmtv )/(1)(
Says that u know the velocity
t=0, v = 0;
![Page 6: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/6.jpg)
Introduction (cont’d)
tmcec
gmtv )/(1)(
from
Find the distant
dtec
gmvdtts
t
tmc 0
)/(1)(
1)( )/( tmce
c
mt
c
gmts
hence
Find t1km that s = 1000 m from
11000 1)/(
1kmtmc
km ec
mt
c
gm
![Page 7: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/7.jpg)
Introduction (cont’d)
11000 1)/(
1kmtmc
km ec
mt
c
gm
So solve t1km from
Can u solve the above equation for t1km ?
Of course, the equation is nonlinear and t1km is an implicit variable !!
![Page 8: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/8.jpg)
Introduction (cont’d)If we are solving a simple nonlinear equation, it’s piece of cake.
a
acbbxcbxax
2
40
22
?0sin
?02345
xxx
xfexdxcxbxax
But what about these
Yes, it’s time for numerical methods !!!
![Page 9: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/9.jpg)
Introduction (cont’d)Nonlinear Equation
Solvers
Bracketing Graphical Open Methods
BisectionFalse Position (Regula-Falsi)
Newton Raphson
Secant
All Iterative
![Page 10: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/10.jpg)
Graphical…Graphical method means that we plot graph fromthe target nonlinear equation and observe the zeroof it !!
Very simple but too iterative.
Here try with parachutist problem…..
![Page 11: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/11.jpg)
Graphical… (cont’d)
11000 1)/(
1kmtmc
km ec
mt
c
gmStart with the distant equation
Find t1km such that
010001)( 1)/(11
kmtmc
kmkm ec
mt
c
gmtf
is satisfied.
Plot f(t1km) from t1km = {0,T} make sure that the zero of f(t1km) falls within this interval.
![Page 12: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/12.jpg)
Graphical… (cont’d)Try with MATLAB to plot the function from t=0,..,50Utilize the command “inline”
0 5 10 15 20 25 30 35 40 45 50-1000
-500
0
500
1000
1500
2000
2500
3000
3500
time (s)
f(x) zero
Around 12.7, more accurate result can attained if u zoom in the figure !!
![Page 13: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/13.jpg)
Bisection
![Page 14: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/14.jpg)
Bracketing…Sometimes called two-point method
Underline principle
Root of f (x) is bounded by{xL,xU} where
f(xL)f(xU) < 0
![Page 15: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/15.jpg)
Bisection (cont’d)How many iterations will it take?Length of the first Interval Δx0=b-aAfter 1 iteration εa(1)=Δx0/2
After 2 iterations εa(2) =Δx0/4
After k iterations εa(n) =Δx0/2n
0
2log ( ) a ss
xn
![Page 16: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/16.jpg)
Bracketing:BisectionFor the arbitrary equation of one variable, f(x)=0
1. Pick xl and xu such that they bound the root of interest, check if f(xl).f(xu) <0.
2. Estimate the root by evaluating f[(xl+xu)/2].
3. Find the pair • If f(xl). f[(xl+xu)/2]<0, root lies in the lower interval, then
xu=(xl+xu)/2 and go to step 2.
![Page 17: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/17.jpg)
Bisection (cont’d)• If f(xl). f[(xl+xu)/2]>0, root
lies in the upper interval, then xl= [(xl+xu)/2, go to step 2.
• If f(xl). f[(xl+xu)/2]=0, then root is (xl+xu)/2 and terminate.
4. Compare s with a
5. If a< s, stop. Otherwise repeat the process.
0
2na n
x
![Page 18: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/18.jpg)
Bisection (cont’d)
![Page 19: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/19.jpg)
Bisection (cont’d)
![Page 20: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/20.jpg)
Bisection (cont’d)Evaluation of Method
ProsEasyAlways find rootNumber of iterations
required to attain an absolute error can be computed a priori.
ConsSlowKnow a and b that bound
rootMultiple rootsNo account is taken of
f(xl) and f(xu), if f(xl) is closer to zero, it is likely that root is closer to xl .
![Page 21: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/21.jpg)
Bisection (cont’d)If the absolute magnitude of the error εs =
1e-4
and Lo=2, how many iterations will you have to do to get the required accuracy in the solution?
0
2na n
x
0
2log ( ) a ss
xn
2 4
2log ( ) 14.3
10 a sn
Try with simple example : f=sin(10x)+cos(3x) [x=3.7,3.9] es = 10-5
![Page 22: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/22.jpg)
Bisection (cont’d)MATLAB: Try with the parachutist problem in Chapter 1
11000 1)/(
1kmtmc
km ec
mt
c
gm
Find t1km for m = 68.1 kg, c = 12.5 kg/s given that L0 = 60s and εs = 10-4
Plot approximation error and true error
![Page 23: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/23.jpg)
False position If a real root is bounded
by xl and xu of f(x)=0, then we can approximate the solution by doing a linear interpolation between the points
[xl, f(xl)] and [xu, f(xu)] to find the xr value such that l(xr)=0, where l(x) is the linear approximation of f(x).
![Page 24: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/24.jpg)
False position (cont’d)
1. Find a pair of values of x, xl and xu such that fl=f(xl) <0 and fu=f(xu) >0.
2. Estimate the value of the root from the following formula
and evaluate f(xr).
Procedure
lu
luulr ff
fxfxx
![Page 25: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/25.jpg)
False position (cont’d)Procedure (cont’d)3. Use the new point to replace one of the original points,
keeping the two points on opposite sides of the x axis.
If f(xr)<0 then xl=xr == > fl=f(xr)
If f(xr)>0 then xu=xr == > fu=f(xr)
If f(xr)=0 then you have found the root and need go no further!
![Page 26: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/26.jpg)
False position (cont’d)Procedure (cont’d)4. See if the new xl and xu are close enough for convergence
to be declared. If they are not go back to step 2.
Now u may wonder how good of this technique is?
Comparing with the bisection method, which one is better ?
I would like u try this method with parachutist problem.
![Page 27: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/27.jpg)
False position… (cont’d) Why this method?
Faster Always converges for a single root.
Pitfalls of the False-Position Method.
Method applied to some curvature functions may slowly converge.
![Page 28: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/28.jpg)
Open methodsOpen methods
are based on formulas that require only a single starting value of x or two starting values that do not necessarily bracket the root.
![Page 29: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/29.jpg)
Fixed-point…(cont’d)
... 2, 1,k ,given )(
)(0)(
1
okk xxgx
xxgxf
•Bracketing methods are “convergent”.
•Fixed-point methods may sometime “diverge”, depending on the stating point (initial guess) and how the function behaves.
•Rearrange the function so that x is on the left side of the equation:
![Page 30: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/30.jpg)
Fixed-point…(cont’d)Convergence
x=g(x) can be expressed as a pair of equations:
y1=x
y2=g(x) (component equations)
Plot them separately.
![Page 31: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/31.jpg)
Fixed-point…(cont’d)Fixed-point iteration converges if
x)f(x) line theof (slope 1)( xg
•When the method converges, the error is roughly proportional to or less than the error of the previous step, therefore it is called “linearly convergent.”
![Page 32: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/32.jpg)
Fixed-point…(cont’d)Example
xxg
or
xxg
or
xxg
xxxxf
21)(
2)(
2)(
02)(2
2
Rearrange x = g(x)
![Page 33: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/33.jpg)
Newton-RaphsonMost widely used method.Based on Taylor series expansion:
)(
)(
)(0
g,Rearrangin
0)f(x when xof value theisroot The!2
)()()()(
1
1
1i1i
32
1
i
iii
iiii
iiii
xf
xfxx
xx)(xf)f(x
xOx
xfxxfxfxf
Newton-Raphson formula
Solve for
![Page 34: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/34.jpg)
Newton-Raphson… (cont’d)A convenient method for
functions whose derivatives can be evaluated analytically. It may not be convenient for functions whose derivatives cannot be evaluated analytically.
![Page 35: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/35.jpg)
Newton-Raphson… (cont’d)
![Page 36: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/36.jpg)
Secant methodA slight variation of Newton’s method for functions
whose derivatives are difficult to evaluate. For these cases the derivative can be approximated by a backward finite divided difference.
,3,2,1)()(
)(
)()()(
1
11
1
1
ixfxf
xxxfxx
xfxf
xxxf
ii
iiiii
ii
iii
![Page 37: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/37.jpg)
Secant method(cont’d)• Requires two initial
estimates of x , e.g, xo, x1. However, because f(x) is not required to change signs between estimates, it is not classified as a “bracketing” method.
• The scant method has the same properties as Newton’s method. Convergence is not guaranteed for all xo, f(x).
![Page 38: Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine](https://reader035.vdocuments.net/reader035/viewer/2022062314/56649f1d5503460f94c33b0e/html5/thumbnails/38.jpg)
Secant method(cont’d)