lec 02 geng 300 numerical methods
DESCRIPTION
numerical lecturesTRANSCRIPT
GENG 300 NUMERICAL METHODS
Dr. Mohammad Aman Ullah
2
Roots of Equations
Chapter 5
Lecture 2
TOPICS COVERED FROM CHAPTER 1 & 47/2/2015
3
Num
erical Methods
1. Why numerical methods?2. Mathematical Modelling concept3. Error Analysis:
a. Significant figuresb. Accuracy and precisionc. Error definitions
i. For known true valueii. For approximations
d. Major errorsi. Round offii. Truncation
WHAT WILL BE COVERED FROM CHAPTER 57/2/2015
4
Roots in engineering and science1. Graphical methods2. Bracketing methods
a. Bisectionb. False position
3. Open methodsa. Simple fixed-point iterationb. Newton-Raphsonc. Secant methods
5
Relatively easy: linear, quadratic equations
Difficult: nonlinear
aacbbxcbxax
240
22
5 4 3 2 0 ?sin 0 ?
sin cos 0 ?
ax bx cx dx ex f xx x x
a x b x cx x
ROOTS IN ENGINEERING AND SCIENCE:FINDING ROOTS…
6
Non
line
ar E
quat
ion
Solv
ers
Graphical
BracketingBisection
False Position
Open Methods
Fixed-point
Newton-Raphson
Secant
FINDING ROOTS…
All Iterative
7
Make a plot of the function and observe where it crosses the -axis, i.e. 0
Not very practical but can be used to obtain rough estimates for roots
These estimates can be used as initial guesses for numerical methods that we’ll study here.
1. GRAPHICAL APPROACH
MatlabExcel
8
Use the graphical approach to determine the mass of the bungee jumper with a drag coefficient of 0.25 / to have a velocity of 36 after 4s of free fall.
Note: The acceleration of gravity is 9.81 / .
tanh
tanh 0
369.810.25 tanh
9.81 0.254 0
Assume different values of m and find
1. GRAPHICAL APPROACH…EXAMPLE 5.1
9
The function crosses the axis between 140 and
150 . Visual inspection of the plot provides a rough estimate of the root of 145 . The validity of the graphical estimate can be checked by substituting it into Eq.
tanh
36.0456 /
1. GRAPHICAL APPROACH…EXAMPLE 5.1
Root
10
(aka Two point methods for finding roots) Two initial guesses for the root are required. These guesses must “bracket” or be on either side of the root.If one root of a real and continuous function, 0, is bounded by values
, and then 0.
(The function changes sign on opposite sides of the root)
2. BRACKETING METHODS
11
2. BRACKETING…
12
Odd
and
eve
n nu
mbe
r of
roo
ts
Exce
ptio
ns
2. BRACKETING METHODS…
13
sin10 cos3
2. BRACKETING METHODS…
14
For the arbitrary equation of one variable, 0
1. Pick and such that they bound the root of interest, check if . 0.2. Estimate the root by evaluating /2 .
2.A. THE BISECTION METHOD
15
3. Find the pair a. If . /2 <0, root lies in the lower interval, then
/2 and go to step 2
b. If . /2 0, root lies in the upper interval, then
/2, go to step 2.
c. If . /2 =0, then root is /2 and terminate.
4. Compare with
5. If , stop. Otherwise repeat the process.
%100
2
2
%100
2
2
ul
ulu
ul
ull
xx
xxx
or
xx
xxx
2.A. THE BISECTION METHOD
16
2. A. THE BISECTION METHOD
17
ProsEasyAlways finds rootsNumber of iterations required to attain an absolute error can be computed a priori.
ConsSlowKnowing and that bound rootMultiple rootsNo account is taken of
and , if is closer to zero, it is likely that root is closer to .
2.A. EVALUATION OF BISECTION METHOD
18
Using Bisection method determine the mass of the bungee jumper with a drag coefficient of 0.25 / to have a velocity of 36 after 4s of free fall. Note: The acceleration of gravity is 9.81 / .
tanh
tanh 0
369.810.25 tanh
9.81 0.254 0
? ,Given that true value of 142.7376
2.A. BISECTION METHOD…EXAMPLE 5.3, 5.4
19
2.A. BISECTION METHOD: EG. 5.3, 5.4:
Initial guess: 50, 200
50, 200,50 200
2 125
142.7376 125142.7376 100% 12.43%
50 125 4.578 0.409 1.871
Root must be located above interval between 125 and 200
125 2002 162.5 13.85%
125 162.5 0.409 0.359 0.147
Root must be located in lower interval between 125 and 162.5
125 162.52 143.75 0.709
20
2.A. BISECTION METHOD: EXAMPLE
How many Iterations will it take?
Δ
1 :Δ2
2 :Δ2
: ,Δ2
21
2.A. BISECTION METHOD: TRY YOURSELF
Δ 200 50 150
,Δ2 ⇒
log Δ,
log 2
. =8 iterations
If thedesirederror, , , 0.41in Example 5.4 how many iterations will it take?
Find the root using bisection method2 0 : 3.52050
22
●The bisection method divides the interval to in half not accounting for the magnitudes of and
. For example if is closer to zero than , then it is more likely that the root will be
closer to
●False position method is an alternative approach where and are joined by a straight line; the intersection of which with represent and improved estimate of the root.
2.B. THE FALSE-POSITION METHOD(Regula-Falsi or linear interpolation method)
23
If a real root is bounded by and of 0, then we can approximate the solution by doing a linear interpolation between the points , and ,
to find the value such that 0, is the linear approximation of .
2.B. THE FALSE-POSITION METHOD(Regula-Falsi or linear interpolation method)
24
Step 1: Find a pair of values of such that
Step 2: Estimate the value of the root from the following formula:
and evaluate .
2.B. FALSE-POSITION…PROCEDURE
25
Step 3: Use the new point to replace one of the original points, keeping the two points on opposite sides of the axis.●If 0 then ⇒
●If 0 then ⇒
●If 0 then you have found the root and need go no further!
Step 4: See if the new and are close enough for convergence to be declared. If they are not go back to step 2.
2.B. FALSE-POSITION…PROCEDURE
26
●Faster
●Always converges for a single root
2.B. FALSE-POSITION: WHY IS THIS METHOD?
27
Using False-Position method determine the mass of the bungee jumper with a drag coefficient of 0.25 / to have a velocity of 36 after 4s of free fall.
Note: The acceleration of gravity is 9.81 / .
tanh
tanh 0
369.810.25 tanh
9.81 0.254 0
? ,Given that true value of 142.7376
2.B. FALSE-POSITION METHOD: EX. 5.5
28
2.B. FALSE-POSITION METHOD…EXAMPLE5.5
29
Slow convergence, better use the bisection method
IS FALSE-POSITION ALWAYS BETTER THANBISECTION? EXAMPLE 5.5Use bisection and false position to locate the root of
1 between 0 and 1.3.
30
WHAT IS COVERED FROM CHAPTER 5
Roots in engineering and science1. Graphical methods
2. Bracketing methods a. Bisection b. False position
3. Open methodsa. Simple fixed-point iterationb. Newton-Raphsonc. Secant methods
Single starting point or two starting points (not necessary to bracket the roots)
conv
erge
nt
31
OPEN METHODS
dive
rgen
t
● Bracketing methods are “convergent”.
● Fixed-point methods may sometime “diverge”, depending on the starting point (initial guess) and how the function behaves.
Rearrange the function so that x is on the left side of the equation:
32
SIMPLE FIXED-POINT ITERATION
0 ⇒1, 2,… ,
is given or guessed Example: Solve 2,for 0Solution:
2or, 2or, 1
12
i x g(x) 1 1.000 3.000 2 3.000 1.667 3 1.667 2.200 4 2.200 1.909 5 1.909 2.048 6 2.048 1.977 7 1.977 2.012 8 2.012 1.994 9 1.994 2.003
10 2.003 1.999 11 1.999 2.001
● can be expressed as a pair of equations:
1
2 (component equations)
●Plot them separately●Their point of intersection
is the solution.
33
FIXED-POINT-GRAPHICAL EXPLANATION
Fixed-point iteration converges if
1)( xg
34
FIXED-POINT:CONVERGENCE
●Based on Taylor series expansion:
32
1 !2)()()()( xOxxfxxfxfxf iiii
35
NEWTON-RAPHSON METHOD
●The root is the value of when 0
●After rearranging and neglecting the higher order terms:0
36
●Newton-Raphson is A convenient method for functions whose derivatives can be evaluated analytically
Rate of convergence:● , ∝ ,
●It may not always converge●There is no convergence
criteria●Sometimes, it may converge
very slowly
NEWTON-RAPHSON METHOD…
Fixed Point iteration:
Newton-Raphson iteration:
37
NEWTON-RAPHSON METHOD…
38
SECANT METHOD
●A slight variation of Newton-Raphson’s method for functions whose derivatives are difficult to evaluate. ●For these cases, the derivative can be
approximated by a backward finite divided difference
1,2,3, …
●Requires two initial estimates of , e. g, , 1. However, because is not required to change signs between estimates, it is not classified as a “bracketing” method.
●The secant method has the same properties as Newton’s method. Convergence is not guaranteed for all , .
39
SECANT METHOD…
Modified Secant Method
)()()( Secant Modified
formula. R-N original in the )()()('
compute tofraction on perturbati small a Use
1:iii
iiii
i
iiii
xfxxfxxfxx
xxfxxfxf
40
Example: Falling ParachuteFind out ? (using modified secant method)Given that 9.81 m/s2,
0.25 kg/m,36 m/s at 4 s
41
Modified Secant Method
42
Modified Secant Method
Roots of Polynomials
nnon xaxaxaaxf 2
21)(
… will be covered in lab session
43
44
SUMMARY
…
…
…
…
…