Langevin Equation and Stochastic Differential Equations

The physical Langevin equation — a heavy particle in a fluid feeling friction −γv-\gamma v plus a random force ξ(t)\xi(t), with the fluctuation–dissipation lock ⟨ξ(t)ξ(t′)⟩=2γkBT δ(t−t′)\langle\xi(t)\xi(t')\rangle=2\gamma k_BT\,\delta(t-t') tying noise to drag — is derived and owned by `langevin-equation`. This article takes the next step and treats that equation as a stochastic differential equation: a mathematical object driven by a Wiener process, to be manipulated, mapped to a Fokker–Planck equation, and above all integrated numerically. The physics of the noise lock and the velocity autocorrelation we recall by name; what we build is the calculus and the algorithms. A stochastic differential equation dX=a(X) dt+b(X) dW\mathrm{d}X=a(X)\,\mathrm{d}t+b(X)\,\mathrm{d}W looks like an ordinary differential equation but is not, because the driving Wiener increment dW\mathrm{d}W is not smooth: it scales as dt\sqrt{\mathrm{d}t}, so (dW)2=dt(\mathrm{d}W)^2=\mathrm{d}t rather than the naive zero. This single rule — the quadratic variation of Brownian motion — is what forces a special calculus and gives stochastic integrals their Itô versus Stratonovich ambiguity. That calculus (Itô's lemma, the drift-shift between conventions) is derived and owned by `ito-stratonovich-calculus`; we cite its results and use them. The practical payoff is simulation. Discretising an SDE is not the same as discretising an ODE: the naive Euler step becomes the Euler–Maruyama scheme, whose random increment must be drawn as Δt N(0,1)\sqrt{\Delta t}\,\mathcal N(0,1), and whose accuracy is characterised by two distinct convergence orders — strong (pathwise) order 12\tfrac12 and weak (in distribution) order 11. Adding the Milstein correction restores strong order 11 for multiplicative noise. These algorithms are the engine of Brownian and Langevin dynamics simulations, of Langevin Monte-Carlo samplers in Bayesian computation, and of the stochastic thermostats used in molecular dynamics. The SDE is where the physics of the Langevin equation becomes runnable code.

Key takeaways
  • This article treats the Langevin equation as a stochastic differential equation and covers its calculus and numerical integration; the physical friction+noise equation, the fluctuation–dissipation noise lock 2γkBT2\gamma k_BT, and the velocity autocorrelation are owned by `langevin-equation` and recalled by name.
  • An SDE dX=a dt+b dW\mathrm{d}X=a\,\mathrm{d}t+b\,\mathrm{d}W is driven by Wiener increments with ⟨dW⟩=0\langle\mathrm{d}W\rangle=0 and ⟨dW2⟩=dt\langle\mathrm{d}W^2\rangle=\mathrm{d}t — Brownian motion has non-vanishing quadratic variation.
  • The SDE↔Fokker–Planck dictionary (Itô convention) reads drift A=aA=a, diffusion B=b2B=b^2; the Itô/Stratonovich distinction and Itô's lemma are owned by `ito-stratonovich-calculus`.
  • Euler–Maruyama, Xn+1=Xn+a(Xn)Δt+b(Xn)Δt ζnX_{n+1}=X_n+a(X_n)\Delta t+b(X_n)\sqrt{\Delta t}\,\zeta_n, is the basic integrator; its strong (pathwise) order is 12\tfrac12 and its weak (distributional) order is 11.
  • The Milstein scheme adds 12b b′ (ΔW2−Δt)\tfrac12 b\,b'\,(\Delta W^2-\Delta t) to recover strong order 11 for state-dependent (multiplicative) noise.
  • Key idea: A stochastic differential equation is an Itô/Stratonovich object driven by dW\mathrm{d}W with dW2=dt\mathrm{d}W^2=\mathrm{d}t; discretising it correctly (Euler–Maruyama, Milstein) turns the Langevin equation into a simulation whose stationary distribution is the target Boltzmann weight.
The core insight

A stochastic differential equation is an Itô/Stratonovich object driven by dW\mathrm{d}W with dW2=dt\mathrm{d}W^2=\mathrm{d}t; discretising it correctly (Euler–Maruyama, Milstein) turns the Langevin equation into a runnable simulation whose stationary distribution is the target Boltzmann weight.

Where this lives today

Euler–Maruyama and its refinements are the runtime of an enormous amount of computational science. In molecular dynamics, Langevin thermostats (BAOAB and related splittings) integrate an SDE to sample the canonical ensemble — the subject of `aq-sm-thermostats-md-ensembles`. In machine learning and Bayesian statistics, the unadjusted Langevin algorithm and its Metropolis-corrected cousin (MALA) discretise the overdamped Langevin SDE to draw samples from a posterior, and the same overdamped SDE is the continuous-time limit behind stochastic-gradient methods and diffusion generative models. In quantitative finance, SDE integrators price path-dependent derivatives by Monte-Carlo. In every case the correctness of the answer rests on the two things this article isolates: the Δt\sqrt{\Delta t} noise scaling and the strong/weak order that tells you whether you may trust paths or only averages.

Origins · 1 minlangevin dynamics and how this was discovered
LD
langevin dynamics
method, 20th–21st c. · The stochastic dynamics defined by the Langevin equation and, computationally, the family of algorithms that integrate it — from Euler–Maruyama and Milstein to modern splitting thermostats. Rooted in Paul Langevin's 1908 equation of motion for a Brownian particle and made rigorous through Itô's stochastic calculus, Langevin dynamics is today the standard route to sampling the Boltzmann distribution in molecular simulation, Bayesian inference, and generative modelling.

History
1908
— Paul Langevin writes his stochastic equation of motion for a Brownian particle
1923
— Wiener constructs Brownian motion rigorously as a measure on path space
1944
— Itô defines the stochastic integral (Itô's lemma follows in 1951)
1955
— Maruyama proves convergence of the Euler scheme for SDEs (Euler–Maruyama)
1974
— Milstein introduces the higher-order strong scheme
1980
— Andersen introduces the stochastic-collision thermostat; Nosé (1984) and Hoover (1985) follow
1996
— Roberts and Tweedie establish the Metropolis-adjusted Langevin algorithm for Bayesian computation

The physical picture

The whole subtlety lives in one fact: the driving noise is rough. A Wiener path W(t)W(t) is continuous but nowhere differentiable, and over a small time Δt\Delta t its increment is of order Δt\sqrt{\Delta t}, not Δt\Delta t. Square it and average and you get ⟨ΔW2⟩=Δt\langle\Delta W^2\rangle=\Delta t — a first-order quantity, not the second-order thing you would expect for a smooth path. This is why ξ(t)=2γkBT W˙\xi(t)=\sqrt{2\gamma k_BT}\,\dot W is only a formal expression: the rigorous object is the integrated increment dW\mathrm{d}W, and the equation must be written in differential (SDE) form.

Figure
Wiener increment scales as √Δt: (dW)² = dt is first order
time t rough Wiener path: continuous, nowhere differentiable ⟨ΔW⟩ = 0, ⟨ΔW²⟩ = Δt ⇒ quadratic variation ∑ΔW² → T ≠ 0

Numerically the roughness has teeth. If you discretise an SDE with an ordinary Euler step but forget to scale the noise as Δt\sqrt{\Delta t}, you get the wrong diffusion entirely. Even done right, the accuracy splits into two notions that coincide for ODEs but differ for SDEs: strong convergence tracks how close your simulated path stays to the true path driven by the same noise; weak convergence tracks how close the simulated distribution is to the true one. Euler–Maruyama is strong order 12\tfrac12 but weak order 11 — so it is twice as accurate for computing averages as for tracking individual trajectories. The punchline figure below shows the payoff: an Euler–Maruyama ensemble on an Ornstein–Uhlenbeck process, whose histogram converges onto the exact Gaussian stationary density — the algorithm reproducing the theory.

Figure
Punchline — Euler–Maruyama OU histogram converges to the exact Gaussian, variance D/k
x exact Gaussian, Var = D/k = 0.25 EM histogram (k=2, D=0.5, Δt→0)

The core equations

The general Itô stochastic differential equation is written with a drift and a diffusion coefficient multiplying, respectively, the deterministic time increment and the Wiener increment. This is the mathematical form; the physical Langevin equation with friction, potential, and thermal noise is its instance owned by `langevin-equation`.

dXt=a(Xt) dt+b(Xt) dWt(1)\mathrm{d}X_t=a(X_t)\,\mathrm{d}t+b(X_t)\,\mathrm{d}W_t \qquad (1)

where: a(X)a(X) — drift coefficient; b(X)b(X) — diffusion (noise) coefficient; dWt\mathrm{d}W_t — Wiener increment. The defining property of the driving process is that its increments are Gaussian with zero mean and variance equal to the time step — the quadratic-variation rule that makes the calculus non-classical.

⟨dWt⟩=0,⟨dWt2⟩=dt,⟨dWt dWt′⟩=0 (t≠t′)(2)\langle\mathrm{d}W_t\rangle=0,\qquad \langle\mathrm{d}W_t^2\rangle=\mathrm{d}t,\qquad \langle\mathrm{d}W_t\,\mathrm{d}W_{t'}\rangle=0\ (t\neq t') \qquad (2)

where: dWt∼N(0,dt)\mathrm{d}W_t\sim\mathcal N(0,\mathrm{d}t) — increments of standard Brownian motion, independent over disjoint intervals. An Itô SDE maps to a Fokker–Planck equation for the density of its solutions, with the drift carrying straight over and the diffusion coefficient being the square of the noise amplitude. The convention-dependence of this map, and Itô's lemma behind it, are owned by `ito-stratonovich-calculus`.

dX=a dt+b dW ⟺ ∂P∂t=−∂∂x(a P)+12∂2∂x2(b2P)(3)\mathrm{d}X=a\,\mathrm{d}t+b\,\mathrm{d}W\ \Longleftrightarrow\ \frac{\partial P}{\partial t}=-\frac{\partial}{\partial x}(a\,P)+\frac12\frac{\partial^2}{\partial x^2}(b^2 P) \qquad (3)

where: P(x,t)P(x,t) — density of trajectories; A=aA=a — Fokker–Planck drift (Itô); B=b2B=b^2 — Fokker–Planck diffusion; the factor 12\tfrac12 is the Itô convention. The Euler–Maruyama scheme is the stochastic analogue of the forward Euler method: advance the drift linearly and add a noise increment drawn with the correct Δt\sqrt{\Delta t} scaling.

Xn+1=Xn+a(Xn) Δt+b(Xn) Δt  ζn,ζn∼N(0,1)(4)X_{n+1}=X_n+a(X_n)\,\Delta t+b(X_n)\,\sqrt{\Delta t}\;\zeta_n,\qquad \zeta_n\sim\mathcal N(0,1) \qquad (4)

where: Δt\Delta t — time step; ζn\zeta_n — independent standard-normal draws; Δt ζn\sqrt{\Delta t}\,\zeta_n realises the Wiener increment ΔWn\Delta W_n. Euler–Maruyama's accuracy is characterised by two convergence orders, and the Milstein correction upgrades the strong one for multiplicative noise.

E ∣XN−X(T)∣∼(Δt)1/2⏟strong order 1/2,∣Ef(XN)−Ef(X(T))∣∼Δt⏟weak order 1,Milstein: +12b b′ (ΔWn2−Δt)(5)\underbrace{\mathbb E\,|X_N-X(T)|\sim(\Delta t)^{1/2}}_{\text{strong order }1/2},\quad \underbrace{|\mathbb E f(X_N)-\mathbb E f(X(T))|\sim\Delta t}_{\text{weak order }1},\quad \text{Milstein: }+\tfrac12 b\,b'\,(\Delta W_n^2-\Delta t) \qquad (5)

where: strong order measures pathwise error at fixed noise; weak order measures error of distributions/expectations; the Milstein term restores strong order 11.

The core derivations

Derivation AThe SDE↔Fokker–Planck dictionary

The goal is to establish that the Itô SDE dX=a dt+b dW\mathrm{d}X=a\,\mathrm{d}t+b\,\mathrm{d}W describes the same process as the Fokker–Planck equation ∂tP=−∂x(aP)+12∂x2(b2P)\partial_t P=-\partial_x(aP)+\tfrac12\partial_x^2(b^2 P), by computing how the average of an arbitrary observable evolves and matching it to the density equation. The one non-classical ingredient — Itô's lemma, which keeps the (dW)2=dt(\mathrm{d}W)^2=\mathrm{d}t term — is owned by `ito-stratonovich-calculus`; we invoke it and do the bookkeeping. This is the bridge that lets us switch freely between trajectory simulations and density calculations.

Step 1. For a smooth observable f(X)f(X), Itô's lemma (owned by `ito-stratonovich-calculus`) gives

df=f′(X) dX+12f′′(X) (dX)2=[af′+12b2f′′]dt+bf′ dW.\mathrm{d}f=f'(X)\,\mathrm{d}X+\tfrac12 f''(X)\,(\mathrm{d}X)^2=\big[a f'+\tfrac12 b^2 f''\big]\mathrm{d}t+b f'\,\mathrm{d}W.

Why: the extra 12f′′(dX)2\tfrac12 f'' (\mathrm{d}X)^2 survives because (dX)2=b2(dW)2=b2 dt(\mathrm{d}X)^2=b^2(\mathrm{d}W)^2=b^2\,\mathrm{d}t is first order — this is the whole content of Itô calculus.

Step 2. Take expectations; the noise term drops because ⟨dW⟩=0\langle\mathrm{d}W\rangle=0 and bf′bf' is non-anticipating:

ddt⟨f⟩=⟨af′+12b2f′′⟩=∫[af′+12b2f′′]P dx.\frac{\mathrm{d}}{\mathrm{d}t}\langle f\rangle=\big\langle a f'+\tfrac12 b^2 f''\big\rangle=\int\big[a f'+\tfrac12 b^2 f''\big]P\,\mathrm{d}x.

