CSE 541 Numerical Methods - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

CSE 541 Numerical Methods

Description:

... 541. Numerical Methods. Root Finding: Bisection, Regula Falsi. 9/24/09. 2. OSU ... Regula Falsi. Benefits: If the function is close to linear in the interval ... – PowerPoint PPT presentation

Number of Views:171
Avg rating:3.0/5.0
Slides: 25
Provided by: rogerc2
Category:

less

Transcript and Presenter's Notes

Title: CSE 541 Numerical Methods


1
CSE 541Numerical Methods
  • Root Finding Bisection, Regula Falsi

2
Root Finding
  • Where does the function cross the x-axis?
  • Set f(x) 0, solve for x
  • More than once maybe???
  • More generally, set f(x, y, z, ) 0
  • Phrase it differently f(x,y,z,) g(x,y,z,)

roots
3
Motivation
  • Take well known functions such as polynomials
  • For example
  • f(x) x2 2x 3
  • Two roots at r -1 and r 3
  • f(-1) 1 2 3 0
  • f(3) 9 6 3 0
  • We can also look at f in its factored form
  • f(x) x2 2x 3 (x 1)(x 3)

4
Factored Form of Functions
  • The factored form is not limited to polynomials
  • Consider
  • f(x) x sin x sin x
  • A root exists at x 1
  • f(x) (x 1) sin x
  • And
  • sin x sin kp 0 Þ (x p) x (x p) (x 2p)
    (x 3p)

5
Examples
  • Compute Ö2?
  • x Ö2
  • x2 2
  • In general,
  • xp c ? xp c 0

6
Root Finding Algorithm
  • Limited information about the function
  • Assume we are allowed to evaluate the function
    anywhere and as many times as we want
  • How do we find roots?

7
Domain Interval
  • Interval Two locations on the domain, a and b,
  • where x ÃŽa, b, where a lt b
  • Lets define a couple of intervals
  • How do we know if there is a root in the interval?

?
?
8
Observation
  • Evaluate the function at endpoints a and b
  • f (a) gt 0 and f (b) gt 0

a
b
9
Observation
  • Evaluate the function at endpoints a and b
  • f (a) gt 0 and f (b) lt 0

a
b
10
Bracketing Techniques
  • Surround the root (solution)
  • Find an interval a, b that contains the root
  • So f (a) f (b) lt 0
  • What is a good approximation to our solution?
  • Can we improve our approximation?

11
Bisection Method
  • c(ab)/2

f(a)gt0
f(c)gt0
a
b
c
f(b)lt0
12
Bisection Method
a c f(a)gt0
b
c
a
f(c)lt0
f(b)lt0
13
Bisection Method
b c f(b)lt0
b
a
c
14
Convergence Error
  • Will this always converge?
  • Intermediate Value Theorem
  • (Continuous functions)
  • At any step in the algorithm, what is the error
    of our approximation?
  • I.e., root c

15
Error Estimation
  • Use error bound and relative error

c
x
16
Error Estimate
  • What does this mean in binary mode?
  • err0 ? b-a
  • err1 ? b-a/2
  • erri1 ? erri/2 b-a/2i1
  • We gain an extra bit each iteration!!!

17
Convergence
  • The bisection method converges linearly
  • r ci1 lt ½ r ci C r ci
  • Linear Convergence Theorem
  • Not bad, why do I need anything else?
  • Can we do better?

18
A Note on Functions
  • Functions can be simple, but I may need to
    evaluate it many many times.
  • Or, a function can be extremely complicated.
    Consider
  • Interested in the configuration of air vents
    (position, orientation, direction of flow) that
    makes the temperature in the room at a particular
    position (teachers desk) equal to 72.
  • Is this a function?

19
A Note on Functions
  • This function may require a complex
    three-dimensional heat-transfer coupled with a
    fluid-flow simulation to evaluate the function
  • ? hours of computational time on a
    supercomputer!!!
  • May not necessarily even be computational

20
Bisection Method
  • Given a and b, such that f(a)f(b)lt0
  • c (a b)/2.0 // Find the midpoint
  • while( ????? )
  • if( f(a)f(c) lt 0 ) // root in the left half
  • b c
  • else // root in the right half
  • a c
  • c (a b)/2.0 // Find the new midpoint
  • return c
  • Stopping criteria?

21
Regula Falsi
  • New Idea
  • Assume the function is linear within the bracket
  • Construct a line and use it to find the
    intersection with the x-axis

22
Regula Falsi
f(c)lt0
c
a
b
23
Regula Falsi
  • Benefits
  • If the function is close to linear in the
    interval
  • If the root is much closer to one side

b
a
c
24
Bracketing Methods
  • Guaranteed convergence
  • Convergence typically slower than open methods
  • Relies on identifying two points a and b
    initially such that
  • f(a) f(b) lt 0
  • Use to find approximate location of roots
  • Polish with open methods
Write a Comment
User Comments (0)
About PowerShow.com