Skip to content

Add the first tutorial: from an SDE to its order of convergence - #19

Open
rk-mlu wants to merge 2 commits into
mainfrom
m1-first-tutorial
Open

rk-mlu wants to merge 2 commits into
mainfrom
m1-first-tutorial

Conversation

@rk-mlu

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

Copy link
Copy Markdown
Contributor

First tutorial for milestone M1, the last open item of the M1 roadmap row. Format and scope as agreed: a MyST-Markdown notebook (docs/tutorials/getting_started.md) covering one pass through the core workflow.

Content

  1. Define an SDE and simulate it. An Ornstein–Uhlenbeck process defined by subclassing ItoSDE, with additive noise declared; 2000 paths with Euler–Maruyama; sample mean and variance at $t = 1$ against the closed forms.
  2. One realization for all step sizes. BrownianPath.coarsen and a plot of one path at $h = 1/8, 1/32, 1/256$, approaching each other.
  3. Convergence study against the exact solution. Euler–Maruyama for geometric Brownian motion ($\mu = \sigma = 1$): table, plot, and refit without the two coarsest step sizes.
  4. Convergence study against a reference solution. The Ornstein–Uhlenbeck process has no solution as a function of $W(t)$ alone; Euler–Maruyama on the path refined 16-fold serves as reference and shows strong order 1 for additive noise.

Results of the executed build (seeded, reproducible):

Quantity Value
OU mean / variance at $t = 1$ 0.1382 / 0.0603 (exact 0.1353 / 0.0614)
GBM, fitted order 0.524, 95 % CI [0.428, 0.608]
GBM, four finest step sizes 0.470, 95 % CI [0.396, 0.558]
OU against fine reference, fitted order 1.001, 95 % CI [0.997, 1.004]

The wide GBM interval comes from the heavy-tailed pathwise errors; the tutorial points to the coverage discussion on the theory page instead of hiding it.

Build

  • The tutorial is executed by myst-nb in every docs build (nb_execution_mode = "force", errors fail the build); the whole build takes about 8 s.
  • matplotlib>=3.8 joins the docs dependency group; uv.lock is updated, so CI and Read the Docs (uv sync --frozen --group docs) get it.
  • Decision log entry on the tutorial format; changelog entry.

Merging this independently of #17 and #18 is possible; all three touch the decision log, so the later ones need the usual rebase.


Generated by Claude Code

@rk-mlu
rk-mlu force-pushed the m1-first-tutorial branch 2 times, most recently from 68d1506 to 6ed7123 Compare November 14, 2026 20:01
One pass through the core workflow as an executed MyST-Markdown notebook:
an Ornstein-Uhlenbeck process defined by the user, simulated paths checked
against the known mean and variance, one Brownian path driving several step
sizes, a convergence study of Euler-Maruyama for geometric Brownian motion
against the exact solution (table, plot, refit), and one for the
Ornstein-Uhlenbeck process against a fine reference, which shows strong
order 1 for additive noise.

matplotlib joins the docs dependency group for the figures. The decision
log records the tutorial format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018KaTyMUfivRVAGYQR6kGnp
It depends on the whole Brownian path, so it does not fit the
exact_solution(t, W) interface, but it can be sampled exactly together
with the increments. State this instead of saying that there is no exact
solution to compare with; the tutorial still uses a fine reference.

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