牛頓-拉普森法原理
? 在多變量微積分和矩陣?yán)碚摰慕徊纥c(diǎn)是求解非線性代數(shù)方程的迭代方法。設(shè)是的
n
n
n個(gè)未知向量x,有
F
(
x
)
=
0
∈
R
n
\mathbf{F}\left( \mathbf{x} \right) =0\in \text{R}^{\text{n}}
F(x)=0∈Rn
就是求解x的
n
n
n個(gè)非線性方程組,其中向量函數(shù)具有連續(xù)導(dǎo)數(shù),并且雅可比矩陣
F
x
(
x
)
\mathbf F_\mathbf{x}(\mathbf x)
Fx?(x) 在
R
n
R^n
Rn的開集D中是非奇異的。在解的估計(jì)值為
x
0
x^0
x0的情況下,一階泰勒展開尋求
x
0
x^0
x0的擾動(dòng)
Δ
x
0
\Delta x^0
Δx0,該干擾
Δ
x
0
\Delta x^0
Δx0使得
x
1
=
x
0
+
Δ
x
0
\mathbf{x}^1=\mathbf{x}^0+\Delta \mathbf{x}^0
x1=x0+Δx0更好地逼近解,使得
F
(
x
0
)
+
F
x
(
x
0
)
Δ
x
0
=
0
\mathbf{F}\left( \mathbf{x}^0 \right) +\mathbf{F}_{\mathbf{x}}\left( \mathbf{x}^0 \right) \Delta \mathbf{x}^0=0
F(x0)+Fx?(x0)Δx0=0
經(jīng)過(guò)
J
J
J次迭代,增量方程可表示為
F
x
(
x
j
)
Δ
x
j
=
?
F
(
x
j
)
x
j
+
1
=
x
j
+
Δ
x
j
\begin{array}{l} \mathbf{F}_{\mathbf{x}}\left( \mathbf{x}^{\mathbf{j}} \right) \Delta \mathbf{x}^{\mathbf{j}}=-\mathbf{F}\left( \mathbf{x}^{\mathbf{j}} \right)\\ \mathbf{x}^{j+1}=\mathbf{x}^{\text{j}}+\Delta \mathbf{x}^{\text{j}}\\ \end{array}
Fx?(xj)Δxj=?F(xj)xj+1=xj+Δxj?
一直持續(xù)到
∥
F
(
x
j
+
1
)
∥
≤
Tol
\lVert \mathbf{F}\left( \mathbf{x}^{j+1} \right) \rVert \leq \text{Tol}
∥F(xj+1)∥≤Tol ,其中Tol為解的容差。
如果
x
0
x^0
x0足夠接近解,則該方法二次收斂于解;即
∥
x
ˉ
?
x
j
+
1
∥
≤
k
∥
x
ˉ
?
x
j
∥
2
\lVert \mathbf{\bar{x}}-\mathbf{x}^{j+1} \rVert \leq \text{k}\lVert \mathbf{\bar{x}}-\mathbf{x}^j \rVert ^2
∥xˉ?xj+1∥≤k∥xˉ?xj∥2
其中
x
 ̄
\overline x
x是解,
k
k
k是常數(shù)。然而,良好的初始估計(jì)通常很難獲得,并且對(duì)于較差的初始估計(jì),該方法可能會(huì)產(chǎn)生偏差。幸運(yùn)的是,在時(shí)間
t
i
+
1
=
t
i
+
h
,
(
i
=
1
,
2
,
…
,
h
很
小
)
t_i+1=t_i+ h,(i=1,2,…,h很?。?
ti?+1=ti?+h,(i=1,2,…,h很小)的運(yùn)動(dòng)學(xué)和動(dòng)力學(xué)模擬應(yīng)用中,其解可以用作
t
i
+
1
t_i+1
ti?+1的初始估計(jì),并且很可能收斂。
Nowton-Raphson方法matlab程序?
代碼如下(示例):文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-449986.html
tolerance=1.0e-10; %迭代誤差
x=0.5; %初始值
iters=0; %迭代次數(shù)
rnorm=1.0; %初始誤差的最大值
itersmax=20; %最大迭代次數(shù)
while iters<itersmax && rnorm>tolerance %Iteration for x, through line 15
fx=1+sin(x)-x; %原函數(shù)
dfx=cos(x)-1; %函數(shù)的一階導(dǎo)數(shù)
K=-dfx; R=fx;
delx=R/K; %Newton-Raphson iteration,x的增量
x=x+delx;
rnorm=abs(R);
iters=iters+1;
fprintf('iters=%3d,|R|=%14.5e,|delx|=%14.5e\n',iters,rnorm,abs(delx));
end
% 輸出最終結(jié)果
if rnorm<tolerance
fprintf('the converged solution is:x=%14.6e,f(x)=%15.8e\n',x,fx);
else
fprintf('oops,your newton-raphson failed')
end
輸出結(jié)果文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-449986.html
iters= 1,|R|= 9.79426e-01,|delx|= 8.00070e+00
iters= 2,|R|= 6.70264e+00,|delx|= 4.18242e+00
iters= 3,|R|= 4.24162e+00,|delx|= 3.06478e+00
iters= 4,|R|= 6.96585e-01,|delx|= 1.01248e+00
iters= 5,|R|= 4.98041e-01,|delx|= 3.03586e-01
iters= 6,|R|= 3.80906e-02,|delx|= 2.75686e-02
iters= 7,|R|= 3.52559e-04,|delx|= 2.59991e-04
iters= 8,|R|= 3.15841e-08,|delx|= 2.32956e-08
iters= 9,|R|= 4.44089e-16,|delx|= 3.27548e-16
the converged solution is:x= 1.934563e+00,f(x)=-4.44089210e-16
到了這里,關(guān)于牛頓-拉普森法求解線性方程組原理及matlab程序的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!