Calculator Inputs
Example Data Table
| Model | Method | x₀ | μ / Rate | σ | Long Mean | T | Steps | Paths |
|---|---|---|---|---|---|---|---|---|
| GBM | Milstein | 1.00 | 0.15 | 0.30 | 1.00 | 1.00 | 250 | 1000 |
| OU | Euler-Maruyama | 0.50 | θ = 1.20 | 0.18 | 0.90 | 2.00 | 400 | 1500 |
| CIR | Milstein | 0.80 | κ = 1.10 | 0.25 | 1.20 | 1.50 | 300 | 1200 |
Formula Used
A stochastic differential equation is written as dX = a(X,t)dt + b(X,t)dW, where a is the drift term, b is the diffusion term, and W is Wiener noise.
The Euler-Maruyama update is Xn+1 = Xn + a(Xn,tn)Δt + b(Xn,tn)ΔW.
The Milstein update is Xn+1 = Xn + aΔt + bΔW + 0.5bb′[(ΔW)2 − Δt]. It improves strong-order accuracy when the diffusion derivative exists.
Supported model coefficients are:
- Brownian Motion: a = μ, b = σ
- Ornstein-Uhlenbeck: a = θ(m − X), b = σ
- Geometric Brownian Motion: a = μX, b = σX
- Cox-Ingersoll-Ross: a = κ(m − X), b = σ√X
The calculator also compares empirical path statistics with theoretical mean and variance whenever a closed-form reference is available.
How to Use This Calculator
- Select the stochastic model that matches your physics process.
- Choose Euler-Maruyama for a baseline solver or Milstein for stronger path accuracy.
- Enter the initial state, drift, diffusion, time horizon, and model-specific coefficients.
- Set the number of time steps and simulation paths.
- Use a fixed random seed when you want repeatable outputs.
- Click Solve SDE to generate statistics and path samples.
- Inspect the mean, variance, percentiles, confidence interval, and error against theory.
- Export the summary table using the CSV or PDF buttons.
FAQs
1. What does this calculator solve?
It numerically solves one-dimensional stochastic differential equations with random forcing. You can simulate Brownian motion, Ornstein-Uhlenbeck, geometric Brownian motion, and CIR dynamics using path-based Monte Carlo methods.
2. When should I use Euler-Maruyama?
Use Euler-Maruyama for fast baseline studies, teaching, and quick sensitivity checks. It is simple and efficient, but it may need smaller time steps for acceptable accuracy.
3. Why choose the Milstein method?
Milstein includes an extra correction linked to the diffusion derivative. This usually improves strong convergence for multiplicative noise, especially in models such as geometric Brownian motion.
4. What do the simulation paths represent?
Each path is one possible realization of the random process over time. Looking at many paths helps you estimate distributions, moments, uncertainty bands, and rare behavior.
5. Why are theoretical and empirical results different?
Differences arise from finite sampling error and numerical discretization. Increasing the number of paths and reducing the time step usually improves agreement with theoretical expectations.
6. Can this tool support physics applications?
Yes. It is useful for noisy transport, diffusion-driven fluctuations, thermal forcing, Langevin-style approximations, population balances, and other random dynamical systems in physics.
7. Why does the CIR model stay nonnegative here?
The implementation clips negative updates to zero after each step. This practical safeguard helps preserve the model’s physical meaning when numerical noise would otherwise create invalid values.
8. What improves accuracy most effectively?
Start by increasing time steps, then increase path count. Smaller time steps reduce discretization error, while more paths reduce Monte Carlo noise in final statistics.