Skip to main content

GPU-accelerated Airy functions for Apple Silicon using MLX

Project description

mlx-airy

GPU-accelerated Airy functions for Apple Silicon using MLX.

Neither MLX nor JAX currently provide Airy functions (see JAX issue #25244). This package fills that gap for the MLX ecosystem.

What are Airy functions?

Airy functions Ai(x) and Bi(x) are the two linearly independent solutions to the Airy differential equation:

y'' - x y = 0

They appear throughout physics and engineering:

  • Quantum mechanics -- WKB connection formulas, tunneling through linear potentials
  • Optics -- diffraction near caustics, rainbow scattering
  • Fluid dynamics -- boundary layers, Stokes phenomena
  • Astrophysics -- gravitational lensing near fold caustics

Installation

pip install -e ".[test,benchmark]"

Requires Python >= 3.10 and Apple Silicon (MLX).

Usage

import mlx.core as mx
from mlx_airy import airy

x = mx.linspace(-15.0, 15.0, 10000)
ai, aip, bi, bip = airy(x)  # Ai(x), Ai'(x), Bi(x), Bi'(x)

All four functions are returned in a single call, matching the scipy.special.airy convention.

Implementation

Region Method Reference
|x| < 5 Taylor series (50 terms, Horner) DLMF 9.4
x >= 5 Asymptotic expansion DLMF 9.7.5--9.7.8
x <= -5 Oscillatory asymptotic DLMF 9.7.9--9.7.12

Computation is float32 throughout, running entirely on the Apple GPU.

Tests

pytest tests/ -v

Benchmark

python -m mlx_airy.benchmark

Compares accuracy and throughput against scipy.special.airy.

Author

Sheng-Kai Huang (akai@fawstudio.com)

License

MIT

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

mlx_airy-0.1.0.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

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

mlx_airy-0.1.0-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file mlx_airy-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for mlx_airy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 54e5d64e6f0fa5b3c2b81c48de761091008adfca62ef86ebece7f6984237c1bc
MD5 1bf2a705e8984ff7a1220b1f84829cbe
BLAKE2b-256 d2f19184360364d5d2f5d71242500e25a2591c18781bffe4e347b4b04117806f

See more details on using hashes here.

File details

Details for the file mlx_airy-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for mlx_airy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e3cd044ac716da83cee4fa97d5d9181e160edefb5a1775583ac3ea7f3828979e
MD5 ffad367fac4f1d467ead766922a61536
BLAKE2b-256 161bc1e18c2d188bebbb1f28a5a88b6f3925ccbfcf1d3f5ed0a8f88901445e70

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