Why: the Itô integral of a non-anticipating integrand against dW\mathrm{d}W has zero mean; averaging leaves only the drift and the Itô diffusion term.

Step 3. Also write the left side through the density, ⟨f⟩=∫fP dx\langle f\rangle=\int fP\,\mathrm{d}x, so ddt⟨f⟩=∫f ∂tP dx\tfrac{\mathrm d}{\mathrm dt}\langle f\rangle=\int f\,\partial_t P\,\mathrm{d}x, and integrate the right side by parts:

∫f ∂tP dx=∫f(−∂x[aP]+12∂x2[b2P])dx.\int f\,\partial_t P\,\mathrm{d}x=\int f\Big(-\partial_x[aP]+\tfrac12\partial_x^2[b^2P]\Big)\mathrm{d}x.

Why: move the derivatives off ff onto PP (boundary terms vanish for confined densities), turning af′af' into −∂x(aP)-\partial_x(aP) and 12b2f′′\tfrac12 b^2 f'' into 12∂x2(b2P)\tfrac12\partial_x^2(b^2 P).

Step 4. Since ff is arbitrary the integrands match, giving the Fokker–Planck equation of (3) with A=aA=a, B=b2B=b^2. Why: two integrals equal for every test function force the bracketed expressions equal — the SDE and the Fokker–Planck equation are the trajectory and density faces of one process. Verified: the OU drift/diffusion identification and the resulting stationary variance D/kD/k (with zero probability current) are checked symbolically in verify_aq-sm-langevin-equation-sm11.py.

