hey my name is Christophe and today I'd
like to talk about Monte Carlo
simulation what here in Monte Carlo
triggers my brain to think about French
Riviera
or the Monaco Formula One Grand Prix and
by the way Google heads are supporting
that but let's move away from photos
showing casino by the way casinos are
actually why Monte Carlo simulations are
named this way but more on that later
what we are going to talk about is
admittedly gambling but let's call it
systematic gambling to answer real-world
questions so why and where are Monte
Carlo simulations used well Monte Carlo
simulations help to answer probability
questions they are used for example in
finance for economic forecasting risk
management and stress testing also an
automotive for sensitivity analysis to
make customer products more robust or
also tackling our daily life Monte Carlo
simulation is used in weather
forecasting so now we need to answer the
question what are Monte Carlo
simulations wikipedia says it's repeated
random sampling to obtain numerical
results networks is even a bit more
specific saying the process of
generating independent random draws from
a specified probabilistic model let me
try to describe it using my very own
words you start with a simulation model
you run that model many times with
randomly changing parameters and then
you analyze the results systematically
and to understand what that means let's
do an example together blackjack seems
to be an appropriate one for us today
the game is also known as 21 the goal is
to get a hand with a value close to but
not more than 21 we play against the
dealer and each of us starts with two
cards we see here a MATLAB app basically
a visualization on top of a MATLAB
script that includes the concept of
blackjack our cards are dealt face up
one of the dealer's card stays facedown
remember rule one said start with a
simulation model and that's pretty much
what we have here
but what strategy should we follow one
approach is called basic strategy and I
will link the related publications in
the video description basic strategy for
example recommends to always stand on 17
always split aces never split ten so
let's open the QPD our next to our cards
to get the full picture of basic
strategy I get 18 here which is more
than 17 so I certainly should stand Oh
nonetheless I lose because the dealer
get 20 let's try to play again again 18
basic strategy recommends and
stand and now instead of playing
manually again and again let's follow a
more systematic Monte Carlo like
approach rule 2 says run that simulation
many times let's exactly do that see
here a script that will play blackjack
many times for us due to the increased
number of computations required we
employ a parallel execution a feature
that MATLAB provides that will
distribute the compute tasks to all the
cores on my laptop but this approach
could also be scaled to match you to
compute environments such as clusters or
cloud solutions so what we are seeing
here is the total dollar return after 15
players have been playing 2500 hands
each overall we have a huge amount of
data and that we can analyze and even
analyze smart decision making during
blackjack so you may see may ask
yourself where does basic strategy come
from well basic strategy has been
derived analyzing thousands of simulated
games exactly like the one here which
essentially is a Monte Carlo approach so
all files I've used here today are
authored by Cleve Moler
one of the cofounders of networks and
today chief mathematician at the Met
works you will also find a very nice
article explaining basic strategy and
the metric of implementation of
blackjack all right so let's conclude
for our specific example we've learned
that following the basic strategy lets
us eventually live in a few times over
the casino and fortunately in the long
run the casino still has an advantage
run for about 1/2 of 1% if you found
that example interesting allow me to
refer you to a method webpage that
provides a whole lot of context and
examples about Monte Carlo simulation as
well as many matchup and Simulink models
to download and run if you like the
casual blackjack example let's end here
with another one from basketball on
YouTube LeBron James brings up an
interesting questions so you're down
three points with 30 seconds left in the
match is it better to take a more
difficult shirt for three points or an
easy one for two an attempt to get
another possession so Khan Academy
provides you with an interactive
simulation tool to run through the
decision-making in the browser thanks
for watching and stay tuned on mathworks
video