Skip to main content

Some elliptic integrals in JAX

Project description

jaxellip: JAX implementations of some elliptic integrals

test coverage pypi-version pypi-downloads

Elliptic integrals are available in scipy.special, but are not implemented in jax.scipy.special, making them neither differentiable nor compatible with JAX’s JIT compilation. This package provides JAX-compatible implementations of several elliptic integrals from scipy.special: ellipk, ellipkm1, and ellipe. The results have been tested against scipy.special to ensure accuracy and performance (see tests).

Usage

  1. Install jaxellip.
pip install jaxellip
  1. Import jaxellip in your Python code and use it.
import jaxellip

jaxellip.ellipk(0.5) # Complete elliptic integral of the first kind
jaxellip.ellipkm1(0.5) # Complete elliptic integral of the first kind around m = 1
jaxellip.ellipe(0.5) # Complete elliptic integral of the second kind

Elliptic integrals

The elliptic integrals in jaxellip follow the same parameter conventions as scipy.special. In particular, the input parameter $m$ is the elliptic parameter, defined as $m = k^2$, where $k$ is the modulus. This differs from some literature or libraries (e.g., Boost or Abramowitz & Stegun), where the integrals are sometimes expressed in terms of $k$ directly.

The function ellipkm1(m) computes the complete elliptic integral of the first kind with argument $1 - m$, i.e., $K(1 - m)$. This is particularly useful for improved numerical stability and precision when $m$ is close to 1, since $K(m)$ diverges logarithmically as $m \to 1$.

Complete elliptic integral of the first kind

$$ K(m) = \int_0^{\pi/2} \frac{1}{\sqrt{1 - m \sin^2 \theta}} d\theta $$

Complete elliptic integral of the second kind

$$ E(m) = \int_0^{\pi/2} \sqrt{1 - m \sin^2 \theta} d\theta $$

Complete elliptic integral of the third kind

$$ \Pi(n, m) = \int_0^{\pi/2} \frac{1}{(1 - n \sin^2 \theta) \sqrt{1 - m \sin^2 \theta}} d\theta $$

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

jaxellip-0.0.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

jaxellip-0.0.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file jaxellip-0.0.1.tar.gz.

File metadata

  • Download URL: jaxellip-0.0.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for jaxellip-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e3d1ef022a8a7bec2d39c8112c9e8d4c4c56aaac498022e81fd635705664e3f8
MD5 2aa40a83657e234098fcb6280465db89
BLAKE2b-256 ae83a13a459ac06e7cab4cca8571fa4b1d22074b18fb35e60fab962203c09cc3

See more details on using hashes here.

Provenance

The following attestation bundles were made for jaxellip-0.0.1.tar.gz:

Publisher: publish-a-release.yaml on sinaatalay/jaxellip

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jaxellip-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: jaxellip-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for jaxellip-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2d6c3b50f16acf9d6a9f9d09f4d9a16379ff31e5548bd7e05646d7df0a5c66ed
MD5 ae3e67b08675e71d948fb42a4d9d2f5b
BLAKE2b-256 3ca65365930d96cdd716a89a9fd1705970f2ced662d95fff736db135d776a8f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for jaxellip-0.0.1-py3-none-any.whl:

Publisher: publish-a-release.yaml on sinaatalay/jaxellip

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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