您好,欢迎访问三七文档
当前位置:首页 > 行业资料 > 其它行业文档 > Monte-Carlo与积分计算
第九章MonteCarlo积分第九章MonteCarlo积分MonteCarlo法的重要应用领域之一:计算积分和多重积分适用于求解:1.被积函数、积分边界复杂,难以用解析方法或一般的数值方法求解;2.被积函数的具体形式未知,只知道由模拟返回的函数值。本章内容:用MonteCarlo法求定积分的几种方法:均匀投点法、期望值估计法、重要抽样法、半解析法、…第九章MonteCarlo积分Goal:Evaluateanintegral:baIdxg(x)Whyuserandommethods?Computationby“deterministicquadrature”canbecomeexpensiveandinaccurate.gridpointsaddupquicklyinhighdimensionsbadchoicesofgridmaymisrepresentg(x)第九章MonteCarlo积分MonteCarlomethodcanbeusedtocomputeintegralofanydimensiond(d-foldintegrals)Errorcomparisonofd-foldintegralsSimpson’srule,…dNE/121NEpurelystatistical,notrelyonthedimension!MonteCarlomethodWINS,whend3MonteCarlomethodapproximatingtheintegralofafunctionfusingquadraticpolynomials)]()(4)([31)()(210000xfxfxfhdxxfdxxfhxxxxhxxxx1201第九章MonteCarlo积分Hit-or-MissMethodSampleMeanMethodVarianceReductionTechniqueVarianceReductionusingRejectionTechniqueImportanceSamplingMethodHit-or-MissMethod•EvaluationofadefiniteintegraldxxIba)(xxhanyfor)(abhXXXXXXOOOOOOO•ProbabilitythatarandompointresideinsidetheareaNMhabIp)(NMhabI)(N:TotalnumberofpointsM:pointsthatresideinsidetheregionHit-or-MissMethodSampleuniformlyfromtherectangularregion[a,b]x[0,h]a)-h(bI:pTheprobabilitythatwearebelowthecurveisSo,ifwecanestimatep,wecanestimateI:a)-h(bpIˆˆwhereisourestimateofppˆHit-or-MissMethodWecaneasilyestimatep:throwN“uniformdarts”attherectangleNMpˆletletMbethenumberoftimesyouendupunderthecurvey=g(x)Hit-or-MissMethodabhXXXXXXOOOOOOOStartSetN:largeintegerM=0Chooseapointxin[a,b]Chooseapointyin[0,h]if[x,y]resideinsidethenM=M+1I=(b-a)h(M/N)EndLoopNtimesauabx1)(2huyHit-or-MissMethodErrorAnalysisoftheHit-or-MissMethodItisimportanttoknowhowaccuratetheresultofsimulationsarenotethatMisbinomial(M,p))1()()(2PNpMNpMEIpabhMENabhabhNMEabhpEIE)()()()()(ˆ)ˆ(NppabhMNabhabhNMabhpI)1()()()()()(ˆ)ˆ(222222222NMppˆ)1()()ˆ(NMMNabhI21)1()()ˆ(NNppabhI第九章MonteCarlo积分Hit-or-MissMethodSampleMeanMethodVarianceReductionTechniqueVarianceReductionusingRejectionTechniqueImportanceSamplingMethodSampleMeanMethodStartSetN:largeintegers1=0,s2=0xn=(b-a)un+ayn=(xn)s1=s1+yn,s2=s2+yn2Estimatemeanm’=s1/NEstimatevarianceV’=s2/N–m’2EndLoopNtimesNVabISMerror'6745.0)(SampleMeanMethoddxg(x)IbaWritethisas:dxa-b1g(x)a)-(bdxg(x)Ibabag(X)Ea)-(bwhereX~unif(a,b)SampleMeanMethodg(X)Ea)-(bIwhereX~unif(a,b)So,wewillestimateIbyestimatingE[g(X)]withn1i)ˆig(Xn1[g(X)]EwhereX1,X2,…,Xnisarandomsamplefromtheuniform(a,b)distribution.SampleMeanMethoddxeI30xExample:(weknowthattheanswerise3-119.08554)writethisas]3E[edx31e3IX30xwhereX~unif(0,3)SampleMeanMethodwritethisas]3E[edx31e3IX30xwhereX~unif(0,3)estimatethiswithn1ixXien13][eE3IˆˆwhereX1,X2,…,Xnarenindependentunif(0,3)’s.SampleMeanMethodSimulationResults:true=19.08554,n=100,000119.10724Iˆ219.08260318.97227419.06814519.13261SimulationSampleMeanMethodDon’tevergiveanestimatewithoutaconfidenceinterval!Thisestimatoris“unbiased”:n1ii)g(Xn1a)-(bE]IE[ˆn1ii)]E[g(Xn1a)-(bbadxa-b1g(x)n1a)-(bbadxg(x)ISampleMeanMethod]IVar[:σ2Iˆˆn1ii)g(Xn1a)-(bVarn1ii22)g(XVarna)-(b(indep))]Var[g(Xna)-(bn1ii22(indent))]Var[g(Xna)-(b12ba22dxa-b1E[g(X)]g(x)na)-(bba22dxa-b1a-bIg(x)na)-(bSampleMeanMethodanapproximation1nabI)g(xna)-(bsn1ii22IˆˆSampleMeanMethodn1ii)g(Xn1a)-(bIˆX1,X2,…,Xniid-g(X1),g(X2),…,g(Xn)iidLetYi=g(Xi)fori=1,2,…,nThenYa)-(bIˆandwecanonceagaininvoketheCLT.SampleMeanMethod)N(I,I2IˆˆForn“largeenough”(n30),So,aconfidenceintervalforIisroughlygivenbyI/2zIˆˆbutsincewedon’tknow,we’llhavetobecontentwiththefurtherapproximation:IˆI/2szIˆˆSampleMeanMethodba2x1/2dxex:IBytheway…NooneeversaidthatyouhavetousetheuniformdistributionExample:0b][a,2x1/2dx(x)I2ex21(X)IXE21b][a,1/2whereX~exp(rate=2).SampleMeanMethodComparisonofHit-and-MissandSampleMeanMonteCarloLetbethehit-and-missestimatorofIHMIˆ)IVar()IVar(SMHMˆˆThenLetbethesamplemeanestimatorofISMIˆSampleMeanMethodComparisonofHit-and-MissandSampleMeanMonteCarloSamplemeanMonteCarloisgenerallypreferredoverHit-and-MissMonteCarlobecause:theestimatorfromSMMChaslowervarianceSMMCdoesnotrequireanon-negativeintegrand(oradjustments)H&MMCrequiresthatyoubeabletoputg(x)ina“box”,soyouneedtofigureoutthemaxvalueofg(x)over[a,b]andyouneedtobeintegratingoverafiniteintegral.2.1VarianceReductionTechnique-Introduction第九章MonteCarlo积分Hit-or-MissMethodSampleMeanMethodVarianceReductionTechniqueVarianceReductionusingRejectionTechniqueImportanceSamplingMethodVarianceReductionTechniqueIntroductionMonteCarloMethodandSamplingDistributionMonteCarloMethod:TakevaluesfromrandomsampleFromcentrallimittheorem,3ruleMostprobableerrorImportantcharacteristicsN/22mm9973.0)33(mmXPNError6745.0NError/1ErrorVarianceReductionTechniqueIntroductionReducingerror*100samplesreducestheerrororderof10ReducingvarianceVarianceReductionTechniqueThevalueofvarianceiscloselyrelatedtohowsamplesaretakenUnbiasedsamplingBiasedsamplingMorepointsaretakeni
本文标题:Monte-Carlo与积分计算
链接地址:https://www.777doc.com/doc-5428368 .html