Companion Python/NumPy code for absorption-probability invariance under transient self-loop deformation in finite absorbing DTMCs.
For a finite absorbing discrete-time Markov chain in canonical form, let Q be the transient-to-transient block and R the transient-to-absorbing block. The absorption-probability matrix is
B = (I - Q)^(-1) R.
This repository verifies that B is invariant under statewise deformation of transient self-loops: transient self-loop probabilities are scaled by state-specific parameters, and the remaining exit probabilities are renormalized. The code also computes the fundamental matrix, mean and variance of steps to absorption, condition numbers, and the corridor example used in the manuscript.
python -m venv .venv
.venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install -e ".[dev]"Run the corridor example and print a table:
python examples/corridor_example.pyOptionally write CSV output:
python examples/corridor_example.py --csv outputs/t_values.csvpython -m pytestsrc/absorption_invariance/: package source code.examples/corridor_example.py: reproducible corridor computations.tests/test_core.py: numerical tests for validation, deformation, invariance, and moments.pyproject.toml: package metadata and dependencies.
Please cite the archived v1.0.0 release using DOI 10.5281/zenodo.20559528 and the metadata in CITATION.cff.
MIT License.
This is research companion code, provided as-is. It is not intended to be a general-purpose Markov-chain package.