Вы находитесь на странице: 1из 44

GENG 300 NUMERICAL METHODS

Dr. Mohammad Aman Ullah

Roots of Equations
Chapter 5

Lecture 2
2

7/2/2015

TOPICS COVERED FROM CHAPTER 1 & 4

Numerical Methods

1. Why numerical methods?


2. Mathematical Modelling concept
3. Error Analysis:
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

7/2/2015

WHAT WILL BE COVERED FROM CHAPTER 5


Roots in engineering and science
1. Graphical methods
2. Bracketing methods
a.

Bisection

b.

False position

3. Open methods
a.

Simple fixed-point iteration

b.

Newton-Raphson

c.

Secant methods
4

ROOTS IN ENGINEERING AND SCIENCE:


FINDING ROOTS
Relatively easy: linear, quadratic equations

ax bx c 0
2

b b 2 4ac
x
2a

Difficult: nonlinear

ax 5 bx 4 cx3 dx 2 ex f 0 x ?
sin x x 0 x ?
a sin x b cos x cx 0 x ?
5

Graphical
Bisection
Solvers

Nonlinear Equation

FINDING ROOTS

Bracketing
False Position
Fixed-point
Open Methods

All Iterative

Newton-Raphson
Secant
6

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

Matlab
Excel

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 well study here.

1. GRAPHICAL APPROACHEXAMPLE 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 4 s of free fall.
Note: The acceleration of gravity is 9.81 / .
tanh

tanh
36

9.81
0.25

tanh


9.81

Assume different values of m and find

0
0.25

0
8

1. GRAPHICAL APPROACHEXAMPLE 5.1


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

Root

36.0456 /
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
, and
then

0,

0.

(The function changes sign


on opposite sides of the root)

10

2. BRACKETING

11

Exceptions

Odd and even number of roots

2. BRACKETING METHODS

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


0.
interest, check if
.
2. Estimate the root by evaluating

/2 .

14

2.A. THE BISECTION METHOD


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
root is

4. Compare

/2 =0, then
/2 and terminate.

with

5. If
, stop. Otherwise
repeat the process.

xl xu
2
100%
xl xu
2

xl

or
xl xu
2
100%
xl xu
2

xu

15

2. A. THE BISECTION METHOD

16

2.A. EVALUATION OF BISECTION METHOD


Pros
Easy
Always finds roots
Number of iterations
required to attain an
absolute error can be
computed a priori.

Cons
Slow
Knowing and that
bound root
Multiple roots
No account is taken of
and
, if
is
closer to zero, it is likely
that root is closer to .
17

2.A. BISECTION METHODEXAMPLE 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 4 s of free fall. Note: The
acceleration of gravity is 9.81 / .
tanh

tanh
36

9.81
0.25

tanh

? , Given that true value of


9.81

0
0.25

142.7376

0
18

2.A. BISECTION METHOD: EG. 5.3, 5.4:


Initial guess: 50, 200
50,

50

200,

125

125

142.7376 125
142.7376
50

200

4.578

100%
0.409

12.43%
1.871

Root must be located above interval


between 125 and 200
125

200
2

125

162.5

162.5

0.409 0.359

13.85%
0.147

Root must be located in lower interval


between 125 and 162.5
125

162.5
2

19

143.75

0.709

2.A. BISECTION METHOD: EXAMPLE

How many Iterations will it


take?

1
:
2

2
:
2

: ,
2

20

2.A. BISECTION METHOD: TRY YOURSELF


If the desired error, , , 0.41 in Example 5.4 how
many iterations will it take?

200
,

2
.

50

150

log

log 2

=8 iterations

Find the root using bisection method


2

: 3.52050
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
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
.
23

2.B. FALSE-POSITIONPROCEDURE
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-POSITIONPROCEDURE
Step 3: Use the new point to replace one of the
original points, keeping the two points on opposite
sides of the axis.

If
If
If

0 then
0 then

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.

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

tanh
36

9.81
0.25

tanh

? , Given that true value of


9.81

0
0.25

142.7376

0
27

2.B. FALSE-POSITION METHODEXAMPLE


5.5

28

IS FALSE-POSITION ALWAYS BETTER THAN


BISECTION? EXAMPLE 5.5
Use bisection and false position to locate the root of
1 between
0 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
2. Bracketing methods
a.

Bisection

b.

False position

3. Open methods
a.

Simple fixed-point iteration

b.

Newton-Raphson

c.

Secant methods
30

OPEN METHODS

divergent

convergent

Single starting point or two starting points (not


necessary to bracket the roots)

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
2
the equation:
1
0
i
x
g(x)
1, 2, ,
1 1.000 3.000
2 3.000 1.667
is given or guessed
3 1.667 2.200
Example:
Solve
for
0
Solution:

2,

2
or,
or,

2
1

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
32

FIXED-POINT-GRAPHICAL EXPLANATION

can be expressed
as a pair of equations:
1

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

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 )
Ox 3
2!
The root is the value of
when
0

After rearranging and


neglecting the higher
order terms:
0
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-Raphsons 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,
38

SECANT METHOD

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
Newtons 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 )
xi
Modified Secant :

in the original N - R formula.

xi
xi 1 xi f ( xi )
f ( xi xi ) f ( xi )

Example: Falling Parachute


Find out ? (using
modified secant method)
Given that

9.81 m/s2,

0.25 kg/m,
36 m/s at

40

4s

Modified Secant Method

41

Modified Secant Method

42

Roots of Polynomials
fn (x) ao a1x a2 x an x
2

will be covered in lab session

43

SUMMARY

44

Вам также может понравиться