2a Roots of Equations One Equation

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 44

GENG 300 NUMERICAL METHODS

Dr. Mohammad Aman Ullah


Roots of Equations
Chapter 5

Topic 2
2
06/18/2024
TOPICS COVERED FROM CHAPTER 1 & 4
1. Why numerical methods?
2. Mathematical Modelling concept
3. Error Analysis:

Numerical Methods
a. Significant figures
b. Accuracy and precision
c. Error definitions
i. For known true value
ii. For approximations
d. Major errors
i. Round off
ii. Truncation

3
WHAT WILL BE COVERED FROM CHAPTER

06/18/2024
5

Roots in engineering and science


1. Graphical methods
2. Bracketing methods
a. Bisection
b. False position
3. Open methods
c. Simple fixed-point iteration
d. Newton-Raphson
e. Secant methods
4
ROOTS IN ENGINEERING AND SCIENCE:
FINDING ROOTS…
Relatively easy: linear, quadratic equations

 b  b 2  4ac
ax  bx  c  0 
2
x
2a

Difficult: nonlinear

ax5  bx 4  cx3  dx 2  ex  f  0  x  ?
sin x  x  0  x  ?
a sin x  b cos x  cx  0  x  ?
5
FINDING ROOTS…

Graphical
Bisection
Nonlinear Equation

Bracketing
Solvers

False Position

Fixed-point

Open Methods Newton-Raphson

All Iterative Secant


6
1. GRAPHICAL APPROACH
Matlab
Make a plot of the function
and observe where it crosses Excel
the -axis, i.e.

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.
7
1. GRAPHICAL APPROACH…EXAMPLE
5.1
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 s of free fall. Note: The acceleration of
gravity is 9.81 .

Assume different values of m and find

8
1. GRAPHICAL APPROACH…EXAMPLE
5.1
The function crosses the axis
between 140 and 150 . Visual
inspection of the plot
Root
provides a rough estimate of
the root of 145 . The validity
of the graphical estimate can
be checked by substituting it
into Eq.

