Financial Mathematics Methods: Newton’s Method

1.Newton’s method

1.1 Introduction to Newton’s method

  Newton's method, also known as the Newton-Raphson method, is an iterative method for numerically approximating roots. It was proposed by British scientist Isaac Newton in the 17th century.
  The basic idea of ​​Newton's method is to approximate the root of a function through continuous iteration. It uses local linear approximation of the function to approximate the roots of the function by finding the intersection of the tangent line and the x-axis. Specifically, Newton's method uses an initial guess as a starting point, and then calculates the intersection of the tangent and the x-axis as the next guess based on the value of the function and its derivative at that point. By continually repeating this process, you can get closer to the roots of the function.

1.2 Algorithm steps

Step1: Choose an initial guess value: choose a function close to f ( x ) f(x)f ( x ) zero pointx 0 x_0x0. Step2: Calculate at point x 0 x_0
x0Function value f ( x 0 ) f(x_0)f(x0) and the derivativef ′ ( x 0 ) f\prime\left( x_0 \right)f(x0) . Step3:Calculate the crossing point(x 0, f (x 0) (x_0,f(x_0))
(x0,f(x0) and the slope isf ′ ( x 0 ) f\prime\left( x_0 \right)f(x0) andxxThe intersection point of the x- axis x 1 x_1x1, that is, the equation f ′ ( x 0 ) ( x − x 0 ) + f ( x 0 ) = 0 f \prime(x_0)(x-x_0)+f(x_0)=0f(x0)(xx0)+f(x0)=0的解,即 x 1 = x 0 − f ( x 0 ) f ′ ( x 0 ) x_1=x_0-\frac{f\left( x_0 \right)}{f\prime\left( x_0 \right)} x1=x0f(x0)f(x0). Step4: Use the iterative formula of Newton's method xn + 1 = xn − f ( xn ) f ′ ( xn ) x_{n+1}=x_n-\frac{f\left( x_n \right)}{f\prime\left (x_n \right)}
xn+1=xnf(xn)f(xn)Iterate until f (xn) f(x_n)f(xn) is small enough (a termination condition can be set), the numerical solution is considered to be close enough to the real solution, and then the iteration is stopped.

2. Specific calculation example

Use Newton's method to find ex = 2 e^x=2ex=Solution of 2 , select the initial pointx 0 = 1 x_0=1x0=1 , and then solve it using Newton's iterative formula.
The specific python program is as follows:

import numpy as np
def hanshu(x):
    return np.exp(x)-2
def daoshu(x):
    return np.exp(x)
def newtown(x0):
    d=hanshu(x0)
    count=0
    while d>0.000001 and count<100:
        x1=x0-d/daoshu(x0)
        x0=x1
        d=hanshu(x0)
        count+=1
    return x0,count
print(newtown(1))

Solution result: (0.6931475810597714, 3)
Equation ex = 2 e^x=2ex=The actual solution of 2 is 0.6931471805599453. It can be seen that using Newton's method iterates three times to obtain a highly accurate result, and the convergence speed is relatively fast.

3. Summary

Newton's method is widely used in mathematics and scientific engineering, especially in tasks such as solving nonlinear equations, optimization problems, and curve fitting. Newton's method has the characteristics of rapid convergence, but it is sensitive to the selection of initial values ​​and may fall into a local optimal solution. Therefore, the selection of initial values ​​and the convergence analysis of the algorithm need to be considered when using Newton's method.


Guess you like

Origin blog.csdn.net/m0_64087341/article/details/133432846