Dr. Jie Zou PHY Chapter 2 Solution of Nonlinear Equations: Lecture (II)
Dr. Jie Zou PHY Outline Numerical methods (2) Newton-Raphson (or simply Newton’s) method
Dr. Jie Zou PHY Newton-Paphson method Newton’s method algorithm: x 1 : The initial guess for the root of f(x) = 0. x 2 : The next approximation to the root. The point of intersection of the tangent to the curve at x 1 with the x axis gives x 2. The iterative procedure stops when meeting a convergence criterion: |f(x i )| , |x i –x i-1 | , or |(x i -x i-1 )/x i | .
Dr. Jie Zou PHY Derivation of the Newton’s method Taylor’s series expansion of the function f(x) about an arbitrary point x 1 : Considering only the first two terms in the expansion: f(x) f(x 1 ) + (x – x 1 ) f ’ (x 1 ) Set f(x) f(x 1 ) + (x – x 1 ) f ’ (x 1 ) = 0, and solve for the root: To further improve the root, replace x 2 with x 1 to obtain x 3, and so on.
Dr. Jie Zou PHY Notes on Newton’s method Newton’s method requires the derivative of the function, f’ = df/dx; some may be quite complicated. f(x) may not be available in explicit form, in which case numerical differentiation techniques are required. Newton’s method converges very fast in most cases. However, it may not converge (see examples on the left).
Dr. Jie Zou PHY Example: Newton’s method Example 2.8: Find the root of the equation using the Newton-Raphson method with starting point x 1 = 0.0, and the convergence criterion, |f(x i )| with = Note: The derivative of tan -1 (u) is given by
Dr. Jie Zou PHY Plot function f(x) Let’s first plot the function f(x) from x = 0 to 1 to gain some insight on the behavior of the function. Root
Dr. Jie Zou PHY Flowchart x 1 =0.0, =10 -5, i=0 i=i+1 |f(x i )| x_Root=x i end T F
Dr. Jie Zou PHY Implement Newton’s method: by hand ixixi f(x i ) Is |f(x i )| ? f’(x i ) (answer if the previous column is No … Show work step by step. Also, summarize the results in the Table below.
Dr. Jie Zou PHY Implement Newton’s method: write an M-file For the Example given on slide #6, write an M-file to compute the root of the equation using Newton-Raphson method. Follow the flowchart provided previously. Save the M-file as myNewton- Raphson.m. A copy of the M-file will be handed out later.