Understanding Itō Calculus and Its Application in Stochastic Differential Equations
by Manuel de Prada Corral
3 min read
In this blog post, we will explore the essential concepts of Itō calculus and how they apply to solving stochastic differential equations (SDEs). We will also see how these concepts are implemented in Python code to simulate and filter stochastic processes.
What is Itō Calculus?
Itō calculus extends classical calculus to stochastic processes, particularly those driven by Brownian motion. It includes key tools like the Itō integral and Itō's Lemma.
Brownian Motion
Brownian motion is a continuous-time stochastic process with:
- .
- Independent increments.
- Normally distributed increments: .
Itō Integral
The Itō integral of a process with respect to Brownian motion is denoted:
Itō's Lemma
Itō's Lemma is the stochastic counterpart of the chain rule. For a function where follows: Itō's Lemma states:
Solving SDEs with Itō's Lemma
Consider the SDE:
Applying Itō's Lemma to :
Solving this:
Exponentiating both sides:
Implementation in Python
Here's how this is implemented in the context of a particle filter simulation:
import numpy as np
# Parameters
y0 = 1.0
mu = 0.1
sigma = 0.2
T = 1.0
N = 100
M = 1000
dt = T / N
# Placeholder for observations and time
time = np.linspace(0, T, N+1)
true_state = np.exp((mu - 0.5 * sigma**2) * time + sigma * np.random.normal(0, np.sqrt(time)))
# Simulate and plot the true state
import matplotlib.pyplot as plt
plt.figure(figsize=(10, 6))
plt.plot(time, true_state, label='True State')
plt.xlabel('Time')
plt.ylabel('State')
plt.title('True State Evolution Using Itō Calculus')
plt.legend()
plt.show()
In the code:
true_state
is calculated using the derived formula from Itō's Lemma.np.random.normal(0, np.sqrt(time))
simulates the Brownian motion increments. This demonstrates how Itō calculus is applied to model and simulate stochastic processes, providing a powerful toolset for understanding systems influenced by randomness.
Missing:
- Sequential Monte Carlo
- Geometric Brownian motion
- Stochastic differential equations definition
- full demo
- Applications in finance
Batch Size | A100 80G Batch/s | A100 80G Tok/s | 1xA100 40G Batch/s | 1xA100 40G Tok/s | 2xA100 40G Batch/s | 2xA100 40G Tok/s | 3xA100 40G Batch/s | 3xA100 40G Tok/s | 4xA100 40G Batch/s | 4xA100 40G Tok/s |
---|---|---|---|---|---|---|---|---|---|---|
1 | 47.46 | 47.46 | 37.51 | 37.51 | 29.56 | 29.56 | 29.44 | 29.44 | 28.35 | 28.35 |
4 | 49.76 | 199.04 | 38.81 | 155.24 | 30.15 | 120.6 | 28.14 | 112.56 | 28.83 | 115.32 |
8 | 49.12 | 393.0 | 41.64 | 333.12 | 30.38 | 243.04 | 28.23 | 225.84 | 28.88 | 231.04 |
16 | 49.35 | 789.6 | 39.85 | 637.6 | 28.92 | 462.72 | 26.33 | 421.28 | 26.76 | 428.16 |
32 | 47.75 | 1528.0 | 37.64 | 1204.48 | 27.71 | 886.72 | 27.87 | 892.84 | 27.98 | 895.36 |
64 | 39.55 | 2531.2 | 33.44 | 2140.16 | 27.97 | 1790.08 | 22.35 | 1430.4 | 22.4 | 1433.6 |
128 | 25.86 | 3310.1 | 22.13 | 2832.64 | 22.48 | 2877.44 | 15.77 | 2018.56 | 15.67 | 2005.76 |
256 | 15.32 | 3921.9 | 12.61 | 3227.36 | 14.15 | 3622.4 | 9.53 | 2439.68 | 8.77 | 2245.12 |
512 | 8.17 | 4183.0 | OOM | OOM | 7.4 | 3788.8 | 6.88 | 3522.56 | 4.83 | 2472.96 |
750 | OOM | OOM | OOM | OOM | 5.07 | 3802.5 | 3.73 | 2797.5 | ||
1024 | OOM | OOM | 3.03 | 3102.72 | ||||||
1500 | OOM | OOM |