英文文献翻译

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

西安工程大学本科毕业设计(译文)1AnIntroductiontoProgrammingandNumericalMethodsinMATLAB----S.R.Otto&J.P.Denier----PAGE(234-254)(原文)Chapter7:NumericalIntegration7.1IntroductionInthischapterweshalldiscusstechniqueswherebyfunctionscanbeintegrated;thesearequiteclassical.Wewillgivethederivationoftheapproximationsandwillmentionthelikelyfailingsofthetechniques.Twoversionsofthecodewillbegivenforeachofthemainmethods,sowecanstarttoappreciatethepowerofMATLAB.ItisofcoursepossibletowritethecodeasifitwereFortranorC,butthatwouldwastethepowerofthepackage.Beforewestartwenote:ifweconsidertwopointswecanfitastraightlinethroughthem;withthreewecanfitaquadraticandwithfourwecanfitacubic(thiswasdiscussedinmoredetailinChapter5).Westartbybreakingdowntheintegrationr´egimeintosmallintervalsandapproximatingtheareabelowthecurvebyslices.Thismethodistantamounttocountingthesquaresanddealingwiththepartsofsquaresatthetopsofthecolumnsinsophisticatedways.Inthiscasetheareaunderthecurveisapproximately7×4דtheareaoftheboxes”(thefourthrowuphasafewpartsquaresasdoesthefifthrow).Weobviously西安工程大学本科毕业设计(译文)2needaschemewhichisslightlymorerobust.7.2IntegrationUsingStraightLinesInthischapterourobjectiveistocalculatethevalueoftheintegralΙ=∫f(x)dx.bx=aWeshallassumewecancalculate(easily)thevalueoff(x)forallvaluesofxbetweenaandb.Thismeanswearedealingwithafunctionratherthanasetofdatavalues.Weshallexplorethelattercaseinduecoursebutatthisjunctureweshalluseanewroutineintegrand.m:%%integrand.m%inputasetofvalues(x)%outputfunctionvaluesf(x)%function[f]=integrand(x)%Hereweusef=sin(xˆ2)asa%samplefunction.f=sin(x.ˆ2);Weshallnowtakeawhiletoderivethemethodwearegoingtousetointegratethefunctiononthegridofpoints.WeshalluseNpointsandassuchweusethecodestep=(b-a)/(N-1);x=a:step:b;f=integrand(x);Inordertoderivetheformfortheintegrationweintroducethenomenclaturethatthepointswehavedefinedaboveare(𝓍j,fj),wherejrunsfrom1toN.Letusconsidertheconsecutivepoints(𝓍j,fj)and(𝓍j+1,fj+1)andapproximatethecurvebetweenthembyastraightline.Weusetheformulaforthelinethroughthepoints(𝓍1,𝓎1)and(𝓍2,𝓎2)whichis西安工程大学本科毕业设计(译文)3𝒴−𝒴1𝒴2−𝒴1=𝒳−𝒳1𝒳2−𝒳1or𝓎=𝓎1+𝒴2−𝒴1𝒳2−𝒳1(𝓍−𝓍1).InourcasethisgivesfL(𝓍)=fj+fj+1−fj𝒽(𝓍−𝓍j),wherewehaveintroduced𝒽=𝓍j+1−𝓍jandfL(𝓍)theformulaforthestraightline(ThisisjustadirectapplicationofNewton’sForwardDifferences,(5.1).)LetusnowperformtheanalyticalintegrationofthefunctionfL(𝓍)between𝓍jand𝓍j+1todeterminetheareaAj,j+1:A𝐣,𝐣+𝟏=∫fL𝔁𝐣+𝟏𝔁=𝔁𝐣(𝔁)𝒹𝓍=∫fj+1−fj𝒽(𝓍−𝓍j)𝒹𝓍+𝔁𝐣+𝟏𝔁=𝔁𝐣fj𝒹𝓍.WeintroducethelineartransformationX=𝓍−𝓍j,where𝒹X=𝒹𝓍andwhen𝓍=𝓍j,𝓍=0and𝓍=𝓍j+1correspondto𝓍=𝒽.TheintegralbecomesAj,j+1=∫[fj+1−fj𝒽X+fj]𝒽X=0𝒹X,whichcanbeintegratedtoyieldAj,j+1=𝒽2(fj+fj+1).Thisistheareaofatrapeziumwithverticesat(𝓍j,0),(𝓍j,fj),(𝓍j+1,fj+1)and(𝓍j+1,0).Theareaofatrapeziumisthemeanofthelengthofthetwoparallelsidestimestheperpendiculardistancebetweenthem;thatis(fj+fj+1)/2times(𝓍j+1−𝓍j).西安工程大学本科毕业设计(译文)4Thismethodisunsurprisinglycalledthetrapeziumrule.Inordertodeterminethetotalareafrom𝓍=ato𝓍=bwesumallthepartsArea=∑Aj,j+1j=N−1j=1=∑𝒽2j=N−1j=1(fj+fj+1).InordertoperformthissummationitisinstructivetowriteouttheseriesArea=𝒽2(f1+f2)+𝒽2(f2+f3)+𝒽2(f3+f4)+⋯+𝒽2(fN−2+fN−1)+𝒽2(fN−1+fN),sothatArea=𝒽2(f1+2f2+2f3+⋯+2fN−1+2fN)≈∫f(𝓍)b𝓍=a𝒹𝓍,Example7.1Weshallcalculatetheintegralofthefunctionf(𝓍)=𝓍3sin𝓍betweenzeroandone.WeshalluseNpointsN=10;x=linspace(0,1,N);h=x(2)-x(1);f=x.ˆ3.*sin(x);g=h*(sum(f)-f(1)/2-f(N)/2);Herewehaveconstructedagridofpointsrunningfromzerotooneandthenworkedoutthegapbetweensuccessivepoints(thatish).Wenowconstructthefunctionfandworkouttheexpressionforthetrapeziumrule,whichisthesumofthevaluesoffminushalfoftheendvalues.Thisgivesthevalueoftheintegralasg.7.2.1ErrorsintheTrapeziumMethod西安工程大学本科毕业设计(译文)5Thenumberofpointsrequiredforacalculationdependsonhowexactlyyouneedtoknowtheanswer(ingeneral).Theerrorinthisschemeisencounteredbecauseweapproximatethecurvebetweenthepoints(𝓍j,fj)and(𝓍j+1,fj+1)byastraightline.Thiscanbereducedbyusingaquadraticinsteadovertheintervalspannedbytherequisitethreepoints.Wecouldhaveusedthefundamentalcodewhichdidnotmakeuseofthecombinationsoftheterms:integral=0;fori=2:Nintegral=integral+(f(i)+f(i-1))/2*h;endTheadvantageofthisformofthecodeisitisfareasiertoconverttooneinwhichintermediateresultsareavailable.Wenotethatthecommand/2*hdividesbytwoandmultipliesbyhratherthandividingby2h:thiswouldbeaccomplishedviaparentheses,thatis/(2*h).Beforeweproceedweshouldconsidertheerrorinvolvedinapproximatingtheareabyasetoftrapezia.Theerroristheunshadedpartbelowthecurve.Toestimatetheextentofthisweagainuse“TaylorSeries”andnotethatf(𝓍)=f(𝓍j)+f(𝓍j+1)−f(𝓍j)𝒽(𝓍−𝓍j)+(𝓍−𝓍j)(𝓍−𝓍j+1)2𝒹2f𝒹𝓍2|𝓍=ℰwhereℰ[𝓍j,𝓍j+1].Thiscanbeintegratedtogive西安工程大学本科毕业设计(译文)6∫f(𝓍)𝓍j+1𝓍=𝓍j𝒹𝓍=𝒽2(f(𝓍j)+f(𝓍j+1))+𝒽36𝒹2f𝒹𝓍2|𝓍=ℰConsequentlytheerrorinusingjustthefirsttermisproportionalto𝒽3andf(ℰ).Noticethatifthesecondderivativeiszeroovertherangetheerrorisactuallyzero.Unsurprisinglythiscorrespondstof(𝓍)beingastraightline.7.3IntegrationUsingQuadraticsWe

1 / 37
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功