Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dr. Jie Zou PHY 33201 Chapter 2 Solution of Nonlinear Equations: Lecture (III)

Similar presentations


Presentation on theme: "Dr. Jie Zou PHY 33201 Chapter 2 Solution of Nonlinear Equations: Lecture (III)"— Presentation transcript:

1 Dr. Jie Zou PHY 33201 Chapter 2 Solution of Nonlinear Equations: Lecture (III)

2 Dr. Jie Zou PHY 33202 Outline Numerical methods (3) Secant method

3 Dr. Jie Zou PHY 33203 Secant method Secant method algorithm: An approximation to the derivative: 1. Start with two initial guesses x 1 and x 2 and . set i = 2. 2. Find the new approximation, x i+1. 3. 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.

4 Dr. Jie Zou PHY 33204 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).

5 Dr. Jie Zou PHY 33205 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  = 10 -5.

6 Dr. Jie Zou PHY 33206 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

7 Dr. Jie Zou PHY 33207 Implement Secant method: by hand ixixi f(x i ) Is |f(x i )|   ? Next x i+1 1N/A 2 3 4 … Show work step by step. Keep up to 8 decimal places in your calculations. Also, summarize the results in the Table below.

8 Dr. Jie Zou PHY 33208 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.


Download ppt "Dr. Jie Zou PHY 33201 Chapter 2 Solution of Nonlinear Equations: Lecture (III)"

Similar presentations


Ads by Google