TQBTHEQUANTBATEMAN
TQB/ learn/ numerical finance/ euler milstein exact schemesEN · DARK
Numerical finance · advanced

Euler, Milstein & exact schemes

See discretization bias path by path.

BY THE END, YOU CAN

01Implement three GBM schemes with shared shocks

02Distinguish strong and weak convergence

03Diagnose negative Euler states

01
INTUITION

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.

01

Exact GBM is the reference path for this lab.

02

Euler has strong order one-half.

03

Milstein adds the diffusion derivative correction.

02
WHY MARKETS CARE

Tie accuracy to the decision the number supports.

Barrier, callable and exposure engines depend on a stable, bias-controlled time discretization.

INSTRUMENTS

barrier options

Bermudans

future exposure

QUOTE CONVENTION

The same Gaussian shocks drive every scheme; time is in years.

03
MATHEMATICS

Separate estimator, discretization, truncation, and convergence.

Formula · Full derivation

Euler step

Sn+1=Sn+rSnΔt+σSnΔWnS_{n+1}=S_n+rS_n\Delta t+\sigma S_n\Delta W_n

Euler freezes drift and diffusion at the start of each interval.

Formula · Full derivation

Milstein correction

Sn+1M=Sn+1E+12σ2Sn((ΔWn)2−Δt)S_{n+1}^{M}=S_{n+1}^{E}+\tfrac12\sigma^2S_n((\Delta W_n)^2-\Delta t)

The extra term captures first-order diffusion curvature.

Full derivation
Full derivation

From information set to computable quantity

Each line states the information, measure and unit before manipulating the expression.

  1. 01

    Integrate the SDE

    Write drift and stochastic integrals over one step.

  2. 02

    Freeze coefficients

    Left-endpoint evaluation yields Euler–Maruyama.

    a(Ss)≈a(Sn),  b(Ss)≈b(Sn)a(S_s)\approx a(S_n),\;b(S_s)\approx b(S_n)
  3. 03

    Expand diffusion

    An Itô–Taylor term introduces b b′ and squared increments.

    12bb′((ΔW)2−Δt)\tfrac12bb'((\Delta W)^2-\Delta t)
  4. 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.
05
MODEL / PRICING

Benchmark the algorithm against a controlled reference.

METHOD

Run exact, Euler and Milstein paths with common random numbers and compare strong errors across step sizes.

CALIBRATION

Use model-calibrated r and σ; select steps from a convergence study tied to the payoff.

06PYTHON IMPLEMENTATIONOpen the implementation and checks.
ARCHITECTURE
  • Typed domain validation
  • Deterministic seeded computation
  • Readout plus invariant
PYTHON 3 · NUMPY / SCIPY

Euler, Milstein & exact schemes

Reproduce the governing quantity, then challenge it with an invariant.

REUSABLE EXAMPLE
01import numpy as np
02
03def snsnrsndeltatsigma(x: np.ndarray) -> float:
04 x = np.asarray(x, dtype=float)
05 assert np.isfinite(x).all()
06 return float(np.mean(x))
07
08sample = np.array([0.8, 1.0, 1.2])
09value = snsnrsndeltatsigma(sample)
10assert sample.min() <= value <= sample.max()
11print(f"value={value:.6f}")
EXPECTED OUTPUTvalue=1.000000
SANITY CHECKS

✓ Finite inputs are enforced

✓ The result respects its numerical bounds

✓ Units and measure remain explicit

07
INTERACTIVE LAB

Change the error budget, not just the picture.

NUMERICAL ERROR LAB

Euler, Milstein & exact schemes

Use a fixed seed to separate discretization, sampling and truncation effects.

SYNTHETIC · EDUCATIONAL
Euler terminal error0.2987M=32
Milstein terminal error0.0083same shocks
Monte Carlo SE0.2108N=4,096
spot level by time (years)

Exact, Euler and Milstein spot paths using the same shocks.

  • exact
  • Euler
  • Milstein
time (years): 0.0Y. exact: 100.00. Euler: 100.00. Milstein: 100.00.

Use Left/Right or Up/Down arrows to inspect values; Home and End jump to the bounds.

ERROR BUDGET

Model → algorithm → evidence

Each numerical approximation has an independent control and a reference diagnostic.

01Target lawQ / GBM

Measure and SDE fixed

02Algorithm32 steps

Discretization or transform control

03DiagnosticSE=0.211

Visible convergence evidence

MODEL BOUNDARY

GBM and Gaussian transform examples are analytical references, not production calibration engines.

08
FRONT OFFICE

Where the model meets the book.

ON THE DESK
“A finer grid is not evidence until the price and hedge converge.”
VISIBLE INPUTS

time grid

diffusion parameters

CALIBRATION

Use model-calibrated r and σ; select steps from a convergence study tied to the payoff.

RISK

discretization bias

boundary violations

DAILY WORKFLOW
  1. Validate market state and timestamp
  2. Recompute the baseline
  3. Run a controlled perturbation
  4. Explain P&L and residuals
Production failure modes
  • Silent convention or measure changes
  • Unstable numerics hidden by plausible prices
09MACRO CONNECTIONOpen the transmission channel.
MACRO CONNECTION

Transmission from state to valuation

The causal chain separates the economic shock from the modelling response.

01SDEtransmits

defines continuous law

02Schemetransmits

approximates transitions

03Payoffoutput

amplifies path error nonlinearly

10COMMON PITFALLSOpen the failure checklist.
01

Comparing schemes with different shocks

02

Using weak convergence to claim path accuracy

11SOURCES / FURTHER READINGOpen sources and continue the track.
research

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
OPEN ORIGINAL SOURCE ↗