Skip to content

Add Brownian motion on the circle as third M1 test problem - #17

Open
rk-mlu wants to merge 1 commit into
mainfrom
m1-brownian-motion-circle
Open

rk-mlu wants to merge 1 commit into
mainfrom
m1-brownian-motion-circle

Conversation

@rk-mlu

@rk-mlu rk-mlu commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Third test problem of milestone M1 (roadmap: "Brownian motion on the circle as third test problem"). Independent of #16; based on main.

Problem

$$ \mathrm{d}X(t) = -\tfrac12 \sigma^2 X(t),\mathrm{d}t + \sigma J X(t),\mathrm{d}W(t), \qquad J = \begin{pmatrix} 0 & -1 \ 1 & 0 \end{pmatrix}, $$

with $d = 2$, $m = 1$ (scalar, multiplicative noise). The exact solution is $X(t) = R(\sigma(W(t) - W(t_0))),x_0$, a rotation of $x_0$, so $|X(t)| = |x_0|$. Defaults: $\sigma = 1$, $x_0 = (1, 0)$, $t_0 = 0$. Registry name brownian_motion_on_circle.

Euler–Maruyama leaves the circle: on every path $|X_h^{n+1}|^2 = |X_h^n|^2\big((1 - \sigma^2 h_n/2)^2 + \sigma^2 \Delta W_n^2\big)$, and on a uniform grid $\mathbb{E}|X_h^N|^2 = |x_0|^2 (1 + \sigma^4 h^2/4)^N$. Both identities were checked numerically before they went onto the theory page, and both are tested.

There is no legacy script for this problem in the archive; the scripts unitcirc*.py sample the uniform distribution on the circle.

Tests

Kind What
Unit coefficients and rotation by hand; equality with the commuting matrix formula $\exp((A - B^2/2)t + BW),x_0$ (truncated series); broadcasting; float32 initial value; parameter validation
Property the per-step radius identity of Euler–Maruyama for random grids, $\sigma$ and starting angles
PyTorch solution and exact solution equal NumPy
Statistical (slow) strong order 1/2 (with GBM and the linear system); $\mathbb{E}|X_h^N|^2$ against the closed form within five standard errors, with the drift resolved by more than ten

Coverage 100 % with and without PyTorch and matplotlib; Ruff, mypy, codespell and Sphinx -W pass.

Please check

  • A literature reference for the problem (the theory page says that one is still to be added).

Generated by Claude Code

BrownianMotionOnCircle solves dX = -sigma^2/2 X dt + sigma J X dW in the
plane with scalar noise. Its exact solution rotates x0 by the angle
sigma (W(t) - W(t0)), so the radius is invariant; Euler-Maruyama leaves the
circle, with |X^{n+1}|^2 = |X^n|^2 ((1 - sigma^2 h/2)^2 + sigma^2 dW^2) on
every path and E|X_h^N|^2 = |x0|^2 (1 + sigma^4 h^2/4)^N.

Tests: coefficients and rotation by hand, the commuting matrix formula,
the per-step radius identity (property test), PyTorch against NumPy, the
strong order 1/2 and the exact second moment (slow). Theory page,
registry entry, API reference, changelog and decision log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018KaTyMUfivRVAGYQR6kGnp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants