Download presentation

Published byNeil Green Modified over 3 years ago

1
**4 Numerical Methods Root Finding Secant Method Modified Secant**

False Position Method Newton Method

2
**Secant method Math 685/CSI 700 Spring 08**

George Mason University, Department of Mathematical Sciences

3
**Secant method Math 685/CSI 700 Spring 08**

George Mason University, Department of Mathematical Sciences

4
**Requires two initial estimates **

Secant method Requires two initial estimates f(x) is not required to change signs, therefore this is not a bracketing method

5
**{ Secant method Select two estimates. Note: f(xi) and f(xi+1) f(x)**

are not opposite signs. f(x) { x initial estimates

6
Secant method f(x) slope between two estimates { x initial estimates

7
**{ Secant method f(x) slope between two estimates x initial estimates**

new estimate

8
To get xn+1 from xn and xn-1 we write out the equation of the secant line and using the points xn and xn-1. We then plug in the point (xn+1,0) and solve for xn+1. equation of secant substitute (xn+1,0) solve for xn+1 xn+1=h(xn-1,xn) The equation above gives the recursively defined sequence for xn. This is what is used for the Secant Method. The halting condition is usually given by the Standard Cauchy Error.

9
**Secant Illustration F(x) = x2 - 10 1 (a=1, fa=-9) (b=10, fb=90)**

int = 1.8, fint = -6.7 2 (a=10, fa=90) (b=1.8, fb= -6.7) int = 0.88, fint = 3 (a=1.8, fa=-6.7) (b=0.88, fb=-9.22) int = 4.25, fint = 8 4 (a=0.88, fa=-9.22) (b=4.25, fb=8) Int =2.68, fint = -2.8 Etc… 1 2 3 4

10
Example Determine the root of f(x) = e-x - x using the secant method. Use the starting points x0 = 0 and x1 = 1.0.

11
**Choose two starting points**

Solution Choose two starting points x0 = 0 f(x0 ) =1 x1 = f(x1) = Calculate x2 x2 = 1 - (-0.632)(0 - 1)/( ) =

12
**NOTE: f(x) are the same sign. OK here. **

Solution Second iteration x1 = f(x1) = x2 = f(x2) = NOTE: f(x) are the same sign. OK here. x3 = ( )( )/( ) x3 = f(x3) = ea = abs[( )/(0.564)] x 100 = 8.23%

13
**ea = 0.59% et = 0.0048% Third iteration x2 = 0.613 f(x2) = -0.0708**

Solution Third iteration x2 = f(x2) = x3 = f(x3) = x4 = f(x4) = ea = 0.59% et = % Know the difference between these error terms

14
**The change from ordinary **

double secant(double c, int iterations, double tol)… for ( int i = 0; i < iterations; i++) { double x = ( fa*b - fb*a ) / ( fa - fb ); double fx = func( x, c ); if ( fabs( fx ) < tol ) return x; a = b; fa = fb; b = x; fb = fx; } return -1; SECANT METHOD The change from ordinary regula is that the sign check is dropped and points are just “shifted over”

15
Math 685/CSI 700 Spring 08 Example George Mason University, Department of Mathematical Sciences

16
**Use secant method to estimate the root of f(x) = ln x. **

Ex. Use secant method to estimate the root of f(x) = ln x. Start the computation with value of xl = xi-1 = 0.5 xu = xi = 5.0 Solution The secant method

17
Example 1 You are making a bookshelf to carry books that range from 8 ½ ” to 11” in height and would take 29”of space along length. The material is wood having Young’s Modulus Msi, thickness 3/8 ” and width 12”. You want to find the maximum vertical deflection of the bookshelf. The vertical deflection of the shelf is given by where x is the position where the deflection is maximum. Hence to find the maximum deflection we need to find where and conduct the second derivative test.

18
Example 1 Cont. The equation that gives the position x where the deflection is maximum is given by Figure 2 A loaded bookshelf. Use the secant method of finding roots of equations to find the position where the deflection is maximum. Conduct three iterations to estimate the root of the above equation. Find the absolute relative approximate error at the end of each iteration and the number of significant digits at least correct at the end of each iteration.

19
Example 1 Cont. Figure 3 Graph of the function f(x).

20
Example 1 Cont. Solution Let us take the initial guesses of the root of as and Iteration 1 The estimate of the root is

21
Example 1 Cont.

22
Example 1 Cont. The absolute relative approximate error at the end of Iteration 1 is The number of significant digits at least correct is 1, because the absolute relative approximate error is less than 5%.

23
Example 1 Cont. Iteration 2 The estimate of the root is

24
Example 1 Cont. The absolute relative approximate error at the end of Iteration 2 is The number of significant digits at least correct is 2, because the absolute relative approximate error is less than 0.5%.

25
Example 1 Cont. Iteration 3 The estimate of the root is

26
Example 1 Cont. The absolute relative approximate error at the end of Iteration 3 is The number of significant digits at least correct is 6, because the absolute relative approximate error is less than %.

27
**Problems With the Secant Method**

The number of iterations required can not be determined before the algorithm begins. The algorithm will halt (program termination by division by zero if not checked for) if a horizontal secant line is encountered. The secant method will sometimes find an extraneous root.

28
**Modified Secant Method**

Root Finding Modified Secant Method

29
**Modified Secant Method**

30
**Modified Secant Method**

Original Secant Method Modified Secant Method

31
**x0 = 1 f(x0) = -0.63212 x1+ x0 = 1.01 f(x1+ x0) = -0.64578 Ex.**

Use the secant method to estimate the root of f(x) = e-x – x. Use a value of 0.01 for and start with x0 = 1.0. Solution (true root = …) First iteration x0 = f(x0) = x1+ x0 = f(x1+ x0) = Calculate t = 5.3%

32
**Applied Problem You buy a $20 K piece of equipment for nothing down**

and $5K per year for 5 years. What interest rate are you paying? The formula relating present worth (P), annual payments (A), number of years (n) and the interest rate (i) is:

33
Root Finding False Position Method

34
**“Brute Force” of bisection method is inefficient **

False Position Method “Brute Force” of bisection method is inefficient Join points by a straight line Improves the estimate Replacing the curve by a straight line gives the “false position”

35
Based on similar triangles next estimate, xr f(xu) xl xu f(xl)

36
**The False-Position Method (Regula-Falsi)**

We can approximate the solution by doing a linear interpolation between f(xu) and f(xl) Find xr such that l(xr)=0, where l(x) is the linear approximation of f(x) between xl and xu Derive xr using similar triangles

37
Example Determine the root of the following equation using the false position method starting with an initial estimate of xl=4.55 and xu=4.65 f(x) = x3 - 98

38
**Pitfalls of False Position Method**

39
**Comparison of False Position and Secant Method**

2 f(x) f(x) 2 1 1 x x new est. new est.

40
FALSE POSITION f(x) SECANT METHOD f(x) 1 1 x x - select first estimate

41
FALSE POSITION f(x) 2 SECANT METHOD 2 f(x) 1 1 x - select second estimate x

42
FALSE POSITION f(x) 2 SECANT METHOD 2 f(x) 1 1 x Note the sign of f(x) in each method. False position must bracket the root. x

43
FALSE POSITION f(x) 2 SECANT METHOD 2 f(x) 1 1 x - Connect the two points with a line x

44
FALSE POSITION x f(x) 1 new est. 2 SECANT METHOD 2 f(x) 1 The new estimate is selected from the intersection with the x-axis x new est.

45
Root Finding Newton Method

46
**Newton’s Method Open solution, that requires only one current guess.**

Root does not need to be bracketed. Consider some point x0. If we approximate f(x) as a line about x0, then we can again solve for the root of the line.

47
Newton Raphson f(xi) xi tangent xi+1

48
**Solving, leads to the following iteration:**

Newton’s Method Solving, leads to the following iteration:

49
**Secant method Substitute finite difference approximation for the**

first derivative into this equation for Newton Raphson Secant method

50
Math 685/CSI 700 Spring 08 Newton’s method George Mason University, Department of Mathematical Sciences

51
**Newton Raphson Pitfalls**

solution diverges f(x) (x)

52
Finding a square-root Example: 2 = Let x0 be one and apply Newton’s method.

53
Finding a square-root Example: 2 = Note the rapid convergence Note, this was done with the standard Microsoft calculator to maximum precision.

54
Math 685/CSI 700 Spring 08 Newton’s method George Mason University, Department of Mathematical Sciences

55
**Use the Newton Raphson method to determine the root of**

Example Use the Newton Raphson method to determine the root of f(x) = x using an initial guess of xi = 3

56
**f(x) = x2 - 11 f '(x) = 2x initial guess xi = 3 f(3) = -2 f '(3) = 6**

Solution f(x) = x2 - 11 f '(x) = 2x initial guess xi = 3 f(3) = -2 f '(3) = 6

57
**Solution In this method, we begin to use a numbering system: x0 = 3**

Continue to determine x2, x3 etc.

58
Solution

59
Newton’s Algorithm Requires the derivative function to be evaluated, hence more function evaluations per iteration. A robust solution would check to see if the iteration is stepping too far and limit the step. Most uses of Newton’s method assume the approximation is pretty close and apply one to three iterations blindly.

60
**Division by Multiplication**

Newton’s method has many uses in computing basic numbers. For example, consider the equation: Newton’s method gives the iteration:

61
CONVERGENCE If the numbers xn become closer and closer to r as n becomes large, then we say that the sequence converges to r and we write:

62
**Applied Problem The concentration of pollutant bacteria C in a lake**

decreases according to: Determine the time required for the bacteria to be reduced to 10 ppm.

63
**Summary Method Pros Cons Bisection Newton Secant**

4/26/2017 Summary Method Pros Cons Bisection - Easy, Reliable, Convergent - One function evaluation per iteration - No knowledge of derivative is needed - Slow - Needs an interval [a,b] containing the root, i.e., f(a)f(b)<0 Newton - Fast (if near the root) - Two function evaluations per iteration - May diverge - Needs derivative and an initial guess x0 such that f’(x0) is nonzero Secant - Fast (slower than Newton) - One function evaluation per iteration - Needs two initial points guess x0, x1 such that f(x0)- f(x1) is nonzero

Similar presentations

Presentation is loading. Please wait....

OK

Open Methods Chapter 6 The Islamic University of Gaza

Open Methods Chapter 6 The Islamic University of Gaza

© 2019 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google