資源描述:
《數(shù)值分析上機(jī)實(shí)驗(yàn)》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫(kù)。
1、.........................劉力輝2010210804011.“畫圓為方”問題也是古希臘人所提出幾何三大難題中的另一個(gè)問題。即求作一個(gè)正方形,使其面積等于已知圓的面積。不妨設(shè)已知圓的半徑為R=1,試用數(shù)值試驗(yàn)顯示“畫圓為方”問題計(jì)算過程中的誤差。(1)MATLAB程序:y=pi^(1/2);%togenerate15-bitvalueofsquarerootofpib=1;d=1;fork=1:8b=b*10;d=d/10;%banddcombinedtocontrolthedi
2、gitofxx=d*fix(b*y);s(k)=x^3;l(k)=x;endformatlong[l',s'](2)誤差分析:位數(shù)h近似值V近似值21.74.9130000000000031.775.5452330000000041.7725.5640516480000051.77245.5678204794240061.772455.5682917029811371.7724535.5683199772400181.77245385.5683275170585491.772453855.568327
3、988297422.算法的數(shù)值穩(wěn)定性實(shí)驗(yàn)設(shè),由xn=xn+5xn–1–5xn–1可得遞推式In=–5In–1+1/n(1)從I0盡可能精確的近似值出發(fā),利用遞推公式:(n=1,2,…20)計(jì)算從I1到I20的近似值;(2)從較粗糙的估計(jì)值出發(fā),用遞推公式:(n=30,29,…,3,2)計(jì)算從到的近似值;(3)分析所得結(jié)果的可靠性以及出現(xiàn)這種現(xiàn)象的原因。I0==ln(5+x)=ln6-ln5所以I0≈0.18232155679395專業(yè)資料分享.........................MATLA
4、B程序:formatlongI0=log2(6)/log2(exp(1))-log2(5)/log2(exp(1))%calculatethevalueofI0=ln6-ln5forn=1:20I0=-5*I0+1/n;%recyclingequationbetweenI(n+1)andI(n)s(n)=I0;ends'則計(jì)算結(jié)果為:表1I10.0883922160302300I110.0140713362538500I20.0580389198488700I120.0129766520640700I
5、30.0431387340890000I130.0120398166027400I40.0343063295550100I140.0112294884148600I50.0284683522249700I150.0105192245923700I60.0243249055418100I160.0099038770381400I70.0212326151481100I170.0093041442210800I80.0188369242594600I180.0090348344501700I90.0169
6、264898137900I190.0074574066965100I100.0153675509310500I200.0127129665174600從計(jì)算的數(shù)據(jù)看出I20=0.0127129665174600>I19=0.0074574066965100又In的積分范圍為0~1,所以應(yīng)該有In>In+1。所以算法不穩(wěn)定。下面分析導(dǎo)致算法不穩(wěn)定的原因:令Sn為近似值,則有(1)又(2)(1)-(2)得Sn-In=-5Sn-1-In-1=(-5)n(S0-I0)=(-5)nε0(3)ε0為I0的誤差???/p>
7、知由下往上遞推時(shí)誤差是以指數(shù)增加傳遞的,即εn=(-5)nε0所以必然會(huì)導(dǎo)致算法不穩(wěn)定。又公式(3)知,當(dāng)由上往下遞推時(shí),誤差是以指數(shù)減少傳遞的,即ε0=1/(-5)nεn(4)所以此時(shí)算法是穩(wěn)定的。下面便給出由I30的估計(jì)值算I29~I(xiàn)1的值?!堋軐I(yè)資料分享.........................所以有≤In≤即1/186≤I30≤1/155,取為1/155。MATLAB程序:formatlongI0=1/155%calculatethevalueofI30=ln6-ln5forn=30
8、:-1:2I0=(-1/5)*I0+1/(5*n);%recyclingequationbetweenI(n+1)andI(n)s(n-1)=I0;endj=1;fori=29:-1:1a(j)=s(i);j=j+1;enda'計(jì)算出相應(yīng)數(shù)據(jù)為:表2S290.005376344086020S140.011229186626480S280.005821282906930S130.012039876960420S270.005978600561470S120