9
2. BRACKETING METHODS
(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, , is bounded
by values then
.
(The function changes sign on
opposite sides of the root)
10
2. BRACKETING…

11
Odd and even number of roots
2. BRACKETING METHODS…

Exceptions

12
2. BRACKETING METHODS…

𝑓 ( 𝑥)=sin ⁡10 𝑥 +cos ⁡3 𝑥

13
2.A. THE BISECTION METHOD

For the arbitrary equation of one variable,


1. Pick and such that they bound the root of interest,
check if .
2. Estimate the root by evaluating .
14
2.A. THE BISECTION METHOD
3. Find the pair
a. If <0, root lies in the lower interval,
then and go to step 2 xl  xu
xl 
2
b. If , root lies in the upper interval, 100%
xl  xu
then , go to step 2. 2
c. If =0, then root is and terminate. or
xl  xu
4. Compare with xu 
2
100%
xl  xu
5. If , stop. Otherwise repeat the
2
process.
15
2. A. THE BISECTION METHOD

16
2.A. EVALUATION OF BISECTION
METHOD
Pros Cons
Easy Slow
Always finds roots Knowing and that bound root
Number of iterations required Multiple roots
to attain an absolute error can No account is taken of and , if
be computed a priori. is closer to zero, it is likely
that root is closer to .

17
2.A. BISECTION METHOD…EX. 5.3, 5.4
Using Bisection method determine the mass of the bungee
jumper with a drag coefficient of 0.25 to have a velocity of
36 after s of free fall. Note: The acceleration of gravity is
9.81 .

Given that true value of

18
2.A. BISECTION METHOD: EG. 5.3, 5.4:
Initial guess: 50, 200

Root must be located above interval between


125 and 200

Root must be located in lower interval between


125 and 162.5

19
2.A. BISECTION METHOD: EXAMPLE

How many Iterations will it


take?

20
2.A. BISECTION METHOD: TRY
IfYOURSELF
in Example 5.4 how many iterations will it take?

=8 iterations

Find the root using bisection method

21
2.B. THE FALSE-POSITION METHOD
(Regula-Falsi or linear interpolation method)

●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.

22
2.B. THE FALSE-POSITION METHOD
(Regula-Falsi or linear interpolation method)

If a real root is bounded by


and of , then we can
approximate the solution
by doing a linear
interpolation between the
points and to find the
value such that , is the
linear approximation of .

23
2.B. FALSE-POSITION…PROCEDURE

Step 1: Find a pair of values of such that


Step 2: Estimate the value of the root from the
following formula:

and evaluate .

24
2.B. FALSE-POSITION…PROCEDURE

Step 3: Use the new point to replace one of the


original points, keeping the two points on opposite
sides of the axis.
●If then
●If then
●If 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. 25
2.B. FALSE-POSITION: WHY IS THIS
METHOD?
●Faster
●Always converges for a
single root

26
2.B. FALSE-POSITION METHOD: EX. 5.5

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 s of free fall. Note: The acceleration of
gravity is 9.81 .

Given that true value of

27
2.B. FALSE-POSITION METHOD…
EXAMPLE 5.5

28
IS FALSE-POSITION ALWAYS BETTER
THAN BISECTION? EXAMPLE 5.5
Use bisection and false position to locate the root of
between and 1.3.

Slow convergence, better


use the bisection method

29
WHAT IS COVERED FROM CHAPTER 5

Roots in engineering and science


1. Graphical methods R
2. Bracketing methods R
a. Bisection R
b. False position R
3. Open methods
c. Simple fixed-point iteration
d. Newton-Raphson
e. Secant methods
30
OPEN METHODS
Single starting point or two starting points (not necessary to
bracket the roots)
convergent

divergent
● Bracketing methods are “convergent”.
● Fixed-point methods may sometime “diverge”,
depending on the starting point (initial guess) and how
the function behaves. 31
SIMPLE FIXED-POINT ITERATION
Rearrange the function so that x is on the left side of the
equation: 2
𝑥𝑖 +1 =1+
𝑥𝑖
i x g(x)
1 1.000 3.000
2 3.000 1.667
is given or guessed 3 1.667 2.200
4 2.200 1.909
Example: 5 1.909 2.048
Solve , for 6 2.048 1.977
7 1.977 2.012
Solution: 8 2.012 1.994
9 1.994 2.003
10 2.003 1.999
or, 11 1.999 2.001

or 32
FIXED-POINT-GRAPHICAL EXPLANATION

● can be expressed as a pair of


equations:

(component equations)
●Plot them separately
●Their point of intersection is the
solution.

33
FIXED-POINT:CONVERGENCE
Fixed-point iteration
converges if

g ( x)  1

34
NEWTON-RAPHSON METHOD
●Based on Taylor series expansion:
x 2
f ( xi 1 )  f ( xi )  f ( xi )x  f ( xi )  Ox 3
2!
●The root is the value of when
●After rearranging and
neglecting the higher order
terms:

35
NEWTON-RAPHSON METHOD…

●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

36
NEWTON-RAPHSON METHOD…

Fixed Point iteration:

Newton-Raphson iteration:

37
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

38
SECANT METHOD…
●Requires two initial estimates
of , e. g, . 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
Modified Secant Method
Use a small perturbation fraction  to compute
f ( xi  xi )  f ( xi )
f ' ( xi )  in the original N - R formula.
xi
xi
Modified Secant : xi 1  xi  f ( xi )
f ( xi  xi )  f ( xi )
Example: Falling Parachute
Find out ? (using modified
secant method)
Given that m/s2,
kg/m, 40

m/s at s
Modified Secant Method

41
Modified Secant Method

42
Roots of Polynomials

f n ( x)  ao  a1 x  a2 x    an x
2 n

… will be covered in lab session

43
SUMMARY

…
…
…
…
…

44

You might also like