A LaTeX-first mathematical computing library combining symbolic and numeric analysis.
Project description
∇ Nabla: Mathematics at the speed of thought.
Nabla is a production-grade Python library designed for mathematicians, engineers, and data scientists who want the power of Mathematica or MATLAB with the modern elegance of Python. By placing LaTeX at the core of the developer experience, Nabla eliminates the friction between "math on paper" and "math in code."
🚀 Why Nabla?
For too long, Python developers have had to manually translate complex LaTeX equations into nested code structures. Every bracket and parenthesis is a potential bug.
Nabla solves this. It bridges the gap between SymPy's symbolic manipulation and NumPy's numerical performance using a high-fidelity Earley Parser. Write your equations once in LaTeX, and let Nabla handle the translation, simplification, and vectorization.
🛠️ Installation
pip install py-nabla
Note: For plotting support, use pip install py-nabla[plotting].
✨ Quickstart: The "Wow" Moment
Differentiate a complex integral and evaluate it numerically in just three lines of code:
from py_nabla import expr
# 1. Parse your LaTeX naturally
f = expr(r"\frac{d}{dx} \int_0^x \sin(t^2) dt")
# 2. Get the analytical result (Fundamental Theorem of Calculus)
print(f"Analytical: {f.simplify()}") # Result: sin(x^2)
# 3. Vectorize and evaluate at 1,000 points instantly
y_values = f.evaluate(x=[1.0, 1.5, 2.0])
💎 Core Features
🧠 Unbreakable Earley Engine
Unlike naive regex parsers, Nabla uses a robust Earley Parser capable of handling mathematical ambiguities. It understands that 2xy is $2 \cdot x \cdot y$, not a single variable, through an intelligent static symbol table.
🪄 Lazy LaTeX Support
Don't worry about perfect typesetting. Nabla's preprocessor automatically normalizes "lazy" inputs:
x^12⮕x^{12}\frac12⮕\frac{1}{2}
🛠️ Industry-Leading DX (Developer Experience)
Stop guessing where your LaTeX failed. NablaParseError provides visual pointers to exactly where the syntax error occurred:
NablaParseError: Unexpected token
\int_0^\infty e^{-x} d
^-- Unexpected EOF
🔍 Deep Decision Logging
Curious why xy was split? Enable debug logging to see every decision the parser makes:
from py_nabla.utils.logger import set_debug_mode
set_debug_mode(True)
📚 Robustness by Design
Nabla is stress-tested against:
- Deep Nesting: Unlimited levels of fractions, radicals, and powers.
- Calculus: Sophisticated handling of $\frac{d}{dx}$, $\int$, and $\lim$.
- Relations: Support for $=$, $<$, and $>$ symbols.
- Performance: High-speed vectorization via
to_numpy().
🤝 Contributing
We welcome contributions from the mathematical and open-source communities! Please see CONTRIBUTING.md for guidelines. See the GitHub Repository for the latest updates.
📄 License
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-0.1.0a0.tar.gz.
File metadata
- Download URL: py_nabla-0.1.0a0.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
096534a7740a9c7ab2cd59df5b4c3c2920ddfb35d65598cef8dbc35ab39b72ef
|
|
| MD5 |
01fb231d3b885444be267d556fc31104
|
|
| BLAKE2b-256 |
3386de642f546dd865ca31009aa6451f8a1595a278b1f88eb322f86cde76a401
|
File details
Details for the file py_nabla-0.1.0a0-py3-none-any.whl.
File metadata
- Download URL: py_nabla-0.1.0a0-py3-none-any.whl
- Upload date:
- Size: 13.4 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 |
b4316d8d4ecd3c2c2e0b02206afb14c59da105724cdcb8a295e5ea90f68934c8
|
|
| MD5 |
1eab99cc5d13cea7fe537a4f1ab2c923
|
|
| BLAKE2b-256 |
fc60fb3490296c4515e91c58c5bdfc5a29bedcc864e7a24bfd534c71fb175c4e
|