Numerical Methods, - PowerPoint PPT Presentation

1 / 45
About This Presentation
Title:

Numerical Methods,

Description:

Today s class Numerical differentiation Roots of equation Bracketing methods Numerical Methods, Lecture 4 Prof. Jinbo Bi CSE, UConn* – PowerPoint PPT presentation

Number of Views:277
Avg rating:3.0/5.0
Slides: 46
Provided by: leiw154
Category:

less

Transcript and Presenter's Notes

Title: Numerical Methods,


1
Todays class
  • Numerical differentiation
  • Roots of equation
  • Bracketing methods

2
Numerical Differentiation
  • Finite divided difference
  • First forward difference
  • First backward difference

3
Numerical Differentiation
  • Centered difference approximation
  • Subtract the two equations

4
Numerical Differentiation
  • First forward difference

5
Numerical Differentiation
  • First backward difference

6
Numerical Differentiation
  • Centered difference

7
Error Propagation
  • What is the effect of error in one calculation
    propagating to subsequent calculations?
  • Example
  • Multiplying sin x with cos x
  • Single variable functions

8
Error Propagation
  • Use Taylor series

9
Error Propagation
10
Error Propagation
  • Multivariable functions

11
Numerical stability
  • Condition of a problem is a measure of its
    sensitivity to changes in input values
  • The condition number is defined as the ratio of
    the relative function error to the relative value
    error

12
Numerical stability
  • Condition number lt 1 indicates a well-conditioned
    function i.e. changes in the input are
    attenuated
  • Condition number gt 1 indicates a ill-conditioned
    function i.e. changes in the input are amplified

13
Roots of equation
  • Given a function f(x), the roots are those values
    of x that satisfy the relation f(x) 0
  • Example
  • From the quadratic formula, the roots are

14
Roots of Equations
  • The need to solve for roots show up in many
    engineering problems
  • Also, can be used to find solutions to implicit
    variables

15
Example
  • Find a value of R such that current is 5A at t
    1s

16
Example
  • It is not possible to isolate R to the left side
    and thus solve for R
  • R is know as an implicit variable
  • Rewrite the function as a function of R set to 0

17
Roots of equations
  • Still need a method to solve for this root
  • Other examples of difficult to solve roots

18
Roots of equations
  • Non-computer methods
  • Graphical methods

19
Graphical methods
  • Not exact
  • Can give you a rough estimate of the root,
  • Can give you insights on the number of roots and
    shape of the curve
  • Can use the rough estimate in more precise
    numerical methods

20
Graphical methods
  • Use to get an initial estimate of the root and
    also to find out how many roots there are

21
Graphical methods
22
Graphical methods
23
Graphical methods
24
Roots of equation
  • Non-computer/numerical method
  • Exhaustive search method
  • To find the root in the interval a,b, start at
    xa and check if f(a) 0, then try f(a?),
    f(a2?), and so on, until we get f(x)
    sufficiently close to 0
  • If the step value ? is sufficiently small we can
    obtain an accurate result but this could take an
    extremely long time. For example, if the interval
    is 0,10 and the step size is ? 0.001, it will
    take on average 10,000 guesses
  • In addition to the inefficiency of this approach,
    if f(x) is a steep function, this approach may
    not produce an accurate results

25
Exhaustive search
  • Example
  • Find the root of the function
  • Actual root is at x1.0001
  • With an interval of 0.9, 1.1 and a step size of
    ? 0.001. The exhaustive search method will test
    f(1.000) -0.01 and f(1.001) 0.086, neither of
    which are that close to f(x) 0

26
Roots of equations
  • More systematic methods are required
  • Bracketing methods
  • Open methods

27
Incremental search methods
  • Locate an interval where sign changes
  • Divide interval into smaller subintervals which
    are then searched for sign changes
  • Keep repeating until root is found with
    sufficient confidence

28
Bisection method
  • Also called
  • Binary chopping
  • Interval halving
  • An incremental search method where the interval
    is cut in half

29
Bisection method
  • Step 1
  • Choose lower xl and upper xu such that the
    function changes sign over that range i.e.
    f(xl) and f(xu) are different signs or f(xl)
    f(xu) lt 0
  • Step 2
  • Estimate root to be xr(xlxu)/2

30
Bisection method
  • Step 3
  • Determine in which subinterval the root lies
  • If f(xr)?0 is within acceptable tolerance, stop
    and root equals xr
  • If f(xl) f(xr) lt 0, then root is in lower
    subinterval. Set xu xr, and return to step 2
  • If f(xl) f(xr) gt 0, then root is in upper
    subinterval. Set xl xr, and return to step 2

31
Bisection method
  • Termination criteria
  • Use approximate relative error calculation to
    determine when to stop
  • In general, ?a is larger than ?t

32
Bisection method
  • Example
  • Use range of 202204
  • Root is in upper subinterval

33
Bisection method
34
Bisection method
  • Use range of 203203.5
  • Root is in upper subinterval

35
Error estimates
  • The approximate error is upper bound estimate of
    the true error
  • When the root is near one of the ends of the
    interval, the approximate error is fairly close
    to the actual true error
  • Error is fairly well-contained

36
Error estimates
  • You always know that the true root is within ?x/2
    of your estimate

37
Bisection method
38
Bisection method
  • You can calculate an error estimate based just on
    the initial guesses
  • You can also make estimates on the error on
    future iterations
  • Superscripts indicates the iteration number

39
Bisection method
  • Each subsequent iteration cuts the approximate
    error in half
  • This, allows to determine a priori exactly how
    many iterations are needed to arrive at the
    desired error

40
False Position Method
  • The false position method works in a similar
    fashion to the bisection method
  • Start with an initial interval a,b where f(a)
    and f(b) have opposite signs, which is the same
    as the bisection
  • Instead of choosing the initial guess xr as the
    midpoint of the interval, we join the point
    a,f(a) and b,f(b) with a straight line and
    choose xr as the point where that straight line
    crosses the x-axis.

41
False Position Method
42
False Position Method
  • Algorithm is the same as bisection method with
    the same three steps

43
False Position Method
  • Step 1
  • Choose lower xl and upper xu such that the
    function changes sign over that range - i.e.
    f(xl) and f(xu) are different signs - or f(xl)
    f(xu) lt 0
  • Step 2
  • Estimate new root to be

44
False Position Method
  • Step 3
  • Determine in which subinterval the root lies
  • If f(xr) ? 0 is within acceptable tolerance, stop
    and root equals xr
  • If f(xl) f(xr) lt 0, then root is in lower
    subinterval. Set xu xr, and return to step 2
  • If f(xl) f(xr) gt 0, then root is in upper
    subinterval. Set xl xr, and return to step 2

45
Next class
  • Roots of equations
  • Open methods
  • Read chapters 5 and 6
  • HW2, due 9/17
  • Chapra Canale
  • 6th edition 3.5, 3.7, 3.13, 4.5, 4.6, 4.12 (b)
    and (d), and 4.16
Write a Comment
User Comments (0)
About PowerShow.com