Read the equation
The PDE transports probability with drift and spreads it with diffusion. The code applies centered first and second differences on an equally spaced grid, then one explicit time step. Stability, nonnegative densities, and total-mass preservation require suitable step sizes and boundary treatment; copying adjacent endpoint values is not generally a zero-flux reflecting condition when drift is nonzero.
Terms & definitions
| Term | Meaning in this source |
|---|---|
| p | Density values |
| mu | Constant drift |
| sigma | Constant diffusion scale |
| dx | Grid spacing |
| dt | Time step |
How it works
Read the definition from its right-hand expression to the quantity on the left. Its surrounding source records the intended input, state, or parameter context. Where the source leaves an operation unspecified, this page preserves that gap.
Assumptions & limits
Source recovery establishes that the expression appears in this record. Its mathematical validity, implementation behavior, and interpretation must be assessed separately. See the linked source and research notes for the checks available for this version.
Original context
Read the surrounding source passage
// GeometricBrownian computes GBM step
// dS = μS·dt + σS·dW
func GeometricBrownian(s, mu, sigma, dt, dw float64) float64 {
return s * (1.0 + mu*dt + sigma*dw)
}
// FokkerPlanck computes probability density evolution
// ∂p/∂t = -∂(μp)/∂x + (1/2)∂²(σ²p)/∂x²
func FokkerPlanck(p []float64, mu, sigma, dt, dx float64) []float64 {
n := len(p)
if n < 3 {
return p
}
result := make([]float64, n)
sigma2 := sigma * sigma
for i := 1; i < n-1; i++ {Exact original notation
∂p/∂t = -∂(μp)/∂x + (1/2)∂²(σ²p)/∂x²