Skip to main content

pythagorean-snap

O(log n) nearest-neighbor search on the full-circle Pythagorean manifold — zero drift, 1000x+ faster than brute force.

Install

pip install pythagorean-snap

Quick Start

from pythagorean_snap import PythagoreanManifold

m = PythagoreanManifold(50_000)
t = m.snap_angle(0.785)  # snap to nearest triple at ~45°
print(f"({t.x}, {t.y}, {t.c}) — angle: {t.angle():.4f} rad")
assert t.verify()  # x² + y² = c² — always exact

Performance

At max_c = 50,000 (41K+ triples):

  • Binary search: O(log n) per query
  • 100% agreement with brute-force
  • Zero floating-point drift

API

Method Description
PythagoreanManifold(max_c) Build manifold
.snap_angle(theta) Nearest triple to angle (rad)
.snap_brute(theta) Brute-force (verification)
.constraint_distance(theta) Angular distance
.angle_range() (min, max) angle
.iter_triples() Iterate all triples

License

MIT

Metadata

Release files for pythagorean-snap 0.1.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 pythagorean-snap 0.1.0
File Size Uploaded Provenance Actions
pythagorean_snap-0.1.0.tar.gz 3.8 kB Without provenance Details for pythagorean_snap-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pythagorean-snap 0.1.0
File Interpreter ABI Platform Actions
pythagorean_snap-0.1.0-py3-none-any.whl Python 3 none any Details for pythagorean_snap-0.1.0-py3-none-any.whl

Total release size: 7.6 kB

Release files / pythagorean_snap-0.1.0.tar.gz

Download URL pythagorean_snap-0.1.0.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3a4d65e0c5f77f56abf4b96fc50d2e6cf76d1e9757bee6672be671dc9f40ea67
BLAKE2b-256 checksum
How to use checksums
b8811c7792a8e7f4989c50b6fa9c64431d2f6c3b8f6fb0dbdc44aa2d03afbb17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / pythagorean_snap-0.1.0-py3-none-any.whl

Download URL pythagorean_snap-0.1.0-py3-none-any.whl
Size 3.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd91eb836caa40d6bbfbe388b94181d42c2321defc5f2f3e56b5ca6b6aca569c
BLAKE2b-256 checksum
How to use checksums
738f2210ba17e8e30a78346404e84ea2b6577ec4b302a926f6adc9fe6c7b7889
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Security for pythagorean-snap 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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