ASTR 474 · Computational Astrophysics · Lecture 09

Lecture 09: Monte Carlo Transport and Random Walks

How many photon histories are required to resolve a transmission probability?

14-week course · 3 credits · Week 9

Motivation

How many photon histories are required to resolve a transmission probability?

Monte Carlo estimates expectations by sampling a probability law. Independent Bernoulli transmission trials have standard error approximately sqrt[p(1-p)/N], so precision improves only as N^-1/2.

Today’s result must be interpretable as a physical statement with declared data, algorithm, uncertainty, and a check that could fail.

Learning objectives

After this lecture, you can

Core language

Terms for This Lecture

Monte Carlo estimator

Definition: A sample-derived statistic used to approximate an expectation or probability.

Why it matters here: It helps answer How many photon histories are required to resolve a transmission probability? within the numerical model described here.

Relationships: Connect it to Random seed, the governing expression \(\hat p=\frac{k}{N},\quad SE(\hat p)=\sqrt{\frac{\hat p(1-\hat p)}{N}}\), and the computed diagnostic developed later in the lecture.

Boundary or common confusion: A fixed seed reproduces a stream only within a compatible software/bit-generator setup; NumPy does not guarantee stream compatibility across versions. Seed and package versions are both part of provenance.

Physical and mathematical model

State what is being evolved

Monte Carlo estimates expectations by sampling a probability law. Independent Bernoulli transmission trials have standard error approximately sqrt[p(1-p)/N], so precision improves only as N^-1/2.

\[\hat p=\frac{k}{N},\quad SE(\hat p)=\sqrt{\frac{\hat p(1-\hat p)}{N}}\]

Define the state, coordinates, units, initial/boundary conditions, and domain before interpreting solver output.

Numerical method

Algorithm choice is a modeling decision

Use NumPy Generator with an explicit seed; generate exponential interaction distances or Bernoulli transmission outcomes; calculate uncertainty; repeat at increasing N; report seed, estimator, and stopping criterion.

  1. Write the model and its assumptions.
  2. Choose a solver and identify its stability, accuracy, and conservation properties.
  3. Record configuration, tolerances or timestep, and output sampling.
  4. Compare against an analytic limit, independent method, or controlled refinement.

Visual reasoning

Seeded photon histories through a slab

Random-walk photon historiesSeven reproducible photon paths move through a finite slab; path termination at the far boundary represents transmission, while internal direction changes represent scattering. incident boundarytransmission surfaceEach vertex is a sampled interaction step
Seeded sample paths visualize stochastic histories; the transmission estimate and sampling error come from the separate Bernoulli experiment.

Computed example

One result, with a check

For tau=2, analytic transmission is 0.135335; the seeded N=20000 estimate is 0.137800 +/- 0.002437 (one standard error).

Inputs and method are generated by src/astr474_computations.py; the machine-readable values are in data/generated/computed_results.json.

A fixed seed reproduces a stream only within a compatible software/bit-generator setup; NumPy does not guarantee stream compatibility across versions. Seed and package versions are both part of provenance.

Verification

What would falsify this result?

Do not report a smoother curve as proof of convergence.

Failure modes

Numerical agreement has a domain

A fixed seed reproduces a stream only within a compatible software/bit-generator setup; NumPy does not guarantee stream compatibility across versions. Seed and package versions are both part of provenance.

Solver error, discretization error, stochastic error, parameter uncertainty, and model discrepancy are different quantities. Diagnose and report them separately.

Active reasoning

Make a prediction before rerunning

How many photon histories are required to resolve a transmission probability?

State a measurable outcome, a competing explanation, and the smallest computation that distinguishes them. Include an expected direction or scaling, then test it.

Workflow

From parameters to auditable output

Use NumPy Generator with an explicit seed; generate exponential interaction distances or Bernoulli transmission outcomes; calculate uncertainty; repeat at increasing N; report seed, estimator, and stopping criterion.

Record the exact command, package versions, data path, random seed if applicable, and output checksum. Keep raw inputs unchanged and generated files separate.

Transfer

Lab and problem-set connection

Lab 06 measures seeded transmission convergence and checks whether the known analytic probability lies within sampling uncertainty.

Submit plots with labeled axes/units, a concise uncertainty argument, and enough code or intermediate values for a peer to reproduce the claim.

Synthesis

Three durable checks

  1. Does the implemented equation match the intended physical model?
  2. Does the numerical result converge under a controlled method change?
  3. Does the interpretation stay inside the validity and provenance limits?

A fixed seed reproduces a stream only within a compatible software/bit-generator setup; NumPy does not guarantee stream compatibility across versions. Seed and package versions are both part of provenance.

Sources

Technical references

Data and provenance details are recorded in reference-log.md. Last updated 2026-09-27.