310 likes | 319 Views
Explore Monte Carlo simulation methods, variations, and applications. Discover how randomness can study a range of outcomes in physics and processes through stochastic or deterministic models. Learn about statistical analysis and error assessment in simulation results.
E N D
SpecialTopics 3.58 MonteCarlosimulation MonteCarlomethod
SpecialTopics 3.59 • Introduction • Concept • Inspiredbyideasunderlyinggambling • Randomness,eitherin inputsormodel,… • …exploitedtoexplorerangeofpossibleoutcomes • Twosimilarbutdifferent variations • Stochastic inputs,deterministicmodel,explicittime • Deterministicinputs,stochastic model,implicittime
SpecialTopics 3.60 MonteCarlosimulation Stochastically varyingresults Stochastically varying initial conditions MCv1 Deterministic simulation Probabilitydistributions usedto modelvariability ininitialconditions Multiplerunswith run-to-runvariabilityinresults; analyzedstatistically Oftentime-stepped physics-basedmodel; timerepresentedexplicitly Stochastically varyingresults MCv2 Fixed initial conditions Stochastic simulation Specificknownor given initialconditions Multiplerunswith run-to-runvariabilityinresults; analyzedstatistically Probabilitydistributions usedto modelvariability insimulandprocesses; oftennoexplicit representationoftime v1 v2
SpecialTopics 3.61 • Definition • MonteCarlosimulation(v1) • Stochasticallyvaryinginitialconditionsinputtodeterministicphysicsorprocessmodel. • Modeling • Physicsofsimulandmodeledusingphysics • Time modeledexplicitly,as time-steppedcontinuous • Simulation • Randomlygeneratedinitialconditions… • …usedtostudyrangeof possibleresults • Usuallymultipletrialsandstatistical analysis
SpecialTopics 3.62 • Definition • MonteCarlosimulation(v2) • Fixedinitialconditionsinput • tostochasticphysicsorprocessmodel. • Modeling • Physicsofsimulandmodeledusingprobability • Time modeledimplicitly,noexplicittime advance • Simulation • Randomlygeneratedphysicsoutcomes… • …usedtostudyrangeof possibleresults • Usuallymultipletrialsandstatistical analysis
SpecialTopics 3.63 MonteCarlov1method(alternative) • DefiningaMonteCarlomodel • Identifya set ofrandomvariablesthatspecify theinitialcondition. • Selectprobabilitydistributionandparametersfor each. • Developdeterministicmodeltocalculateresults froma set of inputs. • ExecutingaMonteCarlosimulation • Repeatfor each ofntrials: • Randomlygeneraterandomvariate foreachinput. • Calculatetrial outcome with deterministicmodel. • Recordtrial outcome. • Statisticallyanalyzetheresults.
SpecialTopics 3.64 • MonteCarlov2method(alternative) • DefiningaMonteCarlomodel • Identifya set ofinputvariablesthatspecify theinitialcondition. • Selectspecificvaluesforeach. • Developstochasticmodelbasedon probability distributionstocalculateresultsfromaset of inputs. • ExecutingaMonteCarlosimulation • Repeatfor each ofntrials: • Initializemodelwithselectedinputvalues. • Calculatetrial outcome with stochastic model. • Recordtrial outcome. • Statisticallyanalyzetheresults.
SpecialTopics 3.65 MonteCarlosimulation Examples
SpecialTopics 3.66 Example1(MCv1):Calculatingπ Overlayaunitcirclearcoverasquarearea. Choosearandomxandy,andplaceadotthere.Repeatthisstepseveraltimes. Calculateπbaseduponthisresult(seenext slide) 1 1 0
SpecialTopics 3.67 • Assessingsimulationoutput • Wanttoapproximate“real”valueofπ 1 2 r 4 #dotsinsidecircle #dotsinsideentiresquare rr 4 Example:π/4≈340/500 1 • Simulatedπ ≈2.72 • Error of12.1% ? • Canrerunwithmoresamplestogeneratemoreaccurateoutput 1 0
SpecialTopics 3.68 Experimentalresultsfromimplementation Demo
SpecialTopics 3.69 Example2(MCv1):Productearnings • Wanttopredictproductearninginfutureyears • Historicaldataforlast fiveyearsavailable • Candevelopaprobabilitydistribution • Choosetriangulardistributionwhengivensmall amountsof data • Needminimum,maximum,andmode (mostlikely) • Usethefollowingrelation: • earnings=unit pricexunitsales–(variablecosts +fixedcosts)?
SpecialTopics 3.70 Determiningminimum,likely,andmaximum Historicaldataperyearand“transformed”data: •Minimums •Averages •Best guesses
SpecialTopics 3.71 Formingtriangulardistribution 0.1 Probability 2(xa) axc (ba)(ca) 2(bx) f(x) (ba)(bc) cxb otherwise 0 0 50 (a) 55 (c) 60 Unitprice 70 (b)
SpecialTopics 3.72 MATLABcode h= sqrt(rand(1,10000)); unit_price= (70-50)*h.*rand(1,10000)+55-(55-50)*h variable_costs= (65000- 5000)*h.*rand(1,10000)+55200-(55200-50000)*h; fixed_costs= (20000-10000)*h.*rand(1,10000)+14000- (14000-10000)*h; unit_sales= (3000-2000)*h.*rand(1,10000)+2440- (2440-2000)*h; for i=1:10000 earnings(i)= unit_price(i)*unit_sales(i)- (variable_costs(i)+fixed_costs(i)) end
SpecialTopics 3.73 Earningssummarystatistics 400 300 Frequency 200 100 0 2 4 6 8 10 12 14 16 x104 Compare Earnings
SpecialTopics 3.74 • Example3(MCv1):Missileimpacts[Zhang,2008] • Application • Deterministic6DOFmodelofmissiletrajectory • Usedtocalculateimpact pointgiveninitialconditions • Measure xandyerrorw.r.t.aimingpoint • Comparemodelandlivetestxand yerrorvariances • Two ranges: 60Km and 100Km • 6livetests,800MonteCarlomodeltrials eachrange • MonteCarloanalysis • For eachtrial, generatetrajectoryinitial conditionsfrom probabilitydistributions • Calculateimpact point • Repeatfor800trials • Comparevariances
SpecialTopics 3.75 • Missiletrajectorymodel • Physicsbased • Organizedintomodules:velocity,rotation, atmosphericconditions, aerodynamics,thrust • ImplementedinMATLABSimulink mdVPcoscosXmgsin dt mVp(sincosvcossinsinv)YcosvZsinvmgcos dt Velocitymodule equations d • mVcosdvP(sinsincossinsin)YsinZcos v v v v dt Velocitymodule blockdiagram
SpecialTopics 3.76 Impactdata 60Km 100Km
SpecialTopics 3.77 MonteCarlosimulation Casestudy: Bombingaccuracy analysis(MCv2)
SpecialTopics 3.78 • Bombingaccuracyanalysis • Bomberattackonammunitiondepot • Conventional(unguided)bombs • Impactsrandomlydispersedw.r.t aimingpoint, inbothx(range)andy(azimuth)directions • Impactwithinammunitiondumpperimeterishit
SpecialTopics 3.79 Ammunitiondump,1996[Banks, 1996] 1 (-504,198) y 2 (552, 18) 950m –x x Aimingpoint (0, 0) –y 1250m
SpecialTopics 3.80 Ammunitiondump,2010[Banks, 2010]
SpecialTopics 3.81 • Hitsandmisses • Configuration • Bomb aimingpointis coordinateorigin(0, 0) • Bombersapproachfromwest(left) • Each bombercarries 10 bombs • Stochasticbombimpactmodel • Each impactassumedindependentof others • Normallydistributedaroundaimingpoint • Aimingpoint(0,0)is xmean,ymean x= 0,y= 0 • xstandard deviationx=400 • ystandard deviationy=200
SpecialTopics 3.82 • Normallydistributedrandomvariates • Randomvariate (rv) • Specific numberfromagivendistribution • Randomlygenerated • Normalrandomvariates • Normaldistribution:meanμandstddevσ • Standardnormaldistribution:mean0andstddev1 • NormalrvXfromstandardnormalrvZ:X=μ+Zσ • Spreadsheet:=E4+E5*NORMSINV(RAND()) Givenbombimpact coordinatesXandY normallydistributedperμx,σx andμy,σy, equationsforstdnormalr.v.Zx andZyare Given standardnormalr.v.Zx andZy, solveequations forXandY togetbombimpact coordinates Xy Z Xx X 400Z Y200Z Z x y x y xy μx = 0, σx =400 μy = 0, σy =200
SpecialTopics 3.83 • Procedureforeachtrial • Generate standard normalrandomvariatesZx,Zy • CalculateimpactcoordinatesX,YfromZx,Zyusingmodel • Determineif impactpoint(X,Y)is withinammo dump
SpecialTopics 3.84 Simulatedbombingruns[Banks, 2010]
SpecialTopics 3.85 Experimentresults[Banks, 2010] Sample400trialexperimentresults. Each trial10bombs. Frequencyofnumberofbombhitsinatrial.
SpecialTopics 3.86 MonteCarlosimulation Computingconfidenceintervals [Brase,2009][Petty,2012][Petty,2013]
SpecialTopics 3.87 Exampleconfidenceinterval ... • 12.06 12.03 12.05 12.02 12.10 • Sampleofcerealboxesfilledbymachine 12.04 • Samplesize=100boxes • Mean weightofsample=12.05ounces • Standarddeviationof weightofsample= 0.1ounces • Confidenceintervalformeanweight • ▪ Interval[12.0304,12.0696] • Confidencelevel0.95(95%)