1、2022-3-20 Wuhan University Confidential1提问:数值分析是做什么用的?提问:数值分析是做什么用的?2022-3-20 Wuhan University Confidential2 计算方法计算方法提出问题提出问题.),(,)(,ln,xfdxddxxfbxAxaxbax 方法方法 可行可行计算机计算机近似解近似解2022-3-20 Wuhan University Confidential32022-3-20 Wuhan University Confidential42022-3-20 Wuhan University Confidential52022
2、-3-20 Wuhan University Confidential62022-3-20 Wuhan University Confidential7! 3! 2132xxxexbAx gBxxkk1若将前若干项的部分和作为函数值的近似公式,由于以后各项都舍弃了,自然产生了误差2022-3-20 Wuhan University Confidential814159.32022-3-20 Wuhan University Confidential9We should think much of the influence of these four errors!2022-3-20 Wuha
3、n University Confidential102022-3-20 Wuhan University Confidential112022-3-20 Wuhan University Confidential12Of course mine is more accurate ! The accuracy relates to not only the absolute error, but also to the size of the exact value.2022-3-20 Wuhan University Confidential13*rexxexx*reex*|rre*re*2
4、*2*()(/)()1/eeexxeexxxx xxxeex2022-3-20 Wuhan University Confidential14*x1415926. 31416. 314159. 32022-3-20 Wuhan University Confidential154105 . 0|1416. 3|5105 . 0|14159. 3|*x2022-3-20 Wuhan University Confidential16用科学计数法,记用科学计数法,记 (其中(其中 )。若)。若 则称则称x x* * 有有n 位有效数字。位有效数字。01 anm.xx 1050|* *1(0.) 1
5、0mnxaa LL2022-3-20 Wuhan University Confidential17例例 考察三位有效数字重力加速度g,若以m/s2为单位, g9.80m/s2, 若以km/s2为单位, g0.00980km/s2,221 g9 .8 01 0/,2ms,102100980. 0g 5*21110 .2绝对误差限*52110 .2绝对误差限* 0.005/9.800.000005/0.00980.r而相对误差限相同:2022-3-20 Wuhan University Confidential18 有效数字与相对误差的关系有效数字与相对误差的关系 有效数字有效数字 相对误差限相
6、对误差限(1)1212110 51010*0.1020.1102mnnrmnn*.x*a aaa aa()已知已知 x* 有有 n 位位有效数字有效数字,则其,则其相对误差限相对误差限为为 相对误差限相对误差限 有效数字有效数字1121111110|*|* | *|0.102(1)10(1)100 5102(1)nmrnmmnxxxa aaa.a()()(1110)1(21*nra已知已知 x* 的的相对误差限相对误差限可写为可写为则则可见可见 x* 至少至少有有 n 位位有效数字有效数字。2022-3-20 Wuhan University Confidential192022-3-20 W
7、uhan University Confidential201416. 3*5 11|102 3re 20%1 . 0*11111|10100.1%22 4nnrex 2022-3-20 Wuhan University Confidential21 数值运算的误差估计数值运算的误差估计为近似值,则误差限:为准确值四则运算,设*2*121,xxxx*1212*121221*122112* 22 ()()(), () |() |(),|() |() (/).|xxxxx xxxxxxxxxxxx,*, ,*)(*)*)(*)()( )(22)(之间在公式,由一元函数xxxxxxxfxfxfTay
8、lorxff *( *) ( ( *) |( *)|( *).f xf xfxx得的误差限2022-3-20 Wuhan University Confidential22*111*1*1( ,),(,) ( *)().nnnnnkkkf xxxxxxf xxffxx多元函数,为准确值的近似值同理得的误差限2022-3-20 Wuhan University Confidential23*( )ln .( )()( )()| |()|( )( )()|( )|( )|f xxf xf xf xf xxxf xf x xxfxxxf x2022-3-20 Wuhan University Con
9、fidential24cos ( , ), 1.300.005,0.8710.0005.(1.30 0.871)()yf x yxyxuff xyu设如果用,作为,的近似值,则 能有几位有效数字?(即求相对误差限).)871. 030. 1(005. 00022. 00005. 030. 1871. 0sin005. 030. 1871. 0cos)(sincos49543. 030. 1871. 0cos)871. 030. 1( 22能能有有三三位位有有效效数数字字,所所以以而而,由由于于,解解:fuuxyyfxyxffu 例例2022-3-20 Wuhan University Conf
10、idential252022-3-20 Wuhan University Confidential262022-3-20 Wuhan University Confidential279, 2 , 1,101ndxexExnn110111011011|nxnxnxnnnEdxexnexdxexE2022-3-20 Wuhan University Confidential2811nnnEE11eE068480.0,264242.0,367879.0921EEEWhat happened?!2022-3-20 Wuhan University Confidential29nEEnn1111101
11、nedxxeEnn0916123.0,050000.0,0 .091920EEE We just got lucky?2022-3-20 Wuhan University Confidential30(一)、病态问题与条件数(一)、病态问题与条件数., :)()()()(*)(条件数称为计算函数值问题的相对误差比为考虑计算函数值问题,ppxfxf xxxxfxfxfCC%.24%,2,24. 1)02. 1 (, 1) 1 (,10,)(10函数值相对误差为自变量相对误差为例如ffCxxfp.10认为是病态一般pC 对一个数值问题,如果输入的数据有微小扰动(误差),引起输出数据(解)相对误差很
12、大,称为病态问题。2022-3-20 Wuhan University Confidential31000034.0999999.7,000033.8yxyxHow to avoid this problem?2022-3-20 Wuhan University Confidential3201581.010001001102.062.3164.3110001001372721009.61001745.0210)1(sin2A377106)9994.01 (10)2cos1 (10A2022-3-20 Wuhan University Confidential33)211(12112xxexx
13、exx2022-3-20 Wuhan University Confidential34 经验性避免方法:经验性避免方法:;xxxx ;1lnlnln xxx2022-3-20 Wuhan University Confidential351 .24710011.07182.2,2 .2781001.07182.2What a big error!*2( )( ),xyyxxxyyy当时,舍入误差会扩大。2022-3-20 Wuhan University Confidential36100110004090. 00006. 04994. 010004090. 00006. 010004994
14、. 0 Remember to avoid this phenomenon!2022-3-20 Wuhan University Confidential37nnnnnnnaxaxaxaxaaxaxaxaxP)()(12101110What a good method!2022-3-20 Wuhan University Confidential38256212864321684222222222215次乘法运算而不是255次2022-3-20 Wuhan University Confidential392022-3-20 Wuhan University Confidential40202
15、2-3-20 Wuhan University Confidential41例例 计算多项式的值 .)( 0111axaxaxaxPnnnnn)(3.4 ,0), 1( .)(,01n-kSxPaxSSaSnkkknn秦九韶算法秦九韶算法:乘法运算次数由o(n2)次降为o(n),降低了运算复杂度.2022-3-20 Wuhan University Confidential422022-3-20 Wuhan University Confidential43n要掌握算法的原理和思想n要掌握算法的处理技巧、步骤和计算公式n重视误差分析,理解收敛性、稳定性分析的理论n做一定的理论分析证明与计算练习n上机实践