Skip to content

davidsantiagoquevedo/fractional-brownian-motion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

import src.fBm_plot as pfb
from importlib import reload
reload(pfb)
import matplotlib.pyplot as plt
import warnings
import numpy as np
warnings.filterwarnings('ignore')

Propagator of the Fractional Brownian motion (fBm)

The fBm is a generalization of the ordinary Brownian motion (oBm) that accounts for memory effects and long-term correlations. There exist many definitions, one of particular utility is given by [1],

$$B_H(t) = B_H(0) + \frac{1}{\Gamma(H+1/2)} \int_0^t (t-\tau)^{H-1/2} \xi(\tau) d\tau, $$

where $\xi$ is a Gaussian uncorrelated noise (also known as white noise),

$$\langle \xi(t)\xi(\tau) \rangle = \delta(t-\tau),$$

and $H$ is the Hurst exponent, such that

  • $H = 1/2$, retrieves oBm $B(t) \equiv B_{1/2}(t)$, with

$$B(t) = B(0) + \int_0^t \xi(\tau) d\tau,$$

and transition probability (or propagator),

$$G(B,t|B(0),0) = \frac{1}{\sqrt{2\pi t}} \exp\left(-\frac{(B-B_0)^2}{2t}\right).$$

  • $H > 1/2$, gives positevely correlated increments
  • $H < 1/2$, gives negatively correlated increments.

The definition of the fBm can also be expressed as a Riemann-Liouville fractional integral,

$$B_H(t) = B_H(0) + \text{ }_0^{RL}D^{-(H+1/2)}_t \xi(\tau).$$

The construction of the propagator for the fBm can be achieved by using the path integral summing over the trajectories $\xi(t)$ that satisfy the constraint $B_H(t) - B_H(0) - \text{ }_0^{RL}D^{-(H+1/2)}_t \xi(\tau) = 0$; weighted by the Probability measure $\mathcal{P}(\xi)\mathcal{D}\xi = \exp\left[-\frac{1}{2}\int_0^{T}\xi^2(t)dt\right]\mathcal{D}\xi$,

$$ G(B_H,t|B_H(0),0) = \int \delta\left[B_H(t) - B_H(0) - \text{ }_0^{RL}D^{-(H+1/2)}_t \xi \right]\exp\left[-\frac{1}{2}\int_0^{T}\xi^2(t)dt\right] \mathcal{D}\xi.$$

The formal solution of this propagator is given by [1],

$$ G(B_H,t|B_H(0),0) = \sqrt{\frac{H}{\pi}} \frac{\Gamma(H+1/2)}{t^H} \exp\left(-H\Gamma^2(H+1/2)\frac{(B_H-B_H(0))^2}{t^{2H}}\right) $$

In the Figure below, the PDF of the fBm is shown for 20.000 trajectories and different points of time. It was fitted using the previous expression (including all the coefficientes).

[1] Calvo I. and Sánchez R. The path integral formulation of fractional Brownian motion for the general Hurst exponent. J. Phys. A: Math. Theor. 41 (2008)

import src.fBm_utils as fbm

T = 10
dt = 0.1
H = 0.7
n = int(T/dt)
fbm_series = fbm.get_realizations(H, T, n, 20000)[0]
fig, ax = plt.subplots()
pfb.plot_pdf_fBm(ax, H, t = 1.0, fbm_series = fbm_series)
pfb.plot_pdf_fBm(ax, H, t = 3.0, fbm_series = fbm_series)
pfb.plot_pdf_fBm(ax, H, t = 5.0, fbm_series = fbm_series)
fig.legend()
ax.set_title("")
Text(0.5, 1.0, '')

png

Variance of the fBm

From the solution of the propagator, we can see that the fBm is distributed as a Gaussian with variance

$$\langle B_H^2(t) \rangle = \frac{t^{2H}}{H\Gamma^2(H+1/2)}$$

Note that {fbm0.0.3} returns an fBm with normalized variance, sunch that

$$\langle B_H^2(t) \rangle = t^{2H}$$

This analytical expression is compared with an average over 20.000 trajectories generated with the library in the plot below.

t_ref = 5
fig, ax = plt.subplots(2, 2, figsize=(7,7))

H = 0.2
pfb.plot_msd_fBm(ax[0][0], H)

H = 0.5
pfb.plot_msd_fBm(ax[0][1], H)

H = 0.7
pfb.plot_msd_fBm(ax[1][0], H)

H = 0.9
pfb.plot_msd_fBm(ax[1][1], H)

fig.tight_layout()
handles, labels = ax[0][0].get_legend_handles_labels()
fig.legend(handles, labels, bbox_to_anchor = (0.99, -0.03), ncol = 2);
100%|██████████| 20000/20000 [00:33<00:00, 604.10it/s]
100%|██████████| 20000/20000 [00:16<00:00, 1193.20it/s]
100%|██████████| 20000/20000 [00:32<00:00, 613.00it/s]
100%|██████████| 20000/20000 [02:40<00:00, 124.87it/s]

png

Covariance of the fBm

For a normalized fBm, the (auto)-covariance between two times $s$ and $t$ is given by

$$\langle B_H(t) B_H(s) \rangle = \frac{1}{2}(t^{2H}+s^{2H}+|t-s|^{2H})$$

t_ref = 5
fig, ax = plt.subplots(2, 2, figsize=(7,7))

H = 0.2
pfb.plot_cov_fBm(ax[0][0], H, t_ref)

H = 0.5
pfb.plot_cov_fBm(ax[0][1], H, t_ref)

H = 0.7
pfb.plot_cov_fBm(ax[1][0], H, t_ref)

H = 0.9
pfb.plot_cov_fBm(ax[1][1], H, t_ref)

fig.tight_layout()
handles, labels = ax[0][0].get_legend_handles_labels()
fig.legend(handles, labels, bbox_to_anchor = (0.99, -0.03), ncol = 4)
fig.show()
100%|██████████| 20000/20000 [00:34<00:00, 585.66it/s]
100%|██████████| 20000/20000 [00:17<00:00, 1146.68it/s]
100%|██████████| 20000/20000 [00:31<00:00, 628.97it/s]
100%|██████████| 20000/20000 [02:33<00:00, 130.70it/s]

png

Fractional Gaussian Noise (fGn)

t_ref = 5
fig, ax = plt.subplots(2, 2, figsize=(7,7))

H = 0.2
pfb.plot_cov_noise(ax[0][0], H, t_ref)

H = 0.5
pfb.plot_cov_noise(ax[0][1], H, t_ref)

H = 0.7
pfb.plot_cov_noise(ax[1][0], H, t_ref)

H = 0.9
pfb.plot_cov_noise(ax[1][1], H, t_ref)

fig.tight_layout()
handles, labels = ax[0][0].get_legend_handles_labels()
fig.legend(handles, labels, bbox_to_anchor = (0.99, -0.03), ncol = 4)
fig.show()
100%|██████████| 10000/10000 [00:13<00:00, 746.13it/s]
100%|██████████| 10000/10000 [00:04<00:00, 2248.56it/s]
100%|██████████| 10000/10000 [00:12<00:00, 777.16it/s]
100%|██████████| 10000/10000 [01:12<00:00, 137.27it/s]

png

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages