Presentation is loading. Please wait.

Presentation is loading. Please wait.

MATH 2140 Numerical Methods

Similar presentations


Presentation on theme: "MATH 2140 Numerical Methods"— Presentation transcript:

1 MATH 2140 Numerical Methods
Faculty of Engineering Mechanical Engineering Department MATH Numerical Methods Instructor: Dr. Mohamed El-Shazly Associate Prof. of Mechanical Design and Tribology Office: F072

2 B.2. Secant Method Newton-Raphson method needs to compute the derivatives. The secant method approximate the derivatives by finite divided difference. From Newton-Raphson method

3 Secant Method

4 Secant Method – Example
Find root of f(x) = e-x - x = 0 with initial estimate of x-1 = 0 and x0 = 1.0. (Answer: α= ) i xi-1 xi f(xi-1) f(xi) xi+1 εt 1 8.0 % 0.58 % 2 % Again, compare this results obtained by the Newton-Raphson method and simple fixed point iteration method.

5 The Secant Method: Algorithm
Secant Derivation Secant Example Regula Falsi The Secant Method: Algorithm To find a solution to f (x ) = 0 given initial approximations p0 and p1; tolerance TOL; maximum number of iterations N0. 1 Set i = 2, q0 = f (p0), q1 = f (p1) 2 While i ≤ N0 do Steps 3–6: Set p = p1 − q1(p1 − p0)/(q1 − q0). (Compute pi ) If |p − p1| < TOL then OUTPUT (p); (The procedure was successful.) STOP Set i = i + 1 Set p0 = p1; (Update p0, q0, p1, q1) q0 = q1; p1 = p; q1 = f (p) OUTPUT (‘The method failed after N0 iterations, N0 =’, N0); (The procedure was unsuccessful) STOP Numerical Analysis (Chapter 2) Secant & Regula Falsi Methods R L Burden & J D Faires 8 / 25

6 Outline Secant Method: Derivation & Algorithm
Secant Derivation Secant Example Regula Falsi Outline 1 Secant Method: Derivation & Algorithm 2 Comparing the Secant & Newton’s Methods 3 The Method of False Position (Regula Falsi) Numerical Analysis (Chapter 2) Secant & Regula Falsi Methods R L Burden & J D Faires 9 / 25

7 Comparing the Secant & Newton’s Methods
Secant Derivation Secant Example Regula Falsi Comparing the Secant & Newton’s Methods Example: f (x ) = cos x − x Use the Secant method to find a solution to x = cos x , and compare the approximations with those given by Newton’s method with p0 = π/4. Formula for the Secant Method Numerical Analysis (Chapter 2) Secant & Regula Falsi Methods R L Burden & J D Faires 10 / 25

8 Comparing the Secant & Newton’s Methods
Secant Derivation Secant Example Regula Falsi Comparing the Secant & Newton’s Methods Example: f (x ) = cos x − x Use the Secant method to find a solution to x = cos x , and compare the approximations with those given by Newton’s method with p0 = π/4. Formula for the Secant Method We need two initial approximations. Suppose we use p0 = 0.5 and p1 = π/4. Numerical Analysis (Chapter 2) Secant & Regula Falsi Methods R L Burden & J D Faires 10 / 25

