complex-expr-parser
A fault-tolerant parser for complex-valued mathematical functions with human-friendly notation support.
Contents:
Features
Human-friendly syntax: Accepts natural mathematical notation
Implicit multiplication:
2zbecomes2*zPower notation:
z^2becomesz**2Absolute value:
|z|becomesAbs(z)Conjugate shorthand:
z*becomesconjugate(z)Unicode support:
pi,sqrt,oo(infinity)Function aliases:
ln->log,arcsin->asin, etc.Special functions: Gamma, Zeta, and more via mpmath
Vectorized evaluation: Works with NumPy arrays for fast computation
Quick Example
from complex_expr_parser import parse_complex_function, get_callable
# Parse an expression
expr = parse_complex_function("z^2 + 2z + 1")
print(expr) # z**2 + 2*z + 1
# Get a callable function
f = get_callable("sin(z)/z")
print(f(1+1j))
Installation
pip install complex-expr-parser
# With optional dependencies
pip install complex-expr-parser[all]