![[數(shù)值算法]求根算法系列小結(jié)_第1頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/6/238455b0-52ee-4f9f-91c8-666a37858f0d/238455b0-52ee-4f9f-91c8-666a37858f0d1.gif)
![[數(shù)值算法]求根算法系列小結(jié)_第2頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/6/238455b0-52ee-4f9f-91c8-666a37858f0d/238455b0-52ee-4f9f-91c8-666a37858f0d2.gif)
![[數(shù)值算法]求根算法系列小結(jié)_第3頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/6/238455b0-52ee-4f9f-91c8-666a37858f0d/238455b0-52ee-4f9f-91c8-666a37858f0d3.gif)
![[數(shù)值算法]求根算法系列小結(jié)_第4頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/6/238455b0-52ee-4f9f-91c8-666a37858f0d/238455b0-52ee-4f9f-91c8-666a37858f0d4.gif)
![[數(shù)值算法]求根算法系列小結(jié)_第5頁(yè)](http://file3.renrendoc.com/fileroot_temp3/2022-3/6/238455b0-52ee-4f9f-91c8-666a37858f0d/238455b0-52ee-4f9f-91c8-666a37858f0d5.gif)
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、精選文檔數(shù)值算法求根算法系列小結(jié) 1二分求根法:二分求根法主要用的思想是不斷調(diào)整并縮小搜索區(qū)間的大小,當(dāng)搜索區(qū)間的大小已小于搜索精度要求時(shí),則可說(shuō)明已找到滿足條件的近擬根.當(dāng)然,在這之前,首先是要準(zhǔn)確的估計(jì)出根所處的區(qū)間,否則,是找不到根的。Type binaryPationMethod(Type x1,Type x2,Type e,Type (*arguF)(Type),FILE* outputFile) Type x;/*The return answer*/ Type mid; Type down,up; int iteratorNum=0; down=x1; u
2、p=x2; assertF(x1<=x2,"in twoPation x1>=x2"); assertF(arguF!=NULL,"in twoPation arguF is NULL"); assertF(outputFile!=NULL,"in twoPation outputFile is NULL"); assertF(*arguF)(x1)*(*arguF)(x2)<=0,"in twoPation,f(x1)*f(x2)>0"); fprintf(outputFile,"
3、;downttupttrn"); /*two pation is a method that is surely to find root for a formula*/ while(fabs(up-down)>(float)1/(float)2*e) mid=(down+up)/2; if (*arguF)(mid)=0) break; else if(*arguF)(down)*(*arguF)(mid)>0) down=mid; else up=mid; fprintf(outputFile,"%-12f%-12frn",down,up); it
4、eratorNum+; /*get the answer*/ x=mid; /*Output Answer*/ fprintf(outputFile,"total iterator time is:%drn",iteratorNum); fprintf(outputFile,"a root of equation is :%frn",x); return x; 測(cè)試1:用二分法求: f(x)=x3-x2-2*x+1=0在(0,1)附近的根. 精度:0.001. Output: downup 0.000000 0.500000 0.250000 0.500
5、000 0.375000 0.500000 0.437500 0.500000 0.437500 0.468750 0.437500 0.453125 0.437500 0.445313 0.441406 0.445313 0.443359 0.445313 0.444336 0.445313 0.444824 0.445313 total iterator time is:11 a root of equation is :0.444824 2迭代法: 迭代法首先要求方程能夠化到x=fi(x)的形式,并且還要保證這個(gè)式子在所給定的區(qū)間范圍內(nèi)滿足收斂要求. 主要的迭代過(guò)
6、程是簡(jiǎn)單的,就是: x_k+1=fi(xk) 當(dāng)xk+1-xk滿足精度要求時(shí),則表示已找到方程的近擬根. Type iteratorMethod(Type downLimit,Type upLimit,Type precise,Type (*fiArguF)(Type),FILE* outputFile) Type xk; int iteratorNum=0; assertF(downLimit<=upLimit,"in iteratorMethod x1>=x2"); assertF(fiArguF!=NULL,"in iteratorMethod
7、arguF is NULL"); assertF(outputFile!=NULL,"in iteratorMethod outputFile is NULL"); xk=downLimit; fprintf(outputFile,"kttXkttrn"); fprintf(outputFile,"%-12d%-12frn",iteratorNum,xk); iteratorNum+; while(fabs(*fiArguF)(xk)-xk)>(float)1/(float)2*precise) /*in mathem
8、atic,reason:*/ /* xk_1=(*fiArguF)(xk); */ xk=(*fiArguF)(xk); fprintf(outputFile,"%-12d%-12frn",iteratorNum,xk); iteratorNum+; fprintf(outputFile,"root finded at x=%frn",xk); return xk; 測(cè)試2:用迭代法求解方程 f(x)=1/(x+1)2的近似根. 根的有效區(qū)間在(0.4,0.55). 精度為0.0001. Output: kXk 0 0.40000
9、0 1 0.510204 2 0.438459 3 0.483287 4 0.454516 5 0.472675 6 0.461090 7 0.468431 8 0.463759 9 0.466724 10 0.464839 11 0.466037 12 0.465276 13 0.465759 14 0.465452 15 0.465647 16 0.465523 17 0.465602 18 0.465552 root finded at x=0.465552 3Aitken加速法 Aitken也是基于迭代法的一種求根方案,所不同的是它在迭代式的選取上做了一些工作,
10、使得迭代的速度變得更快. Type AitkenAccMethod(Type startX,Type precise,Type (*fiArguF)(Type),FILE* outputFile) Type xk; int iteratorNum=0; assertF(fiArguF!=NULL,"in AitkenAccMethod arguF is NULL"); assertF(outputFile!=NULL,"in AitkenAccMethod outputFile is NULL"); xk=startX; fprintf(outputFi
11、le,"kttXkttrn"); fprintf(outputFile,"%-12d%-12frn",iteratorNum,xk); iteratorNum+; while(fabs(*fiArguF)(xk)-xk)>(float)1/(float)2*precise) xk=(xk*(*fiArguF)(*fiArguF)(xk)-(*fiArguF)(xk)*(*fiArguF)(xk)/(*fiArguF)(*fiArguF)(xk)-2*(*fiArguF)(xk)+xk); fprintf(outputFile,"%-12d
12、%-12frn",iteratorNum,xk); iteratorNum+; fprintf(outputFile,"root finded at x=%frn",xk); return xk; 測(cè)試3:Aitken迭代加速算法的應(yīng)用 計(jì)算的是方程 x=1/(x+1)2在x=0.4附近的近似根. 精度:0.0001 Ouput: kXk 0 0.400000 1 0.466749 2 0.465570 root finded at x=0.465570 4牛頓求根法: 牛頓求根法通過(guò)對(duì)原方程
13、切線方程的變換,保證了迭代結(jié)果的收斂性,唯一麻煩的地方是要提供原函數(shù)的導(dǎo)數(shù): Type NewTownMethod(Type startX,Type precise,Type (*fiArguF)(Type),Type (*fiArguFDao)(Type),FILE* outputFile) Type xk; int iteratorNum=0; assertF(fiArguF!=NULL,"in NewTownMethod,arguF is NULLn"); assertF(fiArguFDao!=NULL,"in NewTownMethod,fiArguFD
14、ao is NULLn"); assertF(outputFile!=NULL,"in NewTownMethod,fiArguFDao is NULLn"); xk=startX; fprintf(outputFile,"kttXkttrn"); fprintf(outputFile,"%-12d%-12frn",iteratorNum,xk); iteratorNum+; while(fabs(*fiArguF)(xk)/(*fiArguFDao)(xk)>(float)1/(float)2*precise) /*
15、 Core Maths Reason Xk+1=Xk-f(Xk)/f'(Xk); */ xk=xk-(*fiArguF)(xk)/(*fiArguFDao)(xk); fprintf(outputFile,"%-12d%-12frn",iteratorNum,xk); iteratorNum+; fprintf(outputFile,"root finded at x=%frn",xk); return xk; 測(cè)試4:牛頓求根法的應(yīng)用: 被求方程為:f(x)=x(x+1)2-1=0 其導(dǎo)數(shù)為:f'(x)=(x+1
16、)(3x+1) 所求其在0.4附近的近似根. 精度為0.00001 Output: kXk 0 0.400000 1 0.470130 2 0.465591 3 0.465571 root finded at x=0.465571 5割線法(快速弦截法): 是用差商來(lái)代替避免求f(x)的一種方案,由這種迭代式產(chǎn)生的結(jié)果序列一定是收斂的. Type geXianMethod(Type down,Type up,Type precise,Type (*fiArguF)(Type),FILE* outputFile) Type xk,xk_1,tmpData; int ite
17、ratorNum=0; assertF(fiArguF!=NULL,"in geXian method,fiArguF is nulln"); assertF(outputFile!=NULL,"in geXian method,outputFile is nulln"); assertF(down<=up,"in geXian method,down>upn"); xk_1=down; xk=up; fprintf(outputFile,"kttXk_1ttXkttrn"); fprintf(outp
18、utFile,"%-12d%-12f%-12frn",iteratorNum,xk_1,xk); iteratorNum+; while(fabs(xk-xk_1)>(float)1/(float)2*precise) tmpData=xk; xk=xk-(*fiArguF)(xk)*(xk-xk_1)/(*fiArguF)(xk)-(*fiArguF)(xk_1); xk_1=tmpData; fprintf(outputFile,"%-12d%-12f%-12frn",iteratorNum,xk_1,xk); iteratorNum+; fprintf(outputFile,"root finded at x=%frn",xk); return xk; 測(cè)試5:割線法的應(yīng)用: 所求的方程為: f(x)
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 臍橙種植合同協(xié)議書(shū)范本
- 體育場(chǎng)塑膠跑道材料的選擇
- 河北承德市雙灤區(qū)圣泉高級(jí)中學(xué)2024-2025學(xué)年高二下學(xué)期4月份月考數(shù)學(xué)試卷(解析)
- 2025年冷氣(N2)推進(jìn)系統(tǒng)合作協(xié)議書(shū)
- 2025年橡膠零件、附件項(xiàng)目建議書(shū)
- 護(hù)理各項(xiàng)小治療操作規(guī)范
- 商業(yè)空間高端定制化精裝修設(shè)計(jì)與施工合同
- 無(wú)人機(jī)土方測(cè)量與施工圖預(yù)算編制合作協(xié)議
- 金融創(chuàng)新企業(yè)股權(quán)分紅激勵(lì)與風(fēng)險(xiǎn)控制協(xié)議
- 美妝專區(qū)品牌合作經(jīng)營(yíng)與區(qū)域市場(chǎng)拓展合同
- 小區(qū)安全排查
- 中國(guó)典籍英譯概述課件
- 【MOOC】保險(xiǎn)學(xué)概論-中央財(cái)經(jīng)大學(xué) 中國(guó)大學(xué)慕課MOOC答案
- 【MOOC】航空發(fā)動(dòng)機(jī)結(jié)構(gòu)分析與設(shè)計(jì)-南京航空航天大學(xué) 中國(guó)大學(xué)慕課MOOC答案
- 紅旅賽道未來(lái)規(guī)劃
- GIS安裝標(biāo)準(zhǔn)化作業(yè)指導(dǎo)書(shū)
- 帶電作業(yè)施工方案
- 宏定義與跨平臺(tái)開(kāi)發(fā)
- 腰椎病護(hù)理措施
- 社保費(fèi)扣費(fèi)協(xié)議書(shū)范文范本下載
- 2024年全國(guó)寄生蟲(chóng)病防治技能競(jìng)賽備賽試題庫(kù)-上(血吸蟲(chóng)病、瘧疾)
評(píng)論
0/150
提交評(píng)論