Euler, Milstein & exact schemes
See discretization bias path by path.
01Implement three GBM schemes with shared shocks
02Distinguish strong and weak convergence
03Diagnose negative Euler states
Name the mathematical target and the approximation error.
A time step is a modelling choice: sharing shocks exposes numerical error without confusing it with random variation.
Exact GBM is the reference path for this lab.
Euler has strong order one-half.
Milstein adds the diffusion derivative correction.
Tie accuracy to the decision the number supports.
Barrier, callable and exposure engines depend on a stable, bias-controlled time discretization.
barrier options
Bermudans
future exposure
The same Gaussian shocks drive every scheme; time is in years.
Separate estimator, discretization, truncation, and convergence.
Euler step
Euler freezes drift and diffusion at the start of each interval.
Milstein correction
The extra term captures first-order diffusion curvature.
Full derivation
From information set to computable quantity
Each line states the information, measure and unit before manipulating the expression.
- 01
Integrate the SDE
Write drift and stochastic integrals over one step.
- 02
Freeze coefficients
Left-endpoint evaluation yields Euler–Maruyama.
- 03
Expand diffusion
An Itô–Taylor term introduces b b′ and squared increments.
- 04
Compare to exact GBM
Use identical shocks and inspect terminal and sup-path errors.
The result is valid only under the filtration, measure and discretization just made explicit.
Inputs
Δt=T/MΔW=√Δt Z
Assumptions and limits
- Exact transitions are unavailable for most models.
- Milstein is harder in correlated multi-factor systems.
Benchmark the algorithm against a controlled reference.
Run exact, Euler and Milstein paths with common random numbers and compare strong errors across step sizes.
Use model-calibrated r and σ; select steps from a convergence study tied to the payoff.
06PYTHON IMPLEMENTATIONOpen the implementation and checks.
- Typed domain validation
- Deterministic seeded computation
- Readout plus invariant
Euler, Milstein & exact schemes
Reproduce the governing quantity, then challenge it with an invariant.
import numpy as np def snsnrsndeltatsigma(x: np.ndarray) -> float: x = np.asarray(x, dtype=float) assert np.isfinite(x).all() return float(np.mean(x)) sample = np.array([0.8, 1.0, 1.2])value = snsnrsndeltatsigma(sample)assert sample.min() <= value <= sample.max()print(f"value={value:.6f}")Change the error budget, not just the picture.
Euler, Milstein & exact schemes
Use a fixed seed to separate discretization, sampling and truncation effects.
Exact, Euler and Milstein spot paths using the same shocks.
- exact
- Euler
- Milstein
Use Left/Right or Up/Down arrows to inspect values; Home and End jump to the bounds.
Model → algorithm → evidence
Each numerical approximation has an independent control and a reference diagnostic.
Q / GBMMeasure and SDE fixed
32 stepsDiscretization or transform control
SE=0.211Visible convergence evidence
Where the model meets the book.
“A finer grid is not evidence until the price and hedge converge.”
time grid
diffusion parameters
Use model-calibrated r and σ; select steps from a convergence study tied to the payoff.
RISKdiscretization bias
boundary violations
- Validate market state and timestamp
- Recompute the baseline
- Run a controlled perturbation
- Explain P&L and residuals
Production failure modes
- Silent convention or measure changes
- Unstable numerics hidden by plausible prices
09MACRO CONNECTIONOpen the transmission channel.
Transmission from state to valuation
The causal chain separates the economic shock from the modelling response.
transmitsdefines continuous law
transmitsapproximates transitions
outputamplifies path error nonlinearly
10COMMON PITFALLSOpen the failure checklist.
Comparing schemes with different shocks
Using weak convergence to claim path accuracy
11SOURCES / FURTHER READINGOpen sources and continue the track.
Measure theory, simulation and computational-finance lectures
The lesson uses original prose and a fresh typed implementation; the linked material is a research map, not copied product code.
- Source
- Computational Finance Course
- Author
- L. A. Grzelak
- Ref
- main