A library for pattern matching on symbolic expressions in Python

MatchPy
MatchPy is a library for pattern matching on symbolic expressions in Python.
Work in progress
Installation
MatchPy is available via PyPI, and for Conda via conda-forge. It can be installed with pip install matchpy
or conda install -c conda-forge matchpy
.
Overview
This package implements pattern matching in Python. Pattern matching is a powerful tool for symbolic computations, operating on symbolic expressions. Given a pattern and an expression (which is usually called subject), the goal of pattern matching is to find a substitution for all the variables in the pattern such that the pattern becomes the subject. As an example, consider the pattern f(x)
, where f
is a function and x
is a variable, and the subject f(a)
, where a
is a constant symbol.