Metadata-Version: 2.4
Name: fracbm
Version: 0.2.1
Summary: Fractional Brownian Noise (fGN) and Fractional Brownian Motion (fBM) generators in Python.
Author-email: Harry Brozel <harrybrozel@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/harry-bro/fracbm
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: numpy
Requires-Dist: scipy
Dynamic: license-file

# fracbm

  
Fractional Brownian Noise (fGN) and Fractional Brownian Motion (fBM) generators in Python.

  

## Installation

```bash

pip  install  fracbm

```

## Usage

  
```bash
import matplotlib.pyplot as plt
import fracbm

# Parameters
n = 1000      # number of steps
H = 0.8       # Hurst parameter

# Fractional Brownian motion using Davies–Harte
fbm_path = fracbm.daviesharte.motion(n, H)      # cumulative sum of fGn
fgn_increments = fracbm.daviesharte.noise(n, H) # fractional Gaussian noise

# Plot the full fBm path
plt.figure(figsize=(10, 4))
plt.plot(fbm_path, label="fBm path (Davies–Harte)")
plt.xlabel("Step")
plt.ylabel("Value")
plt.title("Fractional Brownian Motion (H=0.8, Davies–Harte)")
plt.legend()
plt.show()

```


## Features

Generate exact fractional Brownian motion using:

-   **Cholesky decomposition**, order $\mathcal{O}(n^3)$
-   **Davies-Harte method**, order $\mathcal{O}(n \log n)$ 	(recommended)  

Vary the Hurst parameter $H \in [0,1]$:

-   $H = 0.5$ is regular Brownian motion.
-   $H > 0.5$ causes slowly decaying positive autocorrelations (positive increments tend to follow positive increments - increments follow a trend).
-   $H < 0.5$ causes fast-decaying negative autocorrelations (negative increments tend to follow positive increments - increments revert to the mean).