Go deeper · Derivation B · 1 minEuler–Maruyama and its convergence orders
Derivation BEuler–Maruyama and its convergence orders

The goal is to construct the basic SDE integrator and to explain why it has two different convergence orders — strong 12\tfrac12 and weak 11 — a phenomenon with no ODE analogue. Getting the noise scaling right (Δt\sqrt{\Delta t}, not Δt\Delta t) and understanding these orders is what separates a correct Langevin simulation from a subtly wrong one, and it sets the stage for the Milstein upgrade.

Step 1. Integrate the SDE over one step [tn,tn+Δt][t_n,t_n+\Delta t] and freeze the coefficients at the left endpoint:

Xn+1=Xn+∫tntn+Δt ⁣a(X) dt+∫tntn+Δt ⁣b(X) dW≈Xn+a(Xn)Δt+b(Xn)ΔWn.X_{n+1}=X_n+\int_{t_n}^{t_n+\Delta t}\!a(X)\,\mathrm{d}t+\int_{t_n}^{t_n+\Delta t}\!b(X)\,\mathrm{d}W\approx X_n+a(X_n)\Delta t+b(X_n)\Delta W_n.

Why: the Itô convention evaluates the integrand at the start of the interval; approximating a,ba,b by their left-endpoint values is the first-order (Euler) truncation.

