资源描述:
《第五节松弛法.ppt》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、§5松弛法/*RelaxationMethods*/换个角度看Jacobi方法:Jacobi第K次迭代结果§5RelaxationMethods§5RelaxationMethodsGauss-SeidelIterativeMethod…………写成矩阵形式:BGauss-Seidel迭代阵§5RelaxationMethodsGauss-Seidel…………§5RelaxationMethods§5RelaxationMethods定理设A可逆,且aii0,松弛法从任意出发对某个收敛(L)<1。§5
2、RelaxationMethods§5RelaxationMethods定理(Kahan必要条件)设A可逆,且aii0,松弛法从任意出发收敛0<<2。证明:,而且收敛
3、i
4、<1总成立已知收敛
5、det(L)
6、<1
7、det(L)
8、=
9、1
10、n<10<<2§5RelaxationMethods定理(Ostrowski-Reich充分条件)若A对称正定,且有0<<2,则松弛法从任意出发收敛。(证明以后给出)Q:Whatfactordeterminesthespeedofconvergence
11、?A:Thesmaller(B)is,thefastertheiterationswillconverge.对于SOR法,希望找使得(L)最小。§5RelaxationMethods定理若A为对称正定三对角阵,则且SOR的最佳松弛因子/*optimalchoiceofforSORmethod*/为,此时。例:,考虑迭代格式问:取何值可使迭代收敛?取何值时迭代收敛最快?解:考察B=I+A的特征根1=1+,2=1+3收敛要求(B)<1-2/3<<0(B)=max{
12、1+
13、,
14、
15、1+3
16、}当取何值时最小?-2/3-1/30=-1/2§5RelaxationMethodsLab08.SORMethodUsetheSORmethodtosolveagivenn×nlinearsystemwithaninitialapproximationandasetof’s.InputThereareseveralsetsofinputs.Foreachset:The1stlinecontainsaninteger100n0whichisthesizeofamatrix.n=1sig
17、nalstheendoffile.Thefollowingnlinescontaintheaugmentedmatrixinthefollowingformat:Thenumbersareseparatedbyspacesandnewlines.ThenextlinecontainsarealnumberTOL,whichisthetolerancefor
18、
19、·
20、
21、norm,andanintegerN0whichisthemaximumnumberofiterations.Thelastlineofeac
22、htestcasecontainsanintegerm>0,followedbymreal’s.§5RelaxationMethodsOutput(representsaspace)Foreach,theremustbeasetofoutputsinthefollowingformat:The1stlinecontainsanandthecorrespondingnumberofiterationstaken.IntheCprintf:fprintf(outfile,"%4.2f%d",omeg
23、a,iter_no);Thecorrespondingsolutionorerrormessagesaretobeprintedasthefollowing:EachentryofthesolutionistobeprintedasintheCfprintf:fprintf(outfile,"%12.8f",x);IfthematrixAhasazerocolumn,printthemessage“Matrixhasazerocolumn.Nouniquesolutionexists.
24、n”.IfthemethodfailstogiveasolutionafterNiterations,printthemessage“Maximumnumberofiterationsexceeded.”.Ifthereisanentryofthatisoutoftherange[2127,2127],printthemessage“Noconvergence.”.Theoutp