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. Solve Differential Equations (v1.1.0+)
# Solve y'' + y = 0 natively
eq = nb.parse(r"y'' + y = 0")
print(f"Solution: {eq.dsolve()}") # y(t) = C1*sin(t) + C2*cos(t)

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

💎 Production Features (v1.1.0)

🧠 Advanced Parser

  • Calculus: Support for $\int, \iint, \oint$, $\lim_{x \to a}$, $\sum, \prod$, and partial derivatives.
  • Differential/Integral Equations: Solve ODEs, IDEs, and Fractional Differential Equations (FDEs) using dsolve() with a built-in Laplace Transform engine. Supports Newton's prime notation ($y', y''$) and fractional orders ($y^{(0.5)}$) natively.
  • 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, and our Testing Guide before submitting code.

📄 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.1.0.tar.gz (31.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.1.0-py3-none-any.whl (31.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_nabla-1.1.0.tar.gz
  • Upload date:
  • Size: 31.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.1.0.tar.gz
Algorithm Hash digest
SHA256 f91d52467af58b5be98556bcbcbdf5fa8a09cad2ee928e3ca56ad5a3de653d5f
MD5 4751a0b8cec1758b39e7e50b0d3531c6
BLAKE2b-256 9e8ffd3071fcfc1d54dd97667c011bda8cc8dd95faccd53ca32b26e44af80bf4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_nabla-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 31.5 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f495594444e55ed53551b53d5373b15845cb153c5af4bd050e7ab97752daa2b
MD5 c6436e8b8ff603047813b0b2ce2dba03
BLAKE2b-256 67b42c238631a009210fb52863329332ec39ec5dab9757424df0e156ca5483a1

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