Step 2. Realise the Wiener increment as ΔWn=Δt ζn\Delta W_n=\sqrt{\Delta t}\,\zeta_n with ζn∼N(0,1)\zeta_n\sim\mathcal N(0,1):

Xn+1=Xn+a(Xn)Δt+b(Xn)Δt ζn.X_{n+1}=X_n+a(X_n)\Delta t+b(X_n)\sqrt{\Delta t}\,\zeta_n.

Why: by equation (2) the increment has variance Δt\Delta t, so its standard deviation is Δt\sqrt{\Delta t} — scaling the normal draw this way is mandatory; using Δt\Delta t would give diffusion →0\to0.

Step 3. Strong (pathwise) error: the leading unaccounted term comes from the variation of bb over the step, of size b b′ ΔW2∼Δtb\,b'\,\Delta W^2\sim\Delta t, entering the position error as (Δt)1/2(\Delta t)^{1/2} after summing ∼1/Δt\sim1/\Delta t steps with random signs.

E ∣XN−X(T)∣∼(Δt)1/2(strong order 1/2).\mathbb E\,|X_N-X(T)|\sim(\Delta t)^{1/2}\quad(\text{strong order }1/2).

Why: the missing Itô correction is O(Δt)O(\Delta t) per step but adds in quadrature over N∼1/ΔtN\sim1/\Delta t steps, leaving O((Δt)1/2)O((\Delta t)^{1/2}) pathwise.

