Mathematical computing with a LaTeX-first interface — symbolic, numeric, and beautiful.
Project description
∇ py-nabla: Mathematics in the language of thought.
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'$), ordot($\dot{y}$). - Multiple Modes:
inline,display,equation, oralign.
📊 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_nabla-1.0.1.tar.gz.
File metadata
- Download URL: py_nabla-1.0.1.tar.gz
- Upload date:
- Size: 26.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6020c72d9e2028d1151177934776b714b59c32e74c2b2b9c24f27a34ef8f59cc
|
|
| MD5 |
c71bb1bde2c018f587da9f799ff82bab
|
|
| BLAKE2b-256 |
7a93467c018713ecba774e47c692f071382297351887a77d271c9fddca5da39c
|
File details
Details for the file py_nabla-1.0.1-py3-none-any.whl.
File metadata
- Download URL: py_nabla-1.0.1-py3-none-any.whl
- Upload date:
- Size: 25.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f74e45b05417253f2d7e48abb16a59620f797202ff81945ab47021a76490b53
|
|
| MD5 |
d160a0eec56bec4e2e767933f7fb7ccf
|
|
| BLAKE2b-256 |
8a07d1884b276f8279cc8acdcb5da334c1ca49ab2aa3a7f8502945453f99e433
|