Download presentation
Presentation is loading. Please wait.
Published byHoratio Little Modified over 9 years ago
1
Today’s class Numerical differentiation Roots of equation Bracketing methods Numerical Methods, Lecture 4 1 Prof. Jinbo Bi CSE, UConn
2
Finite divided difference First forward difference First backward difference Numerical Differentiation Numerical Methods, Lecture 4 2 Prof. Jinbo Bi CSE, UConn
3
Centered difference approximation Subtract the two equations Numerical Differentiation Numerical Methods, Lecture 3 3 Prof. Jinbo Bi CSE, UConn
4
First forward difference Numerical Differentiation Numerical Methods, Lecture 4 4 Prof. Jinbo Bi CSE, UConn
5
First backward difference Numerical Differentiation Numerical Methods, Lecture 4 5 Prof. Jinbo Bi CSE, UConn
6
Centered difference Numerical Differentiation Numerical Methods, Lecture 4 6 Prof. Jinbo Bi CSE, UConn
7
What is the effect of error in one calculation propagating to subsequent calculations? Example: Multiplying sin x with cos x Single variable functions Error Propagation Numerical Methods, Lecture 4 7 Prof. Jinbo Bi CSE, UConn
8
Use Taylor series Error Propagation Numerical Methods, Lecture 4 8 Prof. Jinbo Bi CSE, UConn
9
Error Propagation Numerical Methods, Lecture 4 9 Prof. Jinbo Bi CSE, UConn
10
Multivariable functions Error Propagation Numerical Methods, Lecture 4 10 Prof. Jinbo Bi CSE, UConn
11
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 Numerical stability Numerical Methods, Lecture 4 11 Prof. Jinbo Bi CSE, UConn
12
Condition number < 1 indicates a well- conditioned function – i.e. changes in the input are attenuated Condition number > 1 indicates a ill- conditioned function – i.e. changes in the input are amplified Numerical stability Numerical Methods, Lecture 4 12 Prof. Jinbo Bi CSE, UConn
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: Numerical Methods, Lecture 4 13 Prof. Jinbo Bi CSE, UConn
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 Numerical Methods, Lecture 4 14 Prof. Jinbo Bi CSE, UConn
15
Find a value of R such that current is 5A at t = 1s Example Numerical Methods, Lecture 4 15 Prof. Jinbo Bi CSE, UConn
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 Numerical Methods, Lecture 4 16 Prof. Jinbo Bi CSE, UConn
17
Still need a method to solve for this root Other examples of difficult to solve roots Roots of equations Numerical Methods, Lecture 4 17 Prof. Jinbo Bi CSE, UConn
18
Non-computer methods Graphical methods Roots of equations Numerical Methods, Lecture 4 18 Prof. Jinbo Bi CSE, UConn
19
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 Graphical methods Numerical Methods, Lecture 4 19 Prof. Jinbo Bi CSE, UConn
20
Use to get an initial estimate of the root and also to find out how many roots there are Graphical methods Numerical Methods, Lecture 4 20 Prof. Jinbo Bi CSE, UConn
21
Graphical methods Numerical Methods, Lecture 4 21 Prof. Jinbo Bi CSE, UConn
22
Graphical methods Numerical Methods, Lecture 4 22 Prof. Jinbo Bi CSE, UConn
23
Graphical methods Numerical Methods, Lecture 4 23 Prof. Jinbo Bi CSE, UConn
24
Non-computer/numerical method Exhaustive search method To find the root in the interval [a,b], start at x=a and check if f(a) = 0, then try f(a+Δ), f(a+2Δ), 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 Roots of equation Numerical Methods, Lecture 4 24 Prof. Jinbo Bi CSE, UConn
25
Example Find the root of the function Actual root is at x=1.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 Exhaustive search Numerical Methods, Lecture 4 25 Prof. Jinbo Bi CSE, UConn
26
More systematic methods are required Bracketing methods Open methods Roots of equations Numerical Methods, Lecture 4 26 Prof. Jinbo Bi CSE, UConn
27
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 Incremental search methods Numerical Methods, Lecture 4 27 Prof. Jinbo Bi CSE, UConn
28
Also called: Binary chopping Interval halving An incremental search method where the interval is cut in half Bisection method Numerical Methods, Lecture 4 28 Prof. Jinbo Bi CSE, UConn
29
Step 1: Choose lower x l and upper x u such that the function changes sign over that range – i.e. f(x l ) and f(x u ) are different signs – or f(x l ) f(x u ) < 0 Step 2: Estimate root to be x r =(x l +x u )/2 Bisection method Numerical Methods, Lecture 4 29 Prof. Jinbo Bi CSE, UConn
30
Step 3: Determine in which subinterval the root lies If f(x r ) 0 is within acceptable tolerance, stop and root equals x r If f(x l ) f(x r ) < 0, then root is in lower subinterval. Set x u = x r, and return to step 2 If f(x l ) f(x r ) > 0, then root is in upper subinterval. Set x l = x r, and return to step 2 Bisection method Numerical Methods, Lecture 4 30 Prof. Jinbo Bi CSE, UConn
31
Termination criteria Use approximate relative error calculation to determine when to stop In general, a is larger than t Bisection method Numerical Methods, Lecture 4 31 Prof. Jinbo Bi CSE, UConn
32
Example: Use range of [202:204] Root is in upper subinterval Bisection method Numerical Methods, Lecture 4 32 Prof. Jinbo Bi CSE, UConn
33
Bisection method Use range of [203:204] Root is in lower subinterval –0.0034 Numerical Methods, Lecture 4 33 Prof. Jinbo Bi CSE, UConn
34
Use range of [203:203.5] Root is in upper subinterval Bisection method Numerical Methods, Lecture 4 34 Prof. Jinbo Bi CSE, UConn
35
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 Error estimates Numerical Methods, Lecture 4 35 Prof. Jinbo Bi CSE, UConn
36
You always know that the true root is within Δx/2 of your estimate Error estimates Numerical Methods, Lecture 4 36 Prof. Jinbo Bi CSE, UConn
37
Bisection method Numerical Methods, Lecture 4 37 Prof. Jinbo Bi CSE, UConn
38
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 Bisection method Numerical Methods, Lecture 4 38 Prof. Jinbo Bi CSE, UConn
39
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 Bisection method Numerical Methods, Lecture 4 39 Prof. Jinbo Bi CSE, UConn
40
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 x r as the midpoint of the interval, we join the point {a,f(a)} and {b,f(b)} with a straight line and choose x r as the point where that straight line crosses the x-axis. False Position Method Numerical Methods, Lecture 4 40 Prof. Jinbo Bi CSE, UConn
41
False Position Method Numerical Methods, Lecture 4 41 Prof. Jinbo Bi CSE, UConn
42
Algorithm is the same as bisection method with the same three steps False Position Method Numerical Methods, Lecture 4 42 Prof. Jinbo Bi CSE, UConn
43
Step 1: Choose lower x l and upper x u such that the function changes sign over that range - i.e. f(x l ) and f(x u ) are different signs - or f(x l ) f(x u ) < 0 Step 2: Estimate new root to be False Position Method Numerical Methods, Lecture 4 43 Prof. Jinbo Bi CSE, UConn
44
Step 3: Determine in which subinterval the root lies If f(x r ) 0 is within acceptable tolerance, stop and root equals x r If f(x l ) f(x r ) < 0, then root is in lower subinterval. Set x u = x r, and return to step 2 If f(x l ) f(x r ) > 0, then root is in upper subinterval. Set x l = x r, and return to step 2 False Position Method Numerical Methods, Lecture 4 44 Prof. Jinbo Bi CSE, UConn
45
Roots of equations Open methods Read chapters 5 and 6 HW2, due 9/17 Chapra & Canale 6 th edition 3.5, 3.7, 3.13, 4.5, 4.6, 4.12 (b) and (d), and 4.16 Next class Numerical Methods, Lecture 4 45 Prof. Jinbo Bi CSE, UConn
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.