Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Chapter 2 Solution of Nonlinear Equations: Lecture (II) Dr. Jie Zou PHY 3320 1 Outline Numerical methods (2) Newton-Raphson (or simply Newton’s) method Dr. Jie Zou PHY 3320 2 Newton-Paphson method Newton’s method algorithm: f xi xi 1 xi ' : i 1, 2, f xi Dr. Jie Zou PHY 3320 x1: The initial guess for the root of f(x) = 0. x2: The next approximation to the root. The point of intersection of the tangent to the curve at x1 with the x axis gives x2. The iterative procedure stops when meeting a convergence criterion: |f(xi)| , |xi –xi-1| , or |(xi-xi-1)/xi| . 3 Derivation of the Newton’s method Taylor’s series expansion of the function f(x) about an arbitrary point x1: 1 2 '' f x f x1 x x1 f x1 x x1 f x1 2! ' Considering only the first two terms in the expansion: f(x) f(x1) + (x – x1) f ’(x1) Set f(x) f(x1) + (x – x1) f ’(x1) = 0, and solve for the root: f x1 x x2 x1 ' f x1 To further improve the root, replace x2 with x1 to obtain x3, and so on. Dr. Jie Zou PHY 3320 4 Notes on Newton’s method Dr. Jie Zou PHY 3320 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). 5 Example: Newton’s method Example 2.8: Find the root of the equation f x 1.5 x 1 x 2 2 1 0.65 x 0.65 tan 0 2 x 1 x 1 using the Newton-Raphson method with starting point x1 = 0.0, and the convergence criterion, |f(xi)| with = 10-5. Note: The derivative of tan-1(u) is given by d 1 du 1 tan u dx 1 u 2 dx Dr. Jie Zou PHY 3320 6 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 3320 7 Flowchart x1=0.0, =10-5, i=0 i=i+1 |f(xi)| T x_Root=xi Dr. Jie Zou PHY 3320 end F xi 1 f xi xi f xi 8 Implement Newton’s method: by hand • Show work step by step. • Also, summarize the results in the Table below. i xi f(xi) Is |f(xi)| ? f’(xi) (answer if the previous column is No 1 2 3 4 … Dr. Jie Zou PHY 3320 9 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. Dr. Jie Zou PHY 3320 10