liveBook · Manning

Monte Carlo simulation

Also called Monte Carlo method, Monte Carlo Estimation, monte carlo sampling

Monte Carlo simulation is a computational technique that uses repeated random sampling to estimate quantities or characterize possible outcomes.

How 11 Manning books explain it

Statistics Every Programmer Needs

A Monte Carlo simulation estimates quantities or evaluates outcomes by repeatedly sampling from specified probability distributions or stochastic processes.

How it is used
Models uncertain outcomes to inform staffing and investment-risk decisions.
How deep it goes
Develops a six-step discrete workflow and a historical-return-based continuous workflow, including sampling and interpretation.
Examples
Uses Poisson-modeled call-center absenteeism and historical stock prices as discrete and continuous examples.
What you can do after
Build it from scratch in Python, then compare simulated frequencies and decision tradeoffs.

Read how Statistics Every Programmer Needs explains Monte Carlo simulation →

Applied Reinforcement Learning

Monte Carlo estimation approximates a quantity by averaging values obtained from random samples.

How it is used
Estimates uncertain business performance and policy gradients from randomized scenarios or sampled trajectories.
How deep it goes
Works through a sample-based policy gradient, return-to-go, and variance; contrasts complete-episode learning with incremental updates.
Examples
Uses coffee shop staffing scenarios and a seasonal promotion campaign to illustrate simulation and complete-episode learning.
What you can do after
Evaluate uncertain decisions and understand how sampled trajectories estimate a policy gradient.

Read how Applied Reinforcement Learning explains Monte Carlo simulation →

Build a Robo-Advisor with Python (From Scratch)

A Monte Carlo simulation is a computational technique that estimates outcomes by repeatedly sampling from specified probability distributions or scenarios.

How it is used
Estimates retirement funding risk and tax-strategy savings under individual financial circumstances.
How deep it goes
Builds an annual wealth-path implementation, then extends modeling to inflation, fat tails, bootstrapping, and mortality.
Examples
Uses a $100,000 return-order comparison and a $1.2 million, 30-year retirement simulation.
What you can do after
Apply it via Python and NumPy to generate wealth paths and estimate retirement bankruptcy probabilities.

Read how Build a Robo-Advisor with Python (From Scratch) explains Monte Carlo simulation →

Investing for Programmers

A Monte Carlo simulation is a computational technique that uses repeated random sampling to estimate outcomes or explore possible solutions.

How it is used
Measures Value at Risk and explores portfolio outcomes under uncertain future returns.
How deep it goes
Explains sampling inputs, simulated outcomes, percentiles, and portfolio selection, but stops short of modeling Black Swan events.
Examples
Uses Apple price simulations, 95% VaR, 10,000 random portfolios, efficient-frontier plots, and portfolio weights.
What you can do after
Build it from scratch to estimate stock VaR or compare randomly generated portfolios using historical returns.

Read how Investing for Programmers explains Monte Carlo simulation →

Grokking Bayes

A Monte Carlo approximation estimates a quantity using randomly drawn samples.

How it is used
Approximates Bayesian posteriors and downstream quantities when analytical derivation is unavailable.
How deep it goes
Explains sample averages, quantiles, MCMC construction, and diagnostics, while deferring exact posterior computation.
Examples
Uses a tea-versus-coffee posterior, posterior histograms, and a website-design launch decision based on sampled utilities.
What you can do after
Apply Monte Carlo sampling to estimate posterior summaries and expected utilities, then evaluate MCMC results with standard diagnostics.

Read how Grokking Bayes explains Monte Carlo simulation →

Causal AI

A Monte Carlo method is a randomized computational technique that estimates quantities by repeatedly sampling from a probability distribution.

How it is used
Estimates expectations, probabilities, and conditional quantities from probabilistic generative models.
How deep it goes
Defines sampling and averaging, demonstrates Python implementations, and stops short of detailed inference algorithms.
Examples
Uses indicator averages, squared samples, pgmpy data frames, and Pyro Gamma–Poisson–Bernoulli processes.
What you can do after
Apply it via Pyro or pgmpy to estimate expectations and probabilities from generated samples.

Read how Causal AI explains Monte Carlo simulation →

Machine Learning Algorithms in Depth

Monte Carlo sampling is a stochastic technique that uses random samples or simulated paths to estimate properties of uncertain quantities.

