Finding Roots of Nonlinear Equations - PowerPoint PPT Presentation

1 / 43
About This Presentation
Title:

Finding Roots of Nonlinear Equations

Description:

Regula Falsi, or Method of False Position. Use the shape of the curve as a cue ... Problem with Regula Falsi -- if the graph is convex down, the interpolated point ... – PowerPoint PPT presentation

Number of Views:1446
Avg rating:3.0/5.0
Slides: 44
Provided by: jayantam
Category:

less

Transcript and Presenter's Notes

Title: Finding Roots of Nonlinear Equations


1
Finding Roots of Nonlinear Equations
2
Sketch the Function
The best way to make an initial guess of the root
of the function f (x) is to sketch the function
x vs. f (x). The roots of the equation are the
points where the graph of y f (x) cuts the x-
axis. For example consider the equation f (x)
x3 2.5x2 2.46x 3.96 0
Lets try to plot this function. It is
just a one line code in MATLAB
x-40.14 plot(x,x.3-2.5x.2-2.46x3.96)
grid on ylim(-20 20)
3
Tabulating the Function
It also helps to tabulate the function
So there are roots between
Read xmin, xmax,h X ? xmin While x xmax do
begin y ? f
(x) write x, y
x ?x h end Stop
Pseudo code to tabulate f (x)
Try to write this in MATLAB!
4
Method of Successive Bisection
  • Basis of Bisection Method

Theorem
An equation f(x)0, where f(x) is a real
continuous function, has at least one root
between xl and xu if f(xl) f(xu) lt 0.
5
Bisection Method-cont.
Theorem
If function f(x) in f(x)0 does not change sign
between two points, roots may still exist between
the two points.
6
Bisection Method-cont.
Theorem
If the function f(x) in f(x)0 does not change
sign between two points, there may not be any
roots between the two points.
7
Bisection Method-cont.
Theorem
If the function f(x) in f(x)0 changes sign
between two points, more than one root may exist
between the two points.
8
Algorithm for Bisection Method-1
Choose xl and xu as two guesses for the root
such that f(xl) f(xu) lt 0, or in other words,
f(x) changes sign between xl and xu.
9
Algorithm for Bisection Method-2
Estimate the root, xm of the equation f (x) 0
as the mid-point between xl and xu as
10
Algorithm for Bisection Method-3
Essentially this is what we need to do Check if
solution lies between a and b F(a)F(b) lt 0
? Try the midpoint m compute F(m) If F(m) lt
tol select m as your approximate solution
Otherwise, if F(m) is of opposite sign to F(a)
that is ifF(a)F(m) lt 0, then b m. Else a m.
Now check the following If f(xl) f(xm) lt 0,
then the root lies between xl and xm then xl
xl xu xm. If f(xl ) f(xm) gt 0, then the
root lies between xm and xu then xl xm xu
xu. If f(xl) f(xm) 0 then the root is xm.
Stop the algorithm if this is true.
xl and xu
11
Algorithm for Bisection Method-3
Tolerance
So this is what we need to check
New estimate
Yes
Stop
Check if absolute relative approximate error is
less than pre-specified tolerance (tol) or if
maximum number of iterations is reached.
Absolute Relative Approximate Error
Using the new upper and lower guesses
No
12
Bisection Method-Example
  • Thermistors are temperature-measuring devices
    based on the principle that the thermistor
    material exhibits a change in electrical
    resistance with a change in temperature. By
    measuring the resistance of the thermistor
    material, one can then determine the temperature.

13
Example-cont.
  • For a 10K3A Betatherm thermistor, the
    relationship between the resistance R of the
    thermistor and the temperature is given by

where note that T is in Kelvin and R is in ohms.
14
Example-cont.
  • For the thermistor, error of no more than 0.01o
    C is acceptable. To find the range of the
    resistance that is within this acceptable limit
    at 19o C, we need to solve
  • and
  • Use the bisection method of finding roots of
    equations to find the resistance R at 18.99o C.
    Conduct three iterations to estimate the root of
    the above equation.

