docs(v2.0.0-alpha.5): rich math+physics background per chapter, fix notebook download links
Each of the eight v2.0 algorithm pages (bsde, pde, stochastic_control, quadratic_impact_control, mckean_vlasov, agent_based, robust_drift, generative_calibration_hooks) gains: - A dedicated 'Mathematical background' section with the central theorem (Pardoux-Peng, Sznitman propagation of chaos, Pontryagin-Bismut, Huber-IRLS, Gretton MMD, Kolmogorov forward, etc.), key derivations and the analytic closed-form solution that the unit tests target. - An 'Applications' / 'Why it matters' paragraph listing concrete research and engineering use-cases so newcomers grasp the value of each primitive. - A repaired companion-notebook block: the broken relative path '../../examples/notebooks/...ipynb' (which 404s on RTD) is replaced by an explicit GitHub blob (view) + raw (download) URL pair. Sphinx now builds the full doc set with zero new warnings.
This commit is contained in:
@@ -1,9 +1,83 @@
|
||||
PDE — Fokker–Planck, HJB, elliptic Poisson
|
||||
==========================================
|
||||
|
||||
Three CPU-only finite-difference solvers: 1-D forward Fokker–Planck (`fokker_planck_constant`), 2-D explicit HJB (`hjb_quadratic_2d`) and 2-D Poisson SOR (`poisson_2d_zero_boundary`). Each routine is verified against an analytic ground truth.
|
||||
Three CPU-only finite-difference solvers covering the two canonical PDE pillars of stochastic
|
||||
analysis: the **forward** equation for the marginal density of a diffusion (Fokker–Planck),
|
||||
the **backward** equation for an optimally controlled diffusion (Hamilton–Jacobi–Bellman),
|
||||
and a static **elliptic** boundary-value problem (Poisson).
|
||||
|
||||
.. note:: Companion executed notebook: `11_pde.ipynb <../../examples/notebooks/11_pde.ipynb>`_
|
||||
Mathematical background
|
||||
-----------------------
|
||||
|
||||
**Fokker–Planck (Kolmogorov forward).** For a 1-D Itô diffusion
|
||||
$dX_t = \mu(t, x)\, dt + \sigma(t, x)\, dW_t$, the marginal density $\rho(t, x)$ of $X_t$
|
||||
satisfies the parabolic PDE
|
||||
|
||||
.. math::
|
||||
|
||||
\partial_t \rho \;+\; \partial_x\!\bigl(\mu(t,x)\, \rho\bigr)
|
||||
\;=\; \tfrac12\, \partial^2_{xx}\!\bigl(\sigma^2(t,x)\, \rho\bigr),
|
||||
\qquad \rho(0, \cdot) = \rho_0 .
|
||||
|
||||
For the *pure-diffusion* test ($\mu \equiv 0$, $\sigma^2 \equiv 1$, $\rho_0 = \mathcal{N}(0, 1)$)
|
||||
the analytic Gaussian heat kernel gives $\rho(t, x) = \frac{1}{\sqrt{2\pi(1+t)}}\exp\!\bigl(-\frac{x^2}{2(1+t)}\bigr)$,
|
||||
so the variance grows linearly: $\mathrm{Var}(X_t) = 1 + t$. The conservative
|
||||
Lax–Wendroff / centred-flux scheme implemented by `fokker_planck_constant` preserves total mass
|
||||
(checked in the notebook to machine precision).
|
||||
|
||||
**Hamilton–Jacobi–Bellman.** Consider the controlled diffusion
|
||||
$dX_t = \mu(X_t, \alpha_t)\, dt + \sigma(X_t)\, dW_t$ and the value function
|
||||
$v(t, x) = \sup_\alpha \mathbb{E}_{t,x}\!\bigl[\int_t^T r(X_s, \alpha_s)\, ds + g(X_T)\bigr]$.
|
||||
Dynamic programming produces
|
||||
|
||||
.. math::
|
||||
|
||||
\partial_t v \;+\; \sup_{a \in \mathcal{A}}\Bigl\{ \mu(x, a) \cdot \nabla v
|
||||
\;+\; \tfrac12\, \mathrm{tr}\!\bigl(\sigma\sigma^\top(x)\, \nabla^2 v\bigr)
|
||||
\;+\; r(x, a) \Bigr\} \;=\; 0,
|
||||
\qquad v(T, x) = g(x).
|
||||
|
||||
`hjb_quadratic_2d` discretises this in 2-D by an explicit finite-difference scheme; the simple
|
||||
heat-only relaxation case (:math:`H \equiv 0`, :math:`\sigma^2 > 0`) preserves a constant value while a
|
||||
quadratic terminal :math:`g(x) = \tfrac12 \lVert x \rVert^2` smooths into a Gaussian-shaped value surface.
|
||||
|
||||
**Elliptic Poisson with zero Dirichlet boundary.** On the unit square $\Omega = (0,1)^2$,
|
||||
|
||||
.. math::
|
||||
|
||||
-\Delta u(x, y) = f(x, y) \text{ in } \Omega, \qquad u\!\restriction_{\partial\Omega} = 0 .
|
||||
|
||||
The Laplace eigenfunctions $\phi_{m,n}(x, y) = \sin(m\pi x)\sin(n\pi y)$ form an
|
||||
orthonormal basis with eigenvalues $\lambda_{m,n} = (m^2 + n^2)\pi^2$, so for
|
||||
$f = 2\pi^2 \sin(\pi x)\sin(\pi y)$ the *exact* solution is
|
||||
$u(x, y) = \sin(\pi x)\sin(\pi y)$. `poisson_2d_zero_boundary` solves the 5-point stencil by
|
||||
**Successive Over-Relaxation** with optimal relaxation parameter
|
||||
$\omega^* = 2 / (1 + \sin(\pi h))$ for grid spacing $h = 1/(N-1)$, achieving spectral radius
|
||||
$\rho \sim 1 - 2\pi h$ — i.e. $O(h^{-1})$ iterations to reach a fixed tolerance, against
|
||||
$O(h^{-2})$ for plain Gauss–Seidel.
|
||||
|
||||
**Probabilistic representation (Feynman–Kac).** Both the parabolic HJB and the elliptic
|
||||
Poisson PDE admit stochastic representations: $u(x) = \mathbb{E}_x\!\bigl[\int_0^{\tau_\Omega} f(X_s)\, ds\bigr]$
|
||||
for the latter, where $\tau_\Omega$ is the first exit time of the diffusion from $\Omega$.
|
||||
This links the PDE solvers above to the BSDE primitives of :doc:`bsde`.
|
||||
|
||||
Why it matters
|
||||
--------------
|
||||
|
||||
* **Density estimation under controlled noise.** Fokker–Planck is the workhorse of
|
||||
non-equilibrium statistical physics, plasma transport, calibration of stochastic-volatility
|
||||
models, and Langevin-based MCMC convergence diagnostics.
|
||||
* **Optimal control & inverse problems.** HJB is the cornerstone of dynamic programming,
|
||||
reinforcement learning (continuous-time policy iteration), and stochastic-control routing.
|
||||
* **Mean-field games.** The MFG fixed point is exactly the coupled system
|
||||
*(backward HJB + forward Fokker–Planck)* with cost depending on the density — building this
|
||||
loop on top of the two solvers above is one of the v2.0 milestones.
|
||||
* **Image processing & PDE-constrained optimisation.** Poisson editing, electric-potential
|
||||
reconstruction, gravitational-potential inversion all reduce to the same elliptic stencil.
|
||||
|
||||
.. note::
|
||||
📓 **Companion notebook** — `view on GitHub <https://github.com/ThotDjehuty/optimiz-rs/blob/main/examples/notebooks/11_pde.ipynb>`_
|
||||
· `download .ipynb <https://raw.githubusercontent.com/ThotDjehuty/optimiz-rs/main/examples/notebooks/11_pde.ipynb>`_
|
||||
|
||||
11 — PDE solvers
|
||||
================
|
||||
|
||||
Reference in New Issue
Block a user