9 Comparing the Secant & Newton’s Methods
Secant Derivation Secant Example Regula Falsi Comparing the Secant & Newton’s Methods Example: f (x ) = cos x − x Use the Secant method to find a solution to x = cos x , and compare the approximations with those given by Newton’s method with p0 = π/4. Formula for the Secant Method We need two initial approximations. Suppose we use p0 = 0.5 and p1 = π/4. Succeeding approximations are generated by the formula (pn− 1 − pn− 2 )(cos pn− 1 − pn− 1 ) pn = pn−1 − (cos p p ) , for n ≥ 2. p ) − (cos p n−1 − n−1 n−2 − n−2 Numerical Analysis (Chapter 2) Secant & Regula Falsi Methods R L Burden & J D Faires 10 / 25

10 Comparing the Secant & Newton’s Methods
Secant Derivation Secant Example Regula Falsi Comparing the Secant & Newton’s Methods Newton’s Method for f (x ) = cos(x ) − x , p = π 4 n pn−1 f (pn−1) f t (pn−1) pn |pn − pn−1| 1 2 3 4 Numerical Analysis (Chapter 2) Secant & Regula Falsi Methods R L Burden & J D Faires 11 / 25

11 Comparing the Secant & Newton’s Methods
Secant Derivation Secant Example Regula Falsi Comparing the Secant & Newton’s Methods Newton’s Method for f (x ) = cos(x ) − x , p = π 4 n pn−1 f (pn−1) f t (pn−1) pn |pn − pn−1| 1 2 3 4 An excellent approximation is obtained with n = 3. Numerical Analysis (Chapter 2) Secant & Regula Falsi Methods R L Burden & J D Faires 11 / 25

12 Comparing the Secant & Newton’s Methods
Secant Derivation Secant Example Regula Falsi Comparing the Secant & Newton’s Methods Newton’s Method for f (x ) = cos(x ) − x , p = π 4 n pn−1 f (pn−1) f t (pn−1) pn |pn − pn−1| 1 2 3 4 An excellent approximation is obtained with n = 3. Because of the agreement of p3 and p4 we could reasonably expect this result to be accurate to the places listed. Numerical Analysis (Chapter 2) Secant & Regula Falsi Methods R L Burden & J D Faires 11 / 25

13 Comparing the Secant & Newton’s Methods
Secant Derivation Secant Example Regula Falsi Comparing the Secant & Newton’s Methods Secant Method for f (x ) = cos(x ) − x , p0 = 0.5, p1 = π 4 n pn−2 pn−1 pn |pn − pn−1| 2 3 4 5 Numerical Analysis (Chapter 2) Secant & Regula Falsi Methods R L Burden & J D Faires 12 / 25

14 Comparing the Secant & Newton’s Methods
Secant Derivation Secant Example Regula Falsi Comparing the Secant & Newton’s Methods Secant Method for f (x ) = cos(x ) − x , p0 = 0.5, p1 = π 4 n pn−2 pn−1 pn |pn − pn−1| 2 3 4 5 Comparing results, we see that the Secant Method approximation p5 is accurate to the tenth decimal place, whereas Newton’s method obtained this accuracy by p3. Numerical Analysis (Chapter 2) Secant & Regula Falsi Methods R L Burden & J D Faires 12 / 25

15 Comparing the Secant & Newton’s Methods
Secant Derivation Secant Example Regula Falsi Comparing the Secant & Newton’s Methods Secant Method for f (x ) = cos(x ) − x , p0 = 0.5, p1 = π 4 n pn−2 pn−1 pn |pn − pn−1| 2 3 4 5 Comparing results, we see that the Secant Method approximation p5 is accurate to the tenth decimal place, whereas Newton’s method obtained this accuracy by p3. Here, the convergence of the Secant method is much faster than functional iteration but slightly slower than Newton’s method. Numerical Analysis (Chapter 2) Secant & Regula Falsi Methods R L Burden & J D Faires 12 / 25

16 Comparing the Secant & Newton’s Methods
Secant Derivation Secant Example Regula Falsi Comparing the Secant & Newton’s Methods Secant Method for f (x ) = cos(x ) − x , p0 = 0.5, p1 = π 4 n pn−2 pn−1 pn |pn − pn−1| 2 3 4 5 Comparing results, we see that the Secant Method approximation p5 is accurate to the tenth decimal place, whereas Newton’s method obtained this accuracy by p3. Here, the convergence of the Secant method is much faster than functional iteration but slightly slower than Newton’s method. This is generally the case. Order of Convergence Numerical Analysis (Chapter 2) Secant & Regula Falsi Methods R L Burden & J D Faires 12 / 25

17

18

19


Download ppt "MATH 2140 Numerical Methods"

Similar presentations


Ads by Google