




版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、 提問(wèn):數(shù)值分析是做什么用的?數(shù)值分析輸入復(fù)雜問(wèn)題或運(yùn)算 近似解1第一章 誤差 /* Error */1 誤差的背景介紹 /* Introduction */1. 來(lái)源與分類 /* Source & Classification */ 從實(shí)際問(wèn)題中抽象出數(shù)學(xué)模型 模型誤差 /* Modeling Error */ 通過(guò)測(cè)量得到模型中參數(shù)的值 觀測(cè)誤差 /* Measurement Error */ 求近似解 方法誤差 (截?cái)嗾`差 /* Truncation Error */ ) 機(jī)器字長(zhǎng)有限 舍入誤差 /* Roundoff Error */21 Introduction: Source &
2、ClassificationThe following problem can be solved either the easy way or the hard way.Two trains 200 miles apart are moving toward each other; each one is going at a speed of 50 miles per hour. A fly starting on the front of one of them flies back and forth between them at a rate of 75 miles per hou
3、r. It does this until the trains collide and crush the fly to death. What is the total distance the fly has flown?The fly actually hits each train an infinite number of times before it gets crushed, and one could solve the problem the hard way with pencil and paper by summing an infinite series of d
4、istances. The easy way is as follows: Since the trains are 200 miles apart and each train is going 50 miles an hour, it takes 2 hours for the trains to collide. Therefore the fly was flying for two hours. Since the fly was flying at a rate of 75 miles per hour, the fly must have flown 150 miles. Tha
5、ts all there is to it.When this problem was posed to John von Neumann, he immediately replied, 150 miles.It is very strange, said the poser, but nearly everyone tries to sum the infinite series.What do you mean, strange? asked Von Neumann. Thats how I did it!31 Introduction: Source & Classification大
6、家一起猜?11 / e解法之一:將 作Taylor展開(kāi)后再積分S4R4 /* Remainder */| 舍入誤差 /* Roundoff Error */ |= 0.747 由截去部分/* excluded terms */引起取則稱為截?cái)嗾`差 /* Truncation Error */由留下部分/* included terms */引起例:近似計(jì)算4據(jù)說(shuō),美軍 1910 年的一次部隊(duì)的命令傳遞是這樣的: 營(yíng)長(zhǎng)對(duì)值班軍官: 明晚大約 8點(diǎn)鐘左右,哈雷彗星將可能在這個(gè)地區(qū)看到,這種彗星每隔 76年才能看見(jiàn)一次。命令所有士兵著野戰(zhàn)服在操場(chǎng)上集合,我將向他們解釋這一罕見(jiàn)的現(xiàn)象。如果下雨的話,就
7、在禮堂集合,我為他們放一部有關(guān)彗星的影片。值班軍官對(duì)連長(zhǎng): 根據(jù)營(yíng)長(zhǎng)的命令,明晚8點(diǎn)哈雷彗星將在操場(chǎng)上空出現(xiàn)。如果下雨的話,就讓士兵穿著野戰(zhàn)服列隊(duì)前往禮堂,這一罕見(jiàn)的現(xiàn)象將在那里出現(xiàn)。連長(zhǎng)對(duì)排長(zhǎng): 根據(jù)營(yíng)長(zhǎng)的命令,明晚8點(diǎn),非凡的哈雷彗星將身穿野戰(zhàn)服在禮堂中出現(xiàn)。如果操場(chǎng)上下雨,營(yíng)長(zhǎng)將下達(dá)另一個(gè)命令,這種命令每隔76年才會(huì)出現(xiàn)一次。排長(zhǎng)對(duì)班長(zhǎng): 明晚8點(diǎn),營(yíng)長(zhǎng)將帶著哈雷彗星在禮堂中出現(xiàn),這是每隔 76年才有的事。如果下雨的話,營(yíng)長(zhǎng)將命令彗星穿上野戰(zhàn)服到操場(chǎng)上去。班長(zhǎng)對(duì)士兵: 在明晚8點(diǎn)下雨的時(shí)候,著名的76歲哈雷將軍將在營(yíng)長(zhǎng)的陪同下身著野戰(zhàn)服,開(kāi)著他那“彗星”牌汽車,經(jīng)過(guò)操場(chǎng)前往禮堂。51 I
8、ntroduction: Spread & Accumulation2. 傳播與積累 /* Spread & Accumulation */例:蝴蝶效應(yīng) 紐約的一只蝴蝶翅膀一拍,風(fēng)和日麗的北京就刮起臺(tái)風(fēng)來(lái)了?!NYBJ以上是一個(gè)病態(tài)問(wèn)題 /* ill-posed problem*/關(guān)于本身是病態(tài)的問(wèn)題,我們還是留給數(shù)學(xué)家去頭痛吧!61 Introduction: Spread & Accumulation例:計(jì)算 公式一:注意此公式精確成立記為則初始誤差? ! !What happened?!71 Introduction: Spread & Accumulation考察第n步的誤差我們有責(zé)任
9、改變。造成這種情況的是不穩(wěn)定的算法 /* unstable algorithm */迅速積累,誤差呈遞增走勢(shì)??梢?jiàn)初始的小擾動(dòng) 公式二:注意此公式與公式一在理論上等價(jià)。方法:先估計(jì)一個(gè)IN ,再反推要求的In ( n N )??扇?1 Introduction: Spread & Accumulation取 We just got lucky?91 Introduction: Spread & Accumulation考察反推一步的誤差:以此類推,對(duì) n 0 不唯一,當(dāng)然 e* 越小越具有參考價(jià)值。I can tell that this parts diameter is 20cm1cm.I
10、 can tell that distance between two planets is 1 million light year 1 light year.Of course mine is more accurate ! The accuracy relates to not only the absolute error, but also to the size of the exact value.112 Error and Significant Digits 相對(duì)誤差 /* relative error */Now I wouldnt call it simple. Say
11、what is the relative error of 20cm1cm?Dont tell me its 5% becauseBut what kind of information does that 5% give us anyway?x 的相對(duì)誤差上限 /* relative accuracy */ 定義為A mathematician, a physicist, and an engineer were traveling through Scotland when they saw a black sheep through the window of the train. Ah
12、a, says the engineer, I see that Scottish sheep are black. Hmm, says the physicist, You mean that some Scottish sheep are black. No, says the mathematician, All we know is that there is at least one sheep in Scotland, and that at least one side of that one sheep is black! 注:從 的定義可見(jiàn), 實(shí)際上被偷換成了 ,而后才考察其
13、上限。那么這樣的偷換是否合法? 嚴(yán)格的說(shuō)法是, 與 是否反映了同一數(shù)量級(jí)的誤差? 關(guān)于此問(wèn)題的詳細(xì)討論可見(jiàn)教材第3頁(yè)。122 Error and Significant Digits 有效數(shù)字 /* significant digits */用科學(xué)計(jì)數(shù)法,記 (其中 )。若 (即 的截取按四舍五入規(guī)則),則稱 為有n 位有效數(shù)字,精確到 。例:?jiǎn)枺?有幾位有效數(shù)字?請(qǐng)證明你的結(jié)論。證明:有 位有效數(shù)字,精確到小數(shù)點(diǎn)后第 位。43注:0.2300有4位有效數(shù)字,而00023只有2位有效。12300如果寫(xiě)成0.123105,則表示只有3位有效數(shù)字。 數(shù)字末尾的0不可隨意省去!132 Error a
14、nd Significant Digits 有效數(shù)字與相對(duì)誤差的關(guān)系 有效數(shù)字 相對(duì)誤差限已知 x* 有 n 位有效數(shù)字,則其相對(duì)誤差限為 相對(duì)誤差限 有效數(shù)字已知 x* 的相對(duì)誤差限可寫(xiě)為則可見(jiàn) x* 至少有 n 位有效數(shù)字。142 Error and Significant Digits 例:為使 的相對(duì)誤差小于0.001%,至少應(yīng)取幾位有效數(shù)字?解:假設(shè) * 取到 n 位有效數(shù)字,則其相對(duì)誤差上限為要保證其相對(duì)誤差小于0.001%,只要保證其上限滿足已知 a1 = 3,則從以上不等式可解得 n 6 log6,即 n 6,應(yīng)取 * = 3.14159。153 函數(shù)的誤差估計(jì) /*Error
15、 Estimation for Functions*/問(wèn)題:對(duì)于 y = f (x),若用 x* 取代 x,將對(duì)y 產(chǎn)生什么影響?分析:e*(y) = f (x*) f (x) e*(x) = x* xMean Value Theorem= f ( )(x* x)x* 與 x 非常接近時(shí),可認(rèn)為 f ( ) f (x*) ,則有:|e*(y)| | f (x*)|e*(x)|即:x*產(chǎn)生的誤差經(jīng)過(guò) f 作用后被放大/縮小了| f (x*)|倍。故稱| f (x*)|為放大因子 /* amplification factor */ 或 絕對(duì)條件數(shù) /* absolute condition nu
16、mber */.163 Error Estimation for Functions相對(duì)誤差條件數(shù) /* relative condition number*/ f 的條件數(shù)在某一點(diǎn)是小大,則稱 f 在該點(diǎn)是好條件的 /* well-conditioned */ 壞條件的 /* ill-conditioned */。注:關(guān)于多元函數(shù) 的討論,請(qǐng)參閱教材第5、6頁(yè)。173 Error Estimation for Functions例:計(jì)算 y = ln x。若 x 20,則取 x 的幾位有效數(shù)字可保證 y 的相對(duì)誤差 0.1% ?解:設(shè)截取 n 位有效數(shù)字后得 x* x,則估計(jì) x 和 y 的
17、相對(duì)誤差上限滿足近似關(guān)系不知道怎么辦???x 可能是20.#,也可能是19.#,取最壞情況,即a1 = 1。 n 4例:計(jì)算 ,取 4 位有效,即 , 則相對(duì)誤差184 幾點(diǎn)注意事項(xiàng) /* Remarks */1. 避免相近二數(shù)相減 (詳細(xì)分析請(qǐng)參閱教材p.6 - p.7)例:a1 = 0.12345,a2 = 0.12346,各有5位有效數(shù)字。 而 a2 a1 = 0.00001,只剩下1位有效數(shù)字。 幾種經(jīng)驗(yàn)性避免方法:當(dāng) | x | 1 時(shí):更多技巧請(qǐng)見(jiàn)教材第8頁(yè)習(xí)題6。194 Remarks2. 避免小分母 : 分母小會(huì)造成浮點(diǎn)溢出 /* over flow */3. 避免大數(shù)吃小數(shù)例:
18、用單精度計(jì)算 的根。精確解為 算法1:利用求根公式在計(jì)算機(jī)內(nèi),109存為0.11010,1存為0.1101。做加法時(shí),兩加數(shù)的指數(shù)先向大指數(shù)對(duì)齊,再將浮點(diǎn)部分相加。即1 的指數(shù)部分須變?yōu)?010,則:1 = 0.01 1010,取單精度時(shí)就成為: 109+1=0.100000001010+0.00000000 1010=0.10000000 1010大數(shù)吃小數(shù)204 Remarks算法2:先解出 再利用注:求和時(shí)從小到大相加,可使和的誤差減小。例:按從小到大、以及從大到小的順序分別計(jì)算1 + 2 + 3 + + 40 + 1094. 先化簡(jiǎn)再計(jì)算,減少步驟,避免誤差積累。一般來(lái)說(shuō),計(jì)算機(jī)處理下
19、列運(yùn)算的速度為5. 選用穩(wěn)定的算法。HW: p.8-9 #1, #7Self-study Ch.2-1 Excuses for not doing homeworkI accidentally divided by zeroand my paper burst into flames. 21Lab 01. Numerical Summation of a Series Produce a table of the values of the series (1)for the 3001 values of x, x = 0.0, 0.1, 0.2, , 300.00. All entries
20、of the table must have an absolute error less than 1.0e-10. This problem is based on a problem from Hamming (1962), when mainframes were very slow by todays microcomputer standards. InputThere is no input.Output The output is to be formatted as two columns with the values of x and (x) printed as in the C fprintf: fprintf(outfile,%6.2f%16.12fn,x,psix); /* hererepresents a space */22As an example, the sample output below shows 4 acceptable lines out of 3001, which might appear in the output file. The values of x should start at 0.00 and increase
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 加盟連鎖招商合同范本
- 國(guó)家旅游課題申報(bào)書(shū)
- 辦公購(gòu)置合同范本
- 單位套房出售合同范本
- 售賣義齒器械合同范本
- 建設(shè)知識(shí)產(chǎn)權(quán)保護(hù)高地的實(shí)施細(xì)則與規(guī)劃
- 員工欠款合同范本
- 黨務(wù)材料外包合同范本
- 品牌油漆采購(gòu)合同范本
- 合同范本書(shū)庫(kù)
- 重點(diǎn)關(guān)愛(ài)學(xué)生幫扶活動(dòng)記錄表
- 2024年部編版五年級(jí)下冊(cè)語(yǔ)文第一單元綜合檢測(cè)試卷及答案
- 5-6歲幼兒園小學(xué)美術(shù)PPT課件教案教程創(chuàng)意幼教手工《樹(shù)懶》
- 牛津譯林英語(yǔ)七年級(jí)上冊(cè)7AUnits1-4單元復(fù)習(xí)課件
- 《義務(wù)教育道德與法治課程標(biāo)準(zhǔn)(2022年版)》
- 2023北京高三一模語(yǔ)文匯編:非連續(xù)性文本閱讀
- 初中物理核心素養(yǎng)培養(yǎng)
- 保安公司招聘筆試題及答案
- 介紹錢(qián)三強(qiáng)的
- 農(nóng)業(yè)資源與環(huán)境經(jīng)濟(jì)學(xué)
- JCT2110-2012 室內(nèi)空氣離子濃度測(cè)試方法
評(píng)論
0/150
提交評(píng)論