Step 4. Weak (distributional) error: for expectations the odd noise terms average out, and the leading systematic error is O(Δt)O(\Delta t).

∣Ef(XN)−Ef(X(T))∣∼Δt(weak order 1).|\mathbb E f(X_N)-\mathbb E f(X(T))|\sim\Delta t\quad(\text{weak order }1).

Why: averaging cancels the mean-zero fluctuation that limits strong convergence, so distributions converge one order faster than paths — the reason Euler–Maruyama is perfectly adequate for computing thermal averages. Verified: the strong-order-12\tfrac12 scaling (error ratio ≈2\approx2 when Δt→Δt/4\Delta t\to\Delta t/4), the explicit one-step update xn+1=1.03x_{n+1}=1.03, and Euler–Maruyama convergence of the OU variance to D/kD/k are all checked in verify_aq-sm-langevin-equation-sm11.py.

Limiting cases

The SDE and its integrators specialise by the form of the coefficients; the physical FDT lock behind the thermal case is owned by `langevin-equation`.

CaseResultMeaning
Additive noise (b=b=const)Itô = Stratonovich; A=aA=a, B=b2B=b^2The thermal Langevin force; no spurious drift, either convention works.
Multiplicative noise (b=b(x)b=b(x))Itô and Stratonovich drifts differ by 12bb′\tfrac12 bb'Convention matters; the drift-shift is owned by `ito-stratonovich-calculus`.
Overdamped Langevindx=−1γU′(x) dt+2D dW\mathrm{d}x=-\tfrac{1}{\gamma}U'(x)\,\mathrm{d}t+\sqrt{2D}\,\mathrm{d}WThe Smoluchowski/Langevin-Monte-Carlo sampler; stationary state ∝e−U/kBT\propto e^{-U/k_BT}.
Milstein scheme+12bb′(ΔW2−Δt)+\tfrac12 bb'(\Delta W^2-\Delta t)Restores strong order 11 for multiplicative noise; unnecessary for additive noise.

