Skip to main content

Image 27-09-26 at 12 12 PM

Python Version License Exactness Status

Processes as first-class algebraic objects with exact Lévy–Khintchine triplet arithmetic.


spxa — Stochastic Process Algebra

spxa is a Python library where stochastic processes are first-class algebraic objects.

from spxa.zoo.levy import VarianceGamma, BrownianMotion, GammaProcess
from spxa.zoo.beyond import FractionalBrownianMotion

X = VarianceGamma(sigma=0.2, nu=0.1, theta=-0.1)
Y = GammaProcess(a=1.0, b=2.0)

Z = X + 0.5 * Y          # exact: triplets add
W = X @ Y                 # exact: subordination via Bernstein functions

Z.triplet                 # LevyTriplet(b=..., sigma=..., nu=...)
Z.cumulants(order=4)      # exact symbolic cumulants
Z.char_func(u=1.0)        # characteristic function E[e^{iuZ_t}]
Z.__story__()             # human-readable derivation of Z's properties

Write Z = X + c*Y, get back a new process with its Lévy–Khintchine triplet computed exactly, cumulants derived symbolically, and a property lattice tracking what remains true (stationarity of increments, martingale property, tail class, self-similarity index) and what was invalidated by the operation. The library is loudly honest when you leave the Lévy regime, degrading gracefully to moment propagation rather than silently lying.

Why spxa

Every stochastic modeling library treats processes as simulation engines. spxa treats them as algebraic objects. The Lévy–Khintchine bijection — between Lévy processes and infinitely divisible distributions — means triplet arithmetic is exact for independent Lévy processes. This is a mathematical fact that no existing software exploits compositionally.

Researchers in quantitative finance, statistical physics, and computational biology currently re-derive combinations by hand each time, or simulate everything at the cost of closed-form insight. spxa closes that gap.

Core guarantees

  • Every operation returns a new immutable process object — no mutation
  • Every process carries an ExactnessLevel: EXACT, MOMENT_PROPAGATION, or SIMULATION_ONLY
  • Operations between exactness levels degrade to the lower level with an explicit warning and mathematical reason
  • The property lattice propagates automatically and never makes silent incorrect claims
  • tests/exactness/ verifies closed-form results against published formulas and blocks any PR that breaks them

Installation

pip install spxa

Requires Python ≥ 3.10.

Documentation

Process zoo

See PROCESS_REGISTRY.md for the full table of implemented processes with exactness levels, available cumulants, simulation algorithms, and primary references.

Contributing

See CONTRIBUTING.md. Contribution tiers:

  • New process to the zoo: requires triplet, cumulants, one primary citation
  • New operation: requires exactness proof or explicit approximation justification with cited error bounds
  • Changes to core/: requires RFC document and two maintainer approvals

License

MIT

Release files for spxa 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spxa 1.0.0
File Size Uploaded
spxa-1.0.0.tar.gz 942.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for spxa 1.0.0
File Interpreter ABI Platform
spxa-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 1.0 MB

Release files / spxa-1.0.0.tar.gz

Download URL spxa-1.0.0.tar.gz
Size 942.5 kB
Tags Source
SHA-256 checksum
How to use checksums
411ae76e7c3cbbca336f424c20d9bbdd9020b3a9a84bddd3dbfa8746537faee6
BLAKE2b-256 checksum
How to use checksums
e3c093a1b6ce4d47100dc7d252f1d85e9318b3b5092e70e60892370eeb12ccfa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release files / spxa-1.0.0-py3-none-any.whl

Download URL spxa-1.0.0-py3-none-any.whl
Size 101.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
84aea58f01e5dbf70f8b677a0965e1b2f9a4f86a9fbaaa5b47d317e500dcb56f
BLAKE2b-256 checksum
How to use checksums
0a8d1559dfdc268ddaf152706020d8faf474bdc50bd9fa6e12d950d8593c7aac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page