MIT流体力学课件2

MIT流体力学课件2

ID:37815049

大小:319.27 KB

页数:12页

时间:2019-05-31

MIT流体力学课件2_第1页
MIT流体力学课件2_第2页
MIT流体力学课件2_第3页
MIT流体力学课件2_第4页
MIT流体力学课件2_第5页
资源描述:

《MIT流体力学课件2》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、IntroductiontoNumericalAnalysisforEngineers•FundamentalsofDigitalComputing–DigitalComputerModels–Convergence,accuracyandstability–Numberrepresentation–Arithmeticoperations–Recursionalgorithms•ErrorAnalysis–Errorpropagation–numericalstability–Errorestimation–Errorcancell

2、ation–Conditionnumbers2.29NumericalMarineHydrodynamicsLecture2FloatingNumberRepresentationmMantissabBaseeExponentExamplesDecimalBinaryConventionDecimalMaxmantissaMinmantissaBinaryMaxexponentGeneralMinexponent2.29NumericalMarineHydrodynamicsLecture2ErrorAnalysisNumberRep

3、resentationAdditionandSubtractionAbsoluteErrorShiftmantissaoflargestnumberRelativeErrorResulthasexponentoflargestnumberAbsoluteErrorRelativeErrorUnboundedMultiplicationandDivisionRelativeErrorBounded2.29NumericalMarineHydrodynamicsLecture2DigitalArithmeticsFiniteMantiss

4、aLengthfunctionc=radd(a,b,n)%radd.m%functionc=radd(a,b,n)%%Addstworealnumbersaandbsimulatinganarithmeticunitwith%nsignificantdigits.%%Firstdeterminesignsa=sign(a);Limitedprecisionsb=sign(b);if(sa==0)additioninMATLABla=-200;elsela=ceil(log10(sa*a*(1+10^(-(n+1)))));endif(

5、sb==0)lb=-200;elselb=ceil(log10(sb*b*(1+10^(-(n+1)))));endlm=max(la,lb);f=10^(n);at=sa*round(f*sa*a/10^lm);bt=sb*round(f*sb*b/10^lm);ct=at+bt;sc=sign(ct);if(sc~=0)if(log10(sc*ct)>=n)ct=round(ct/10)*10;endendc=ct*10^lm/f;2.29NumericalMarineHydrodynamicsLecture2RecursionH

6、eron’sDevicea=26;n=10;MATLABscriptg=1;Numericallyevaluatesquare-root%NumberofDigitsheron.mdig=5;sq(1)=g;fori=2:nsq(i)=0.5*radd(sq(i-1),a/sq(i-1),dig);Initialguessendholdoffplot([0n],[sqrt(a)sqrt(a)],'b')holdonTestplot(sq,'r')plot(a./sq,'r-.')plot((sq-sqrt(a))/sqrt(a),'g

7、')gridonMeanofguessanditsreciprocalRecursionAlgorithm2.29NumericalMarineHydrodynamicsLecture2RecursionHorner’sSchemeEvaluatepolynomialhorner.m%Hornersscheme%forevaluatingpolynomialsa=[12345678910];n=length(a)-1;Horner’sSchemez=1;b=a(1);%Noteindexshiftforafori=1:nb=a(i+1

8、)+z*b;endp=bGeneralordern>>hornerp=Recurrencerelation55>>2.29NumericalMarineHydrodynamicsLecture2RecursionOrde

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。