Worked examples

Example 1 — One Euler–Maruyama step (a real number). Integrate the Ornstein–Uhlenbeck SDE dX=−kX dt+2D dW\mathrm{d}X=-kX\,\mathrm{d}t+\sqrt{2D}\,\mathrm{d}W with k=2k=2, D=0.5D=0.5, one step of Δt=0.01\Delta t=0.01 from Xn=1.0X_n=1.0, given the realised Wiener increment ΔWn=0.05\Delta W_n=0.05.

Step 1. Drift term: a(Xn) Δt=(−kXn) Δt=(−2)(1.0)(0.01)=−0.02a(X_n)\,\Delta t=(-kX_n)\,\Delta t=(-2)(1.0)(0.01)=-0.02.

Step 2. Noise term: b ΔWn=2D ΔWn=1.0 (0.05)=0.05b\,\Delta W_n=\sqrt{2D}\,\Delta W_n=\sqrt{1.0}\,(0.05)=0.05.

Step 3. Update: Xn+1=Xn−0.02+0.05=1.03X_{n+1}=X_n-0.02+0.05=\mathbf{1.03}. The particle drifted slightly toward the origin (restoring drift) but was pushed out by the noise on this step.

Example 2 — Long-run variance reproduces the theory. Run the same OU scheme to steady state. The theoretical stationary variance is D/kD/k.