15
Solution-Dry Run
Graph of function f(x)
16
Solution-cont.
Choose the bracket
17
Solution-cont.
First iteration..
18
Solution-cont.
Second iteration..
19
Solution-cont.
Third iteration..
20
Solution-cont.
Testing Convergence
Table 1 Root of f(R)0 as function of number of
iterations for bisection method.
Thats the root
21
Advantages and Drawbacks of Bisection Method
Advantages
  • Always Convergent
  • We can predict in advance the number of
    iterations required for
    desired accuracy

Drawbacks
If a function f(x) is such that it just touches
the x-axis it will be unable to find the lower
and upper guesses
  • Function changes sign but root does not exist

If one of the initial guesses is close to the
root, the convergence is slower
22
Read x0, x1, tol y0? f(x0) y1?f(x1) i? 0 If
(sign(y0) sign(y1) ) then begin
write starting values unsuitable
write x0, x1, y0, y1
stop end while (x1 x0 )/x1 gt
tol begin x2 ?
(x0 x1)/2 y2 ? f (x2)
i ? I 1
if ( sign (y0) sign(y2) ) then x0 ? x2 else
x1 ? x2 write solution converges to a
root write number of iterations is i write
x2, y2 stop
Bisection Method-Pseudo Code
23
Improvement to Bisection Method
  • Regula Falsi, or Method of False Position.
  • Use the shape of the curve as a cue
  • Use a straight line between y values to select
    interior point
  • As curve segments become small, this closely
    approximates the root

24
Regula Falsi Method
curve
approximation
25
Regula Falsi Method-cont.
adjacent1adjacent2
similartriangles
26
Regula Falsi Method-cont.
  • Pro as the interval becomes small, the interior
    point generally becomes much closer to root
  • Con 1 if fa and fb become too close overflow
    errors can occur
  • Con 2 cant predict number of iterations to
    reach a give precision
  • Con 3 can be less precise than bisection no
    strict precision guarantee
  • Con 4 slow convergence

27
Regula Falsi Method-cont.
fa
a
b
fb
Problem with Regula Falsi -- if the graph is
convex down, the interpolated point will
repeatedly appear in the larger segment.
28
Regula Falsi Method-cont.
Therefore a problem arises if we use the size of
the current interval as a criterion that the
root is found
fb
fx
a
b
x
If we use the criterion abs(fx) lt e, this is not
a problem. But this criterion cant be always
used (e.g. if function is very steep close to the
root)
There is a modified version of this method too
but we need not discuss that!
fa
29
Regula Falsi-Pseudo Code
?
30
Newton-Raphsons Method
31
Newton-Raphsons Method-cont.
32
Algorithm for Newton-Raphson Method
Calculate the next estimate of the root
Find the absolute relative approximate error
33
Algorithm for Newton-Raphson Method-cont.
  • Find if the absolute relative approximate error
    is
  • greater than the pre-specified relative error
    tolerance.
  • If so, go back to step 2, else stop the
    algorithm.
  • Also check if the number of iterations has
    exceeded
  • the maximum number of iterations.

34
Example
Again consider the Thermistors example
To find the range of the resistance that is
within this acceptable limit at 190 C, we need to
solve the two equations below
and
35
Solution-Dry Run
Graph of function f(x)
36
Solution-cont.
First iteration
37
Solution-cont.
Second iteration
38
Solution-cont.
Third iteration
39
Advantages and Drawbacks of Newton-Raphsons Method
Advantages
Converges fast, if it converges and requires only
one guess
Drawbacks
Inflection point
40
Drawbacks cont.
Division by zero
41
Drawbacks cont.
Root Jumping
42
Drawbacks cont.
Oscillations near Local Maxima or Minima
43
Newton Raphsons Method-Pseudo Code
Next lecture Secant Method, and some other
methods
Write a Comment
User Comments (0)
About PowerShow.com