0% found this document useful (0 votes)
40 views

Numerical Root-Finding: Bracketing Methods

The document discusses numerical root-finding methods for solving nonlinear equations. It introduces the bisection method and regula-falsi method in 3 steps or less: 1) The bisection method iteratively finds the root of a function f(x) by narrowing the range between two values a and b where f(a) and f(b) have opposite signs, until the range is less than a specified tolerance. 2) The regula-falsi method similarly finds the root by iteratively choosing a new value c between a and b using the formula c = b - f(b)*(b-a)/(f(b)-f(a)). 3) Both methods require
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Numerical Root-Finding: Bracketing Methods

The document discusses numerical root-finding methods for solving nonlinear equations. It introduces the bisection method and regula-falsi method in 3 steps or less: 1) The bisection method iteratively finds the root of a function f(x) by narrowing the range between two values a and b where f(a) and f(b) have opposite signs, until the range is less than a specified tolerance. 2) The regula-falsi method similarly finds the root by iteratively choosing a new value c between a and b using the formula c = b - f(b)*(b-a)/(f(b)-f(a)). 3) Both methods require
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Numerical Root-Finding:

Bracketing Methods

Non-linear Equations
What are Nonlinear Equations?
Linear Equations

Non-linear Equations

10 + 5 = 15

2 + 2 = 2

++1=0

= 0 cos 2
1 1 1
= +

= 2 3

ln =
+
= 0 (1 )

=
=
=
0
0 =

Root-finding
What is Root-finding?
Example: Find the roots of 2 + 6 + 5 = 0
Example: Find the roots of 2 2 + 2 = 0.
Note:
Solve for x:
2 = ln

is the
same as

Find the roots of:


2 ln = 0

Outline
Numerical Root-Finding Methods
1. Bisection Method
2. Regula-Falsi Method
Example: Solve for x in
2 + 2 = 2

Non-linear Equations
Example: Solve for x in 2 + 2 = 2
Lets do the Bisection Method!
1. Turn your equation into a function in x.

= 2 2 2
*Again, solving for x
means finding the root
of f(x), i.e. f(x) = 0.

Bisection Method
2. Plot . Find an interval [a, b] where 1 root exists.

Choose the
interval such that
is monotonic in
[a, b] and
< 0.

NO GOOD!

Lets say: [1, 3]


=
=

=
=

Bisection Method
2. Plot . Find an interval [a, b] where 1 root exists.

Choose the
interval such that
is monotonic in
[a, b] and
< 0.

=
Exactly 1
root exists!

Lets say: [4, 5]


=
=

=
=

Bisection Method
3. Find the midpoint of [a, b] and label it as c. Evaluate
, and ().
Bounds: 4, 5
=

=4

=5
+
=
2
=

. = .

= .

Bisection Method
4. If < 0, then set the new bounds to [a, c].
If < 0, then set the new bounds to [c, b].
=


= .

= 1.887

. = .

Bisection Method
Repeat step 3. Find the midpoint of [a, b] and label it
as c. Evaluate , and ().
Bounds: 4, 4.5
=4
= 4.5
=

. = .

. = .

= .

Bisection Method
4. If < 0, then set the new bounds to [a, c].
If < 0, then set the new bounds to [c, b].

= 2.070

= .
=

. = .

. = .

Bisection Method
How do you know when to stop?

Ans. Set a tolerance!


Lets say, = 0.01

Bisection Method
5. If the interval is less than a tolerance, then STOP.
Report = as your answer. Otherwise, go to step 3.
Tolerance: = 0.01
Previous c:
4.25
Current c:
4.375
Is 4.375 4.25 <

No! Repeat step 3.


=

. = .

. = .

Bisection Method
Lets look at what really happens

= 2 2 2

Bisection Method
Lets look at what really happens = 2 2 2
Iter

f(a)

f(b)

f(c)

4.5

-2

0.377417

4.5

4.25

-2

0.377417

-1.03519

4.25

4.5

4.375

-1.03519

0.377417

-0.39119

4.375

4.5