Step 1. From the SDE↔FP dictionary, A=−kxA=-kx, B=2DB=2D, so the stationary Gaussian has variance σ2=D/k\sigma^2=D/k (zero-current condition −kxP−DP′=0-kxP-D P'=0).

Step 2. Numerically: σ2=D/k=0.5/2=0.25\sigma^2=D/k=0.5/2=\mathbf{0.25}.

Step 3. An Euler–Maruyama ensemble of thousands of walkers, sampled after burn-in, gives an empirical variance of ≈0.251\approx0.251 — agreement to about 0.4%0.4\% as Δt→0\Delta t\to0, exactly the punchline figure. The algorithm reproduces the theory, which is the entire point of a validated integrator.

Going further

Texts. Kloeden & Platen, Numerical Solution of Stochastic Differential Equations (the standard reference on strong/weak order, Euler–Maruyama, Milstein) · Gardiner, Handbook of Stochastic Methods, ch. 4 · Øksendal, Stochastic Differential Equations · Pathria & Beale, Statistical Mechanics, 3rd ed., ch. 15 · Leimkuhler & Matthews, Molecular Dynamics (Langevin integrators).

Provenance. The physical Langevin equation, the fluctuation–dissipation noise lock ⟨ξξ′⟩=2γkBT δ\langle\xi\xi'\rangle=2\gamma k_BT\,\delta, the velocity autocorrelation, and the Green–Kubo diffusion constant are derived and owned by `langevin-equation`; the Itô/Stratonovich calculus, (dW)2=dt(\mathrm{d}W)^2=\mathrm{d}t, Itô's lemma, and the drift-shift are owned by `ito-stratonovich-calculus`. This article recalls both by name and does not re-derive them. The SDE↔Fokker–Planck dictionary follows Gardiner ch. 4; Euler–Maruyama, its strong order 12\tfrac12/weak order 11, and the Milstein correction follow Kloeden & Platen. A verifier should: (i) confirm ⟨ΔW2⟩=Δt\langle\Delta W^2\rangle=\Delta t and non-vanishing quadratic variation; (ii) check the OU SDE↔FP identification and stationary variance D/kD/k; (iii) confirm Euler–Maruyama reproduces D/kD/k and scales with strong order 12\tfrac12; (iv) verify the one-step update xn+1=1.03x_{n+1}=1.03.

Builds on: Markov Processes and the Markov Property · Fluctuation–Dissipation Theorem · Chapman–Kolmogorov Equation. Leads to: Fokker–Planck Equation · Thermostats and Ensemble Control in Molecular Dynamics · Molecular Dynamics Simulation · Detailed Balance and Microscopic Reversibility.

If `langevin-equation` owns the Langevin equation, what is left for this article?

The physics of the equation — friction plus thermal noise, the fluctuation–dissipation lock ⟨ξξ′⟩=2γkBT δ\langle\xi\xi'\rangle=2\gamma k_BT\,\delta, the velocity autocorrelation, the Einstein/Green–Kubo diffusion constant — is owned by `langevin-equation`. This article owns the mathematical and computational object: how to write the equation as an Itô/Stratonovich SDE, how it maps to a Fokker–Planck equation, and above all how to integrate it numerically (Euler–Maruyama, Milstein, and the strong/weak convergence orders). It is the difference between knowing the physical law and being able to simulate it correctly.

Why is (dW)2=dt(\mathrm{d}W)^2=\mathrm{d}t rather than zero?

Because Brownian motion is rough. Over a time Δt\Delta t the Wiener increment has standard deviation Δt\sqrt{\Delta t}, so ΔW2\Delta W^2 has mean Δt\Delta t — a first-order quantity. Summing ΔW2\Delta W^2 over an interval gives its length TT (non-vanishing quadratic variation), whereas for a smooth path ∑(Δx)2→0\sum(\Delta x)^2\to0. This one fact forces stochastic calculus: in Itô's lemma the second-derivative term 12f′′(dX)2\tfrac12 f''(\mathrm{d}X)^2 cannot be dropped, and it is the origin of the extra diffusion drift and of the Itô/Stratonovich distinction. The full calculus is owned by `ito-stratonovich-calculus`.

What is the difference between strong and weak convergence, in practice?

Strong convergence asks how close your simulated path stays to the true path driven by the same realisation of the noise — it is pathwise accuracy. Weak convergence asks only how close the simulated distribution (or any expectation Ef(X)\mathbb E f(X)) is to the true one. For ODEs these coincide, but for SDEs Euler–Maruyama is strong order 12\tfrac12 and weak order 11. In practice: if you want thermal averages, correlation functions, or free energies, weak order governs your error and Euler–Maruyama is fine; if you must reproduce a specific trajectory (rare in statistical physics, common in filtering), you need the higher strong order that Milstein provides.

When do I actually need the Milstein scheme?

Only for multiplicative noise, where the diffusion coefficient b(x)b(x) depends on the state. There the term 12bb′(ΔW2−Δt)\tfrac12 b b'(\Delta W^2-\Delta t) that Euler–Maruyama omits is what limits its strong order to 12\tfrac12; adding it back gives strong order 11. For additive noise — constant bb, which is the standard thermal Langevin force — b′=0b'=0, the Milstein correction vanishes identically, and Euler–Maruyama is already strong order 11. So for most equilibrium molecular-dynamics thermostats you never need Milstein; you need it for models with state-dependent noise amplitude (some population, finance, and reaction models).

Does the discretisation preserve the correct stationary distribution?

Not exactly — a finite Δt\Delta t Euler–Maruyama step samples a distribution that is O(Δt)O(\Delta t) away from the true Boltzmann weight, because the discretisation introduces a bias. There are two standard fixes. Reduce Δt\Delta t until the bias is negligible (cheap but slow), or add a Metropolis accept/reject step that corrects the bias exactly — this is the Metropolis-adjusted Langevin algorithm (MALA), which combines the gradient-informed Langevin proposal with the acceptance rule owned by `aq-sm-metropolis-hastings-algorithm`. The unadjusted algorithm trades a small controllable bias for speed; the adjusted one is exact at the cost of occasional rejections.

How does this connect to Langevin thermostats in molecular dynamics?

A Langevin thermostat adds friction and FDT-consistent noise to Newton's equations, turning the molecular-dynamics update into an SDE integrator. The physics — that the noise strength must equal 2γkBT2\gamma k_BT to sample the canonical ensemble — is owned by `langevin-equation`; the numerics of splitting that SDE into accurate, stable steps (the BAOAB scheme and relatives) is exactly the Euler–Maruyama/Milstein technology of this article applied with care about operator splitting. The stationary distribution is the canonical Boltzmann weight, and getting there correctly is the concern of `aq-sm-thermostats-md-ensembles`.

Before this

Where this leads