Skip to main content

Identify famous mathematical formulas from arbitrary SymPy expressions.

Project description

eml-discover

Stable beta. Patent pending. Source-available; see LICENSE.

Identify famous mathematical formulas from arbitrary SymPy expressions. Curated registry of ~17 formulas across statistics, ML activations, trig/hyperbolic identities, physics, and finance — each tagged with its Pfaffian-cost class for fast structural pre-filtering.

Installation

pip install eml-discover

eml-cost is installed as a dependency; sympy>=1.12 required.

Quick start

import sympy as sp
from eml_discover import identify

u = sp.Symbol("u")
matches = identify(1 / (1 + sp.exp(-u)))
for m in matches:
    print(m.formula.name, "—", m.confidence)
# sigmoid (canonical) — exact

matches = identify(sp.exp(-u**2 / 2) / sp.sqrt(2 * sp.pi))
print(matches[0].formula.name, matches[0].formula.description)
# Gaussian PDF (standardized) Standard normal probability density.

matches = identify("(log(S/K) + (r + vol**2/2)*T) / (vol*sqrt(T))")
print(matches[0].formula.citation)
# https://en.wikipedia.org/wiki/Black%E2%80%93Scholes_model

How it works

Two-stage match:

  1. Fingerprint pre-filter (cheap, structural). Every registry template carries a Pfaffian fingerprintp3-d2-w1-c0-h7f3a91 etc. Templates whose fingerprint axes don't match the user's expression are pruned in O(1) per template.
  2. Symbolic equivalence (true match). Survivors are checked under SymPy variable rename: for each candidate template, try permutations of the user's free symbols, accept the rename if sp.simplify(template - user) == 0.

Returns a list of Match ordered by confidence: identical (Python equality, no rename) → exact (symbolic equivalence after rename) → axes (fingerprint axes match but no rename works).

Registry

Inspect what's registered:

from eml_discover import list_all, list_by_domain, by_name

list_all()                  # every Formula
list_by_domain("physics")   # Bessel J_0, Airy Ai, Boltzmann factor, ...
by_name("Black-Scholes d1") # the d1 Formula

Add a formula by appending to eml_discover.registry.FORMULAS — each entry is a small dataclass (name, expression_factory, domain, description, citation).

Use cases

  • "Wait, that's Black-Scholes." Surface familiar formulas hiding in user code or auto-generated symbolic-regression output.
  • Curriculum tools. Tag a notebook's expressions by their registry name → automatic pedagogy ("this cell uses softplus").
  • Patent / claim analysis. Compare a candidate's formula against the public registry of named identities.

Links

License

PROPRIETARY-PRE-RELEASE. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eml_discover-0.2.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eml_discover-0.2.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file eml_discover-0.2.0.tar.gz.

File metadata

  • Download URL: eml_discover-0.2.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for eml_discover-0.2.0.tar.gz
Algorithm Hash digest
SHA256 32578d0235052c69c6f44650df777febc05375d268c7ad03352b3c353496cd85
MD5 4bab30376bac35a72130ef710f63f94b
BLAKE2b-256 324bfcb98e83481942ed347e1397e352ed88ac86a0b3bf1bfe5dccf97791acf7

See more details on using hashes here.

File details

Details for the file eml_discover-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: eml_discover-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for eml_discover-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 754af8042458c178046f8d98139a5e8b9c7f25d0e7dd1fd67c0abfc64b7fa4fa
MD5 f076c99523f67caf6a2b379029109c42
BLAKE2b-256 0805a5a3bddc9e9117c9e24f0435ca0538411f9ffb16d2a817dc3ecc22ad9d48

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page