4.4375

-0.39119

0.377417

-0.02332

4.4375

4.5

4.46875

-0.02332

0.377417

0.172832

4.4375

4.46875

4.453125

-0.02332

0.172832

0.073717

4.4375

4.453125

4.445313

-0.02332

0.073717

0.024941

At Iter = 6, since 4.453125 4.445313 < 0.01, then we stop!

Bisection Method
Lets look at what really happens = 2 2 2
Iter

f(A)

f(B)

f(C)

14

4.441284

4.441345

4.441314697

-6.6E-06

0.00037

0.000182

15

4.441284

4.441315

4.441299438

-6.6E-06

0.000182

8.77E-05

16

4.441284

4.441299

4.441291809

-6.6E-06

8.77E-05

4.06E-05

17

4.441284

4.441292

4.441287994

-6.6E-06

4.06E-05

1.7E-05

18

4.441284

4.441288

4.441286087

-6.6E-06

1.7E-05

5.23E-06

19

4.441284

4.441286

4.441285133

-6.6E-06

5.23E-06

-6.6E-07

For a tolerance of 0.000001


At Iter = 19, since 4.44128513 4.44128609 < 0.000001, then we stop!

Bisection Method
Summary of steps:
1. Turn your equation into a function of x. Set a tolerance value
(typically 0.0001).
2. Plot . Find an interval [a, b] where 1 root exists.
3. Find the midpoint of [a, b] and label it as c. Evaluate
, and ().
4. If < 0, then set the new bounds to [a, c]. If
< 0, then set the new bounds to [c, b].
5. If < , then STOP. Report = as your
answer. Otherwise, go to step 3.

Bisection Method

Alternatively,
instead of
having a
tolerance, you
can also set the
maximum
number of
iterations.
N=4

Bisection Method
YOUR TASK:
Develop a program that carries out the bisection
method. Prompt the user for the initial guess
interval [a, b], and the desired tolerance.
Output the final root, and the number of
iterations needed to reach that final value.

Regula-Falsi Method
Example: Solve for x in 2 + 2 = 2
Lets do the Regula-falsi Method!
1. Turn your equation into a function in x.

= 2 2 2
*Again, solving for x
means finding the root
of f(x), i.e. f(x) = 0.

Regula-Falsi Method
2. Plot . Find an interval [a, b] where 1 root exists.

Choose the
interval such that
is monotonic in
[a, b] and
< 0.
From before:
[a, b] = [4, 5]

=
Exactly 1
root exists!

Regula-Falsi Method
3. Find c using the following formula. Evaluate ().
+
=
2

()( )
=
()

. = .

(5)(5 4)
=5
5 (4)
5 30
=5 =
= 4.286
7
7
=

Regula-Falsi Method
Why =

()()
()

?
From similar triangles:

bc
f(b)

()

=
()
f(b) f(a)

ba
a c

Regula-Falsi Method
4. If < 0, then set the new bounds to [a, c].
If < 0, then set the new bounds to [c, b].
=


= 1.726

= .

. = .

Regula-Falsi Method
Summary of steps:
1. Turn your equation into a function of x. Set a tolerance value
(typically 0.0001).
2. Plot . Find an interval [a, b] where 1 root exists.
3. Find =

()()
. Evaluate
()

().

4. If < 0, then set the new bounds to [a, c]. If


< 0, then set the new bounds to [c, b].
5. If < , then STOP. Report = as your
answer. Otherwise, go to step 3.

Regula-Falsi Method
YOUR TASK:
Develop a program that carries out the regula-falsi
(false-position) method. Prompt the user for the
initial guess [a, b], and the desired tolerance.
Output the final root, and the number of
iterations needed to reach that final value.

Bracketing Methods
Problems in the
Bracketing Methods:

- Knowing where to start


- Slow convergence

Practice
Solve for the only positive value of x that satisfies:

1
x
x 1 1 e
2
x

Use the following methods. Which converges fastest?

1. Bisection Method
2. Regula-Falsi Method
Use a tolerance of 0.00001.

You might also like