1. 牛顿迭代法
Ex1:
x2=5,f(x)=x2−5,求f(x)=0时的xx^2=5,f(x)=x^2-5,求f(x)=0时的xx2=5,f(x)=x2−5,求f(x)=0时的x.
y−y0=m(x−x0)y-y_0=m(x-x_0)y−y0=m(x−x0)
y=0,⇒y=0,\Rightarrowy=0,⇒
0−y0=m(x1+x0)x1=−y0m+x0=x0−y0m=x0−f(x0)f′(x0)0-y_0=m(x_1+x_0)\\ x_1=\frac{-y_0}{m}+x_0\\ =x_0-\frac{y_0}{m}\\ =x_0-\frac{f(x_0)}{f'(x_0)}0−y0=m(x1+x0)x1=m−y0+x0=x0−my0=x0−f′(x0)f(x0)
牛顿法:
xn+1=xn−f(x0)f′(x0)x_{n+1}=x_n-\frac{f(x_0)}{f'(x_0)}xn+1=xn−f′(x0)f(x0)
x0=2,f(x)=x2−5x_0=2,f(x)=x^2-5x0=2,f(x)=x2−5
f′(x)=2xf'(x)=2xf′(x)=2x
x1=x0−x02−52x0=x0−12x0+52x0=12x0+52x0x_1=x_0-\frac{x_0^2-5}{2x_0}\\=x_0-\frac{1}{2}x_0+\frac{5}{2x_0}\\
=\frac{1}{2}x_0+\frac{5}{2x_0}x1=x0−2x0x02−5=x0−21x0+2x05=21x0+2x05
依次进行x2=16172x_2=\frac{161}{72}x2=72161
x3=12∗16172+52∗72161=??????x_3=\frac{1}{2}*\frac{161}{72}+\frac{5}{2}*\frac{72}{161}=??????x3=21∗72161+25∗16172=??????.
n | 5−xn\sqrt{5}-x_n5−xn |
---|---|
0 | 2∗10−12*10^{-1}2∗10−1 |
1 | 2∗10−22*10^{-2}2∗10−2 |
2 | 2∗10−52*10^{-5}2∗10−5 |
3 | 2∗10−102*10^{-10}2∗10−10 |
. … | … |