Stochastic Differential Equation Simulator
The SDE Simulator simulates a stochastic differential equation (geometric Brownian motion) using the Euler-Maruyama method, visualizing the solution with p5.js and displaying computational steps with MathJax-rendered notation.
SDE Simulator
The SDE Simulator models a stochastic differential equation of the form \\( dx_t = \mu x_t dt + \sigma x_t dW_t \\), where \\( \mu \\) is the drift, \\( \sigma \\) is the volatility, and \\( dW_t \\) is a Wiener process. Using the Euler-Maruyama method, it computes the solution path, visualizes it with p5.js, and displays steps with MathJax. Input parameters like drift, volatility, initial value, time step, and number of steps, then see the results and share or embed the simulation.
Example 1: Basic SDE Simulation
Parameters: \\( \mu = 0.1 \\), \\( \sigma = 0.2 \\), \\( x_0 = 1.0 \\), \\( dt = 0.01 \\), \\( N = 1000 \\).
Step 1: Initialize \\( x_0 = 1.0 \\).
Step 2: Apply Euler-Maruyama: \\( x_{t+1} = x_t + \mu x_t dt + \sigma x_t \sqrt{dt} Z \\), where \\( Z \sim N(0,1) \\).
Step 3: Simulate for 1000 steps.
Result: A path with moderate growth and random fluctuations.
Example 2: High Volatility
Parameters: \\( \mu = 0.05 \\), \\( \sigma = 0.5 \\), \\( x_0 = 1.0 \\), \\( dt = 0.01 \\), \\( N = 1000 \\).
The high \\( \sigma \\) causes larger random fluctuations in the path.
Example 3: Zero Drift
Parameters: \\( \mu = 0.0 \\), \\( \sigma = 0.2 \\), \\( x_0 = 1.0 \\), \\( dt = 0.01 \\), \\( N = 1000 \\).
With \\( \mu = 0 \\), the path fluctuates purely due to the stochastic term.
Example 4: Small Time Step
Parameters: \\( \mu = 0.1 \\), \\( \sigma = 0.2 \\), \\( x_0 = 1.0 \\), \\( dt = 0.001 \\), \\( N = 10000 \\).
Smaller \\( dt \\) increases accuracy but requires more steps for the same time span.
Example 5: Large Initial Value
Parameters: \\( \mu = 0.1 \\), \\( \sigma = 0.2 \\), \\( x_0 = 10.0 \\), \\( dt = 0.01 \\), \\( N = 1000 \\).
A larger \\( x_0 \\) amplifies the effect of both drift and volatility.