线性方程组的误差分析_第1页
线性方程组的误差分析_第2页
线性方程组的误差分析_第3页
线性方程组的误差分析_第4页
线性方程组的误差分析_第5页
已阅读5页,还剩7页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

§2线性方程组的误差分析

/*ErrorAnalysisforLinearsystemofEquations*/求解时,A

和的误差对解有何影响?

设A

精确,有误差,得到的解为,即绝对误差放大因子又相对误差放大因子§2ErrorAnalysisfor.

设精确,A有误差,得到的解为,即

Waitaminute…

Whosaidthat(I+A

1A)isinvertible?(只要

A充分小,使得是关键的误差放大因子,称为A的条件数,记为cond(A),越则A越病态,难得准确解。大§2ErrorAnalysisfor.

注:

cond(A)的具体大小与||·||的取法有关,但相对大小一致。

cond(A)取决于A,与解题方法无关。

常用条件数有:cond(A)1cond(A)

cond(A)2特别地,若A对称,则条件数的性质:

A可逆,则cond(A)p

1;

A可逆,

R

则cond(

A)

=cond(A);

A正交,则cond(A)2=1;

A可逆,R正交,则cond(RA)2

=cond(AR)2

=cond(A)2。§2ErrorAnalysisfor.

精确解为例:计算cond(A)2。A1=解:考察A

的特征根39206>>1

测试病态程度:给一个扰动,其相对误差为此时精确解为2.0102>200%§2ErrorAnalysisfor.

例:Hilbert阵cond

(H2)

=27cond

(H3)

748cond

(H6)

=2.9106cond

(Hn)

asn

注:一般判断矩阵是否病态,并不计算A1,而由经验得出。

行列式很大或很小(如某些行、列近似相关);

元素间相差大数量级,且无规则;

主元消去过程中出现小主元;

特征值相差大数量级。§2ErrorAnalysisfor.

近似解的误差估计及改善:设的近似解为,则一般有cond(A)误差上限

改善方法:Step1:近似解Step2:Step3:Step4:若可被精确解出,则有就是精确解了。经验表明:若A不是非常病态(例如:),则如此迭代可达到机器精度;但若A病态,则此算法也不能改进。HW:p.66#2,#4,#5§3Jacobi法和Gauss-Seidel法

/*Jacobi&Gauss-SeidelIterativeMethods*/

JacobiIterativeMethod写成矩阵形式:A=LUDBJacobi迭代阵§3Jacobi&Gauss-SeidelIterativeMethods

Algorithm:JacobiIterativeMethod

Solvegivenaninitialapproximation

.Input:thenumberofequationsandunknownsn;thematrixentriesa[][];

theentriesb[];theinitialapproximationX0[];toleranceTOL;

maximumnumberofiterationsNmax.Output:approximatesolutionX[]oramessageoffailure.Step1Setk=1;Step2While(k

Nmax)dosteps3-6

Step3Fori=1,…,n

Set;/*compute

xk*/

Step4IfthenOutput(X[]);STOP;/*successful*/

Step5Fori=1,…,nSetX0[]=X[];/*updateX0*/

Step6Setk++;Step7Output(Maximumnumberofiterationsexceeded);STOP./*unsuccessful*/Whatifaii

=0?迭代过程中,A

的元素不改变,故可以事先调整好A

使得aii

0,否则

A不可逆。必须等X(k)完全计算好了才能计算X(k+1),因此需要两组向量存储。Abitwasteful,isn’tit?§3Jacobi&Gauss-SeidelIterativeMethods

Gauss-SeidelIterativeMethod…………只存一组向量即可。写成矩阵形式:BGauss-Seidel

迭代阵Amathematicianabouthiscolleague:"Hemadealotofmistakes,buthemadetheminagooddirection.Itriedtocopythis,butIfoundoutthatitisverydifficulttomakegoodmistakes."§3Jacobi&Gauss-SeidelIterativeMethods注:二种方法都存在收敛性问题。有例子表明:Gauss-Seidel法收敛时,Jacobi法可能不收敛;而Jacobi法收敛时,Gauss-Seidel法也可能不收敛。p.76#2给出了例子。收敛性分析将在下节课讨论。§3Jacobi&Gauss-SeidelIterativeMethodsLab07.Gauss-SeidelMethod UsetheGauss-Seidelmethodtosolveagivenn×n

linearsystemwithaninitialapproximationandagiventoleranceTOL.

Input Thereareseveralsetsofinputs.Foreachset: The1stlinecontainsaninteger100

n

0whichisthesizeofamatrix.n=

1signalstheendoffile. Thefollowingnlinescontaintheaugmentedmatrixinthefollowingformat:Thenumbersareseparatedbyspacesandnewlines.ThelastlineofeachtestcasecontainsarealnumberTOL,whichisthetolerancefor||·||

norm,andanintegerN

0whichisthemaximumnumberofiteration.§3Jacobi&Gauss-SeidelIterativeMethodsOutput/*

representsaspace*/

EachentryofthesolutionistobeprintedasintheCfprintf:fprintf(outfile,"%12.8f\n",x);

Ifthematrixhasazerocolumn,printthemessage“Matrix

has

a

zero

column.

No

unique

solution

exists.\n”.

IfthemethodfailstogiveasolutionafterNiterations,printthemessage“Maximum

number

of

iterations

exceeded.\n”.

Ifthereisanentryofthatisoutoftherange,printthemessage“No

convergence.\n”.Theoutputsoftwotestcasesmustbeseperatedbyablankline.SampleInput

(

representsaspace)

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论