pybelikov
A Python module for the high-precision computation of Fully Normalized Associated Legendre Functions (fnALFs) using the Belikov recurrence algorithm.
Why pybelikov?
Standard recursive algorithms for Legendre functions often suffer from numerical instability (underflow/overflow) at high degrees ($n > 2000$) and can be computationally slow.
pybelikov implements the stable recurrence methods originally derived by Belikov, using the formulation and evaluation presented by Lei & Li (2016). This implementation is optimized for modern Python environments and offers two execution modes:
- JIT Mode (Default): Uses
numbato compile the recursion into machine code.- ~38x faster than standard iterative loop implementations.
- ~25% faster than optimized vectorized NumPy code.
- Vectorized Mode: A pure NumPy implementation that utilizes array broadcasting.
- ~30x faster than standard iterative loop implementations.
Benchmarks performed on N=2190 (EGM2008 standard).
Installation
pip install pybelikov
Usage
import numpy as np
from pybelikov import compute_fnALF
# Define parameters
degree = 2190
colat_rad = np.deg2rad(45.0) # Colatitude in radians
# Compute using the fastest method (JIT)
P_nm = compute_fnALF(N=degree, theta=colat_rad, method='jit')
# Access a specific value P(n=2, m=2)
print(f"P_2,2 = {P_nm[2, 2]}")
References
The algorithm implemented in this package is based on the evaluation and formulation described in:
Lei, W., & Li, K. (2016). Evaluating Applicability of Four Recursive Algorithms for Computation of the Fully Normalized Associated Legendre Functions. Journal of Applied Geodesy, 10(4). https://doi.org/10.1515/jag-2016-0032
Citing pybelikov
If you use pybelikov in your research, please credit the software.
A CITATION.cff file is included in this repository for compatibility with reference managers.
Software Citation:
Kellmayer, B. (2025). pybelikov: High-precision computation of fully normalized associated Legendre functions. https://github.com/bkellmayer6/pybelikov
Algorithm Citation:
Lei, W., & Li, K. (2016). Evaluating Applicability of Four Recursive Algorithms for Computation of the Fully Normalized Associated Legendre Functions. Journal of Applied Geodesy, 10(4).
Metadata
Release files for pybelikov 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pybelikov-0.1.0.tar.gz | 4.5 kB | Without provenance | Details for pybelikov-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pybelikov-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pybelikov-0.1.0-py3-none-any.whl |
Total release size: 8.6 kB
Release files / pybelikov-0.1.0.tar.gz
| Download URL | pybelikov-0.1.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a682b2e8c1280559773588598ea29272d73108a3e098db5c02b1efab5f526333
|
|
BLAKE2b-256 checksum How to use checksums |
d73db5104c5c395e06c775c258ad55dde362eddbc798cce56f5e48d130b1d62d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Release files / pybelikov-0.1.0-py3-none-any.whl
| Download URL | pybelikov-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b9225a8a02d1a9c5a0b12969719392ee7b104fedec945fd700df1069b5565630
|
|
BLAKE2b-256 checksum How to use checksums |
15b57a5c21e99fa64956e1c52b81b9e630f2eca1becce2e8d2c92614ee30b3cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Security for pybelikov 0.1.0
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.