ROOTS OF EQUATIONS Student Notes
description
Transcript of ROOTS OF EQUATIONS Student Notes
![Page 1: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/1.jpg)
ROOTS OF EQUATIONSStudent Notes
ENGR 351 Numerical Methods for EngineersSouthern Illinois University CarbondaleCollege of EngineeringDr. L.R. ChevalierDr. B.A. DeVantier
![Page 2: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/2.jpg)
Applied ProblemThe concentration of pollutant bacteria C in a lakedecreases according to:
Determine the time required for the bacteria to be reduced to 10 ppm.
C e et t 80 202 0 1.
![Page 3: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/3.jpg)
You buy a $20 K piece of equipment for nothing downand $5K per year for 5 years. What interest rate are you paying? The formula relating present worth (P), annualpayments (A), number of years (n) and the interest rate(i) is:
A Pi ii
n
n
1
1 1
Applied Problem
![Page 4: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/4.jpg)
Quadratic Formula
xb b ac
af x ax bx c
2
2
42
0( )
This equation gives us the roots of the algebraic functionf(x)
i.e. the value of x that makes f(x) = 0
How can we solve for f(x) = e-x - x?
![Page 5: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/5.jpg)
Roots of EquationsPlot the function and determine
where it crosses the x-axis Lacks precisionTrial and error
-2
0
2
4
6
8
10
-2 -1 0 1 2x
f(x)
![Page 6: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/6.jpg)
Overview of Methods
Bracketing methods Bisection method False position
Open methods Newton-Raphson Secant method
![Page 7: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/7.jpg)
Understand the graphical interpretation of a root
Know the graphical interpretation of the false-position method (regula falsi method) and why it is usually superior to the bisection method
Understand the difference between bracketing and open methods for root location
Specific Study Objectives
![Page 8: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/8.jpg)
Understand the concepts of convergence and divergence.
Know why bracketing methods always converge, whereas open methods may sometimes diverge
Know the fundamental difference between the false position and secant methods and how it relates to convergence
Specific Study Objectives
![Page 9: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/9.jpg)
Understand the problems posed by multiple roots and the modification available to mitigate them
Use the techniques presented to find the root of an equation
Solve two nonlinear simultaneous equations using techniques similar to root finding methods
Specific Study Objectives
![Page 10: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/10.jpg)
Bracketing Methods
Bisection method False position method (regula falsi
method)
![Page 11: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/11.jpg)
Graphically Speaking
xl xu
1. Graph the function2. Based on the graph, select two
x values that “bracket the root”3. What is the sign of the y value?4. Determine a new x (xr) based
on the method5. What is the sign of the y value
of xr?6. Switch xr with the point that
has a y value with the same sign
7. Continue until f(xr) = 0
xr
![Page 12: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/12.jpg)
x
f(x)
x
f(x)
x
f(x)
x
f(x)
consider lowerand upper boundsame sign,no roots or even # of roots
opposite sign,odd # of roots
Theory Behind Bracketing Methods
![Page 13: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/13.jpg)
Bisection Method
xr = (xl + xu)/2Takes advantage of sign changingThere is at least one real root
x
f(x)
![Page 14: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/14.jpg)
Graphically Speaking
xl xu
1. Graph the function2. Based on the graph, select two
x values that “bracket the root”3. What is the sign of the y value?4. xr = (xl + xu)/25. What is the sign of the y value
of xr?6. Switch xr with the point that
has a y value with the same sign
7. Continue until f(xr) = 0
xr
![Page 15: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/15.jpg)
Algorithm Choose xu and xl. Verify sign change
f(xl)f(xu) < 0 Estimate root
xr = (xl + xu) / 2 Determine if the estimate is in the lower or
upper subinterval f(xl)f(xr) < 0 then xu = xr RETURN f(xl)f(xr) >0 then xl = xr RETURN f(xl)f(xr) =0 then root equals xr -
COMPLETE
![Page 16: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/16.jpg)
Error
100
approxpresent
approxpreviousapproxpresenta
Let’s consider an example problem:
![Page 17: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/17.jpg)
• f(x) = e-x - x• xl = -1 xu = 1
Use the bisection method to determine the root
Example
STRATEGY
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
-4
-2
0
2
4
6
8
10
12
f(x) = 3.718
f(x) = -0.632
x
f(x)
![Page 18: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/18.jpg)
Strategy Calculate f(xl) and f(xu) Calculate xr
Calculate f(xr) Replace xl or xu with xr based on the
sign of f(xr) Calculate a based on xr for all
iterations after the first iteration REPEAT
![Page 19: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/19.jpg)
False Position Method
“Brute Force” of bisection method is inefficient
Join points by a straight line Improves the estimateReplacing the curve by a straight
line gives the “false position”
![Page 20: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/20.jpg)
xl
xuf(xl)
f(xu)next
estimate, xr
f xx x
f xx x
x xf x x xf x f x
l
r l
u
r u
r uu l u
l u
Based on similar triangles
![Page 21: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/21.jpg)
Determine the root of the following equation using the false position method starting with an initial estimate of xl=4.55 and xu=4.65
f(x) = x3 - 98
-40-30-20-10
0102030
4 4.5 5x
f(x)
Example
STRATEGY
![Page 22: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/22.jpg)
Strategy Calculate f(xl) and f(xu) Calculate xr
Calculate f(xr) Replace xl or xu with xr based on the
sign of f(xr) Calculate a based on xr for all
iterations after the first iteration REPEAT
![Page 23: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/23.jpg)
Example Spreadsheet Use of IF-THEN statements Recall in the bi-section or false position
methods. If f(xl)f(xr)>0 then they are the same
sign Need to replace xu with xr
If f(xl)f(xr)< 0 then they are opposite signs
Need to replace xl with xr
![Page 24: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/24.jpg)
Example Spreadsheet
If f(xl)f(xr) is negative, we want to leave xu as xu
If f(xl)f(xr) is positive, we want to replace xu with xr
The EXCEL command for the next xu entry follows the logic
If f(xl)f(xr) < 0, xu,xr
?
xl xu f(xl) f(xu) xr f(xr) f(xl)f(xr)0.01 0.10 -549.03 592.15 0.06 3.58 -1964.96
Example Spreadsheet
![Page 25: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/25.jpg)
Pitfalls of False Position Method
f(x)=x10-1
-505
1015202530
0 0.5 1 1.5x
f(x)
![Page 26: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/26.jpg)
Open MethodsNewton-Raphson methodSecant methodMultiple roots In the previous bracketing
methods, the root is located within an interval prescribed by an upper and lower boundary
![Page 27: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/27.jpg)
Newton Raphsonmost widely used
f(x)
x
![Page 28: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/28.jpg)
Newton Raphson
tangent
dydx
f
f xf xx x
rearrange
x xf xf x
ii
i i
i ii
i
'
'
'
0
1
1
f(xi)
xi
tangent
xi+1
![Page 29: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/29.jpg)
Newton Raphson
A is the initial estimate B is the function evaluated at A C is the first derivative evaluated at A D= A-B/C Repeat
ii
ii xfxfxx
'1
i x f(x) f’(x)0 A B C1 D2
![Page 30: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/30.jpg)
Solution can “overshoot”the root and potentiallydiverge
x0
f(x)
x
x1x2
Newton RaphsonPitfalls
![Page 31: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/31.jpg)
Use the Newton Raphson method to determine the root off(x) = x2 - 11 using an initial guess of xi = 3
Example
STRATEGY
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
-12
-10
-8
-6
-4
-2
0
2
4
6
x
f(x)
![Page 32: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/32.jpg)
StrategyStart a table to track your solution
i xi f(xi) f’(xi)
0 x0
Calculate f(x) and f’(x)Estimate the next xi based on the
governing equationUse s to determine when to stopNote: use of subscript “0”
![Page 33: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/33.jpg)
Secant method
f xf x f xx xi i
i i
'
1
1
Approximate derivative using a finite divided difference
What is this? HINT: dy / dx = Dy / Dx
Substitute this into the formula for Newton Raphson
![Page 34: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/34.jpg)
Secant method
ii
iiiii
i
iii
xfxfxxxfxx
xfxfxx
1
11
1 '
Substitute finite difference approximation for thefirst derivative into this equation for Newton Raphson
![Page 35: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/35.jpg)
Secant method
Requires two initial estimates f(x) is not required to change signs,
therefore this is not a bracketing method
ii
iiiii xfxf
xxxfxx
1
11
![Page 36: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/36.jpg)
Secant method
new estimate initial estimates
slopebetweentwoestimates
f(x)
x{
![Page 37: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/37.jpg)
Determine the root of f(x) = e-x - x using the secant method. Use the starting points x0 = 0 and x1 = 1.0.
Example
STRATEGY
0 0.5 1 1.5 2 2.5
-2.5
-2.0
-1.5
-1.0
-0.5
0.0
0.5
1.0
1.5Series1; 1.000
-0.632
xf(x)
![Page 38: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/38.jpg)
StrategyStart a table to track your results
i xi f(xi) a
0 0 Calculate1 1 Calculate2 Calculate
Note: here you need two starting points!
Use these to calculate x2
Use x3 and x2 to calculate a at i=3Use s
![Page 39: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/39.jpg)
Comparison of False Position and Secant Method
x
f(x)
x
f(x)
1
1
2
new est. new est.
2
![Page 40: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/40.jpg)
Multiple RootsCorresponds to a point
where a function is tangential to the x-axis
i.e. double root f(x) = x3 - 5x2 + 7x -3 f(x) = (x-3)(x-1)(x-1) i.e. triple root f(x) = (x-3)(x-1)3 -4
-2
0
2
4
6
8
10
0 1 2 3 4x
f(x) multiple root
![Page 41: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/41.jpg)
Difficulties
Bracketing methods won’t work Limited to methods that may
diverge
-4
-2
0
2
4
6
8
10
0 1 2 3 4x
f(x) multiple root
![Page 42: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/42.jpg)
f(x) = 0 at root f '(x) = 0 at root Hence, zero in the
denominator for Newton-Raphson and Secant Methods
Write a “DO LOOP” to check is f(x) = 0 before continuing
-4
-2
0
2
4
6
8
10
0 1 2 3 4x
f(x) multiple root
![Page 43: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/43.jpg)
Multiple Roots
x x
f x f x
f x f x f xi i
i i
i i i
1 2
'
' ' '
-4
-2
0
2
4
6
8
10
0 1 2 3 4x
f(x) multiple root
![Page 44: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/44.jpg)
Systems of Non-Linear EquationsWe will later consider systems of
linear equations f(x) = a1x1 + a2x2+...... anxn - C = 0 where a1 , a2 .... an and C are
constantConsider the following equations
y = -x2 + x + 0.5 y + 5xy = x3
Solve for x and y
![Page 45: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/45.jpg)
Systems of Non-Linear Equations cont.Set the equations equal to zero
y = -x2 + x + 0.5 y + 5xy = x3
u(x,y) = -x2 + x + 0.5 - y = 0v(x,y) = y + 5xy - x3 = 0The solution would be the values of
x and y that would make the functions u and v equal to zero
![Page 46: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/46.jpg)
Recall the Taylor Series
ii
nni
n
iiiii
xxsizestephwhere
Rhnxf
hxfhxfhxfxfxf
1
......
321
!
!3'''
!2'''
![Page 47: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/47.jpg)
Write a first order Taylor series with respect to u and v
iii
iii
ii
iii
iii
ii
yyyv
xxxv
vv
yyyu
xxxu
uu
111
111
The root estimate corresponds to the point whereui+1 = vi+1 = 0
![Page 48: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/48.jpg)
ThereforeTHE DENOMINATOROF EACH OF THESEEQUATIONS ISFORMALLYREFERRED TOAS THE DETERMINANTOF THEJACOBIAN
This is a 2 equation version of Newton-Raphson
xv
yu
yv
xu
xvu
xuv
yy
xv
yu
yv
xu
yuv
yvu
xx
iiii
ii
ii
ii
iiii
ii
ii
ii
1
1
![Page 49: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/49.jpg)
Determine the roots of the following nonlinear simultaneous equations x2+xy=10 y + 3xy2 = 57
Use and initial estimate of x=1.5, y=3.5
Example
STRATEGY0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0
5
10
15
20
25
x
f(x)
![Page 50: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/50.jpg)
StrategyRewrite equations to get
u(x,y) = 0 from equation 1 v(x,y) = 0 from equation 2
Determine the equations for the partial of u and v with respect to x and y
Start a table!i xi yi u (x,y)
v(x,y)
du/dx
du/dy
dv/dx
dv/dy
J
![Page 51: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/51.jpg)
Understand the graphical interpretation of a root
Know the graphical interpretation of the false-position method (regula falsi method) and why it is usually superior to the bisection method
Understand the difference between bracketing and open methods for root location
Specific Study Objectives
![Page 52: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/52.jpg)
Understand the concepts of convergence and divergence.
Know why bracketing methods always converge, whereas open methods may sometimes diverge
Know the fundamental difference between the false position and secant methods and how it relates to convergence
Specific Study Objectives
![Page 53: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/53.jpg)
Understand the problems posed by multiple roots and the modification available to mitigate them
Use the techniques presented to find the root of an equation
Solve two nonlinear simultaneous equations
Specific Study Objectives
![Page 54: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/54.jpg)
The concentration of pollutant bacteria C in a lakedecreases according to:
Determine the time required for the bacteria to be reduced to 10 using Newton-Raphson method.
C e et t 80 202 0 1.
Applied Problem
![Page 55: ROOTS OF EQUATIONS Student Notes](https://reader036.fdocuments.in/reader036/viewer/2022062411/568166de550346895ddb09ca/html5/thumbnails/55.jpg)
You buy a $20 K piece of equipment for nothing downand $5K per year for 5 years. What interest rate are you paying? The formula relating present worth (P), annualpayments (A), number of years (n) and the interest rate(i) is:
A Pi ii
n
n
1
1 1
Use the bisection method
Applied Problem