Skip to main content

Mathematical computing with a LaTeX-first interface — symbolic, numeric, and beautiful.

Project description

∇ py-nabla: Mathematics in the language of thought.

PyPI version License: MIT Python 3.9+ Build Status Documentation

py-nabla is a production-grade mathematical computing engine that bridges the gap between LaTeX notation and Python execution. Write math exactly as you think it; execute it with the power of SymPy and NumPy.


🔥 Why py-nabla?

Translating complex LaTeX equations into nested Python code is brittle, time-consuming, and error-prone. One misplaced parenthesis in a symbolic expression can lead to hours of debugging.

py-nabla eliminates this friction.

  • Parse Naturally: High-fidelity Earley parser for complex LaTeX (vmatrix, cases, summations, mixed partials).
  • Compute Symbolically: Full integration with SymPy for calculus, algebra, and simplification.
  • Execute Numerically: Instant vectorization via NumPy for high-performance evaluation.
  • Visualize Beautifully: Built-in 2D/3D plotting engine with publication-ready aesthetics.
  • Render Professionally: Bidirectional LaTeX conversion with support for Leibniz, Prime, and Newton (dot) notations.

🛠️ Installation

# Core engine
pip install py-nabla

# With plotting support (recommended)
pip install py-nabla[plotting]

# Install all development dependencies
pip install py-nabla[all]

✨ Quickstart: The "Wow" Moment

Differentiate a complex expression, simplify it, and plot it in seconds:

import py_nabla as nb
import numpy as np

# 1. Parse your LaTeX
f = nb.parse(r"\frac{d}{dx} \left( x^2 \sin(x) \right)")

# 2. Compute analytically
print(f"Derivative: {f.simplify()}") 
# Result: 2*x*sin(x) + x**2*cos(x)

# 3. Render back to LaTeX (Leibniz style)
print(f.latex(mode='display'))

# 4. Plot instantly
nb.plot(f, domain=(-2, 2), title="Differentiated Waveform")

💎 Production Features (v1.0.0)

🧠 Advanced Parser

  • Calculus: Support for $\int, \iint, \oint$, $\lim_{x \to a}$, $\sum, \prod$, and partial derivatives.
  • Linear Algebra: Matrix environments (bmatrix, pmatrix, vmatrix) and vector notations.
  • Piecewise: Support for \begin{cases} environments.
  • Ambiguity Resolution: Intelligent splitting of multi-char symbols (e.g., 2weight $\to 2 \cdot w \cdot e \cdot i \cdot g \cdot h \cdot t$).

🪄 Publication Rendering

Beautiful bidirectional conversion with custom styles:

  • Derivative Styles: Choose between leibniz ($\frac{dy}{dx}$), prime ($y'$), or dot ($\dot{y}$).
  • Multiple Modes: inline, display, equation, or align.

📊 Plotting Engine

  • 2D Plots: Multi-function plotting with automatic labeling.
  • 3D Plots: Surface, wireframe, and contour plots for multivariable functions.
  • Parametric: Plot complex curves like circles, spirals, or Lissajous figures.

📚 Documentation & Tutorials


🤝 Contributing

We welcome contributions from the mathematical and open-source communities! Please see CONTRIBUTING.md for guidelines.

📄 License

py-nabla is released under the MIT 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

py_nabla-1.0.0.tar.gz (25.9 kB view details)

Uploaded Source

Built Distribution

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

py_nabla-1.0.0-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file py_nabla-1.0.0.tar.gz.

File metadata

  • Download URL: py_nabla-1.0.0.tar.gz
  • Upload date:
  • Size: 25.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for py_nabla-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7e71cac4853f32170aee8f6e776c8f1583155f05a6682f8274cfe957d400269c
MD5 2596faa462d70a7d86683dab12a0e231
BLAKE2b-256 eb6738ce72fdde087cc845eeb02256e68540d65642217c0b526c7e2d9b3eaa05

See more details on using hashes here.

File details

Details for the file py_nabla-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: py_nabla-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for py_nabla-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 95b4e9d503d195d2e3b4b95f7b5c57400763ab2b5f401bebac52b0010a7eb131
MD5 716f071d98cf36eff7bb8a70a641b3f4
BLAKE2b-256 13b85b24ef7a91d50b33d59eae24d35fe0858cc78b591aaf481c19e66c76473b

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