線性方程組的誤差分析_第1頁
線性方程組的誤差分析_第2頁
線性方程組的誤差分析_第3頁
線性方程組的誤差分析_第4頁
線性方程組的誤差分析_第5頁
已閱讀5頁,還剩7頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

§2線性方程組的誤差分析

/*ErrorAnalysisforLinearsystemofEquations*/求解時,A

和的誤差對解有何影響?

設(shè)A

精確,有誤差,得到的解為,即絕對誤差放大因子又相對誤差放大因子§2ErrorAnalysisfor.

設(shè)精確,A有誤差,得到的解為,即

Waitaminute…

Whosaidthat(I+A

1A)isinvertible?(只要

A充分小,使得是關(guān)鍵的誤差放大因子,稱為A的條件數(shù),記為cond(A),越則A越病態(tài),難得準確解。大§2ErrorAnalysisfor.

注:

cond(A)的具體大小與||·||的取法有關(guān),但相對大小一致。

cond(A)取決于A,與解題方法無關(guān)。

常用條件數(shù)有:cond(A)1cond(A)

cond(A)2特別地,若A對稱,則條件數(shù)的性質(zhì):

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?!?ErrorAnalysisfor.

精確解為例:計算cond(A)2。A1=解:考察A

的特征根39206>>1

測試病態(tài)程度:給一個擾動,其相對誤差為此時精確解為2.0102>200%§2ErrorAnalysisfor.

例:Hilbert陣cond

(H2)

=27cond

(H3)

748cond

(H6)

=2.9106cond

(Hn)

asn

注:一般判斷矩陣是否病態(tài),并不計算A1,而由經(jīng)驗得出。

行列式很大或很?。ㄈ缒承┬?、列近似相關(guān));

元素間相差大數(shù)量級,且無規(guī)則;

主元消去過程中出現(xiàn)小主元;

特征值相差大數(shù)量級?!?ErrorAnalysisfor.

近似解的誤差估計及改善:設(shè)的近似解為,則一般有cond(A)誤差上限

改善方法:Step1:近似解Step2:Step3:Step4:若可被精確解出,則有就是精確解了。經(jīng)驗表明:若A不是非常病態(tài)(例如:),則如此迭代可達到機器精度;但若A病態(tài),則此算法也不能改進。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

的元素不改變,故可以事先調(diào)整好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給出了例子。收斂性分析將在下節(jié)課討論?!?Jacobi&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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論