How it is used
Estimates uncertainty in simulated stock prices, random walks, and broader sampling-based inference procedures.
How deep it goes
Derives transition sampling and outcome computation, implements two simulations, and briefly situates scalable Monte Carlo variants without developing them.
Examples
Uses binomial stock-price paths and weighted self-avoiding walks on a two-dimensional grid.
What you can do after
Builds simulations from scratch, computes terminal outcomes, and evaluates uncertainty through repeated trials and plots.

Read how Machine Learning Algorithms in Depth explains Monte Carlo simulation →

Build AI Drug Discovery Pipelines

A Monte Carlo method uses random sampling to approximate quantities or explore states in a system with many possible configurations.

How it is used
Uses stochastic conformational exploration to address protein-folding landscapes that defeat conventional optimization.
How deep it goes
Explains random moves, higher-energy acceptance, energy barriers, and local minima, but does not develop implementation details or equations.
Examples
Uses protein conformations, rugged energy landscapes, and the transition from unfolded states toward native structures.
What you can do after
Evaluate/understand why random sampling helps explore protein conformations beyond local energy minima.

Read how Build AI Drug Discovery Pipelines explains Monte Carlo simulation →

Reinforcement Learning from Human Feedback

Monte Carlo estimation approximates an expectation or other quantity by averaging values from samples drawn from the relevant distribution.

How it is used
Approximates policy gradients, value targets, group advantages, and KL penalties from sampled language-model rollouts.
How deep it goes
Details sampling pipelines and backward return computation, but does not develop general convergence or variance analysis.
Examples
Uses sampled completions, token log-probabilities, on-policy returns, critic targets, and multiple responses to one prompt.
What you can do after
Apply it via sampled rollouts to estimate KL terms, policy gradients, value targets, or relative advantages in RL training.

Read how Reinforcement Learning from Human Feedback explains Monte Carlo simulation →

Grokking Statistics

A Monte Carlo simulation is a computational simulation method that models uncertain real-world processes by repeatedly generating random outcomes from probability distributions.

How it is used
Models uncertain real-world processes when direct data collection is difficult.
How deep it goes
Explains distribution choice and demonstrates two implementations, but defers more ambitious multi-component models.
Examples
Uses a coffee-shop barista, espresso-shot counts, and delivery timelines as its central example.
What you can do after
Build it from scratch with NumPy random generators to estimate totals and event timelines.

Read how Grokking Statistics explains Monte Carlo simulation →

Advanced Algorithms and Data Structures

A Monte Carlo algorithm is a randomized algorithm that permits a bounded probability of an incorrect result in exchange for controlled resource usage.

How it is used
Frames randomization as a way to control resources while accepting uncertainty, then applies it to k-means initialization.
How deep it goes
Defines the randomized distinction and works through k-means initialization, iteration, failure mode, and restart strategy.
Examples
Uses Bloom-filter false positives and k-means centroid initialization, clustering iterations, unlucky starts, and random restarts.
What you can do after
Apply it via random initialization and repeated restarts when deterministic processing depends strongly on the starting state.

Read how Advanced Algorithms and Data Structures explains Monte Carlo simulation →

Also covered in

What to know first

Related concepts

Questions about Monte Carlo simulation

What is Monte Carlo simulation?

Monte Carlo simulation is a computational technique that uses repeated random sampling to estimate quantities or characterize possible outcomes.

Which Manning books explain Monte Carlo simulation?

Statistics Every Programmer Needs, Applied Reinforcement Learning, Build a Robo-Advisor with Python (From Scratch), Investing for Programmers, Grokking Bayes, Causal AI, Machine Learning Algorithms in Depth, Build AI Drug Discovery Pipelines and 3 more.

What should I know before learning Monte Carlo simulation?

Manning books that teach Monte Carlo simulation usually introduce probability distribution, random variable, mean and standard deviation first.

What is the difference between Monte Carlo simulation and determinism?

Monte Carlo simulation is a computational technique that uses repeated random sampling to estimate quantities or characterize possible outcomes. Determinism is the property that the same relevant inputs, state, and conditions uniquely determine the same outcome or behavior.

What kinds of Monte Carlo simulation are there?

Kinds of Monte Carlo simulation include genetic algorithm.

What is Monte Carlo simulation also called?

Monte Carlo simulation is also called Monte Carlo method, Monte Carlo Estimation or monte carlo sampling.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.