stochasticWeakRandomVariables
-
namespace stochasticWeakRV
Helpers that convert the underlying Gaussian Wiener increments into the discrete random variables used by the weak-order stochastic Runge-Kutta methods (DRI1, DRI1NM, W2Ito1, …).
Using these transforms (rather than storing the discrete variables directly) means the integrators can be driven either by a random Gaussian generator in production or by a prescribed Gaussian generator in tests, and in both cases the resulting discrete variables match the reference implementation exactly.
Warning
Stochastic integration is in beta.
Functions
-
inline double threePoint(double dW, double h)
Three-point distributed random variable.
Given a Gaussian increment
dW(~ N(0,h)) and the steph, returns a variable taking values in \(\{-\sqrt{3h},\,0,\,+\sqrt{3h}\}\) with probabilities \(\{1/6,\,2/3,\,1/6\}\). The scaled incrementdW/sqrt(h)is thresholded against the 1/6 quantile.
-
inline double twoPoint(double dZ, double scale)
Two-point distributed random variable.
Given a Gaussian increment
dZand a scales, returns \(+s\) ifdZ > 0else \(-s\). Uses a strictly-positive sign convention: a strictly positive increment maps to+sand zero/negative maps to-s.
Variables
-
double NORMAL_ONESIX_QUANTILE = -0.9674215661017014
The (negative) 1/6 quantile of the standard normal distribution, used as the threshold for the three-point transform.
-
inline double threePoint(double dW, double h)