Dr. Jie Zou PHY Chapter 2 Solution of Nonlinear Equations: Lecture (III)
Dr. Jie Zou PHY Outline Numerical methods (3) Secant method
Dr. Jie Zou PHY Secant method Secant method algorithm: An approximation to the derivative: 1. Start with two initial guesses x 1 and x 2 and . set i = Find the new approximation, x i Verify the convergence. If |f(x i+1 )| , stop the process by taking x i+1 as the root. Otherwise, set i=i+1 and go to step 2.
Dr. Jie Zou PHY Notes on Secant method Secant method is similar to Newton’s method but uses a back-ward finite- difference approximation for the derivative, f’(x). Secant method may not converge (see an example on the left).
Dr. Jie Zou PHY Example: Secant method Example 2.14: Find the root of the equation using Secant method with two initial guesses x l = 0.0 and x 2 = 0.5 and the convergence criterion, |f(x i )| with =
Dr. Jie Zou PHY Secant Method Flowchart x 1 =0.0, x 2 =0.5, =10 -5, i=2 i=i+1 |f(x i+1 )| x_Root=x i+1 end T F
Dr. Jie Zou PHY Implement Secant method: by hand ixixi f(x i ) Is |f(x i )| ? Next x i+1 1N/A … Show work step by step. Keep up to 8 decimal places in your calculations. Also, summarize the results in the Table below.
Dr. Jie Zou PHY Implement Secant method: write an M-file For the Example given on slide #5, write an M-file to compute the root of the equation using Secant method. Follow the flowchart provided previously. Save the M-file as mySecant.m. A copy of the M-